AI Text-to-Image API

This API endpoint allows you to generate images using the Stable JustPump AI Text-to-Image model. The service accepts text prompts and returns generated images.

API Endpoint

POST https://ai-image.justpump.pro

Request Format

Headers

Header
Value
Required

Content-Type

application/json

Yes

Request Body

{
  "prompt": "string"
}
Parameter
Type
Required
Description

prompt

string

Yes

Text description of the image you want to generate

Response Format

Success Response

On success, the API returns a PNG image with the following headers:

Status: 200 OK
Content-Type: image/png
Access-Control-Allow-Origin: *

The response body contains the binary image data.

Error Responses

Invalid Method (405)

{
  "message": "Please use POST method"
}

Missing Prompt (400)

{
  "error": "Missing prompt in request body",
  "example": {
    "method": "POST",
    "headers": {
      "Content-Type": "application/json"
    },
    "body": {
      "prompt": "your prompt here"
    }
  }
}

Server Error (500)

{
  "error": "Error generating image",
  "message": "Error details..."
}

CORS Support

The API supports Cross-Origin Resource Sharing (CORS) with the following configurations:

  • Allowed Origins: * (all origins)

  • Allowed Methods: POST, OPTIONS

  • Allowed Headers: Content-Type

  • Max Age: 86400 seconds (24 hours)

Error Handling

The API implements robust error handling for various scenarios:

  1. Invalid HTTP methods

  2. Missing or invalid request body

  3. Missing prompt parameter

  4. Model generation failures

  5. Server-side errors

Best Practices

  1. Prompts

    • Be specific and detailed in your prompts

    • Include style descriptions if needed

    • Keep prompts clear and concise

  2. Error Handling

    • Always implement proper error handling

    • Check response status codes

    • Handle binary image data appropriately

  3. Performance

    • Consider implementing caching for repeated prompts

    • Be mindful of request frequency

    • Handle timeouts gracefully

Limitations

  1. Maximum request body size may be limited

  2. Generation time may vary based on prompt complexity

Support

For API support or to report issues, please contact the development team or create an issue in the repository.

Last updated