Image Generation API

Note: The image generation endpoint is currently under development and not yet available on the public API. This documentation is provided for preview purposes only.

The image generations endpoint allows you to create AI-generated images from text prompts using various image models through a single, unified API. This eliminates the need to integrate with multiple different image generation services and APIs.

Endpoint

POST https://api.llm.vin/v1/images/generations

Request Format

{
  "model": "flux-1",
  "prompt": "A detailed description of the image you want to generate",
  "n": 1,
  "size": "1024x1024"
}

Required Parameters

Parameter Type Description
model string ID of the model to use for image generation. See Available Models below.
prompt string A text description of the image you want to generate. Be specific and detailed for best results.

Optional Parameters

Parameter Type Default Description
n integer 1 Number of images to generate. Only supported by certain models.
size string “1024x1024” Size of the generated image. Must be one of the allowed resolutions for the selected model. Common options include “1024x1024”, “1024x1792”, and “1792x1024”.
guidance_scale number 3.5 Controls how closely the image follows the prompt. Higher values make the image more closely match the prompt but may reduce quality. Only supported by certain models.
num_inference_steps integer 30 Number of denoising steps. Higher values may produce better quality but take longer. Only supported by certain models.

Response Format

{
  "created": 1716151540,
  "data": [
    {
      "url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUE..."
    }
  ]
}

The response contains:

If multiple images were requested (n > 1), the data array will contain multiple image objects.

Available Models

The following models are available for image generation:

Model ID Company* Description
flux-1 Black Forest Labs Flux-1 model for creative and detailed image generation

Example Requests

Basic Image Generation

curl "https://api.llm.vin/v1/images/generations" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-1",
    "prompt": "A serene landscape with mountains and a lake at sunset",
    "size": "1024x1024"
  }'

Generating Multiple Images

curl "https://api.llm.vin/v1/images/generations" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-1",
    "prompt": "A whimsical forest with magical creatures and glowing plants",
    "n": 2,
    "size": "1024x1792"
  }'

Using Advanced Parameters

curl "https://api.llm.vin/v1/images/generations" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-1",
    "prompt": "A detailed portrait of a cyberpunk character with glowing cybernetic implants",
    "size": "1024x1024",
    "guidance_scale": 7.5,
    "num_inference_steps": 50
  }'

Rate Limits

The image generation endpoint has the following rate limits:

These limits are in place to ensure fair usage of the service and may be adjusted in the future.

Authentication

While some models may be available without authentication, we recommend using API keys for reliable access and higher rate limits. Include your API key in the Authorization header:

curl "https://api.llm.vin/v1/images/generations" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your_api_key_here" \
  -d '{
    "model": "flux-1",
    "prompt": "An astronaut riding a horse on Mars, digital art"
  }'

Error Handling

The API returns standard HTTP status codes to indicate success or failure:

Status Code Description
200 Success
400 Bad request (invalid parameters)
401 Unauthorized (invalid or missing API key)
403 Forbidden (insufficient permissions)
404 Not found (invalid model)
429 Too many requests (rate limit exceeded)
500 Server error

Error responses include a JSON object with details:

{
  "error": {
    "message": "Invalid image size '2048x2048'. Allowed sizes: 1024x1024, 1024x1792, 1792x1024",
    "type": "invalid_request_error"
  }
}

Coming Soon

We’re actively working on expanding our image generation capabilities with:

Stay tuned for updates!