Skip to main content
POST
/
v1
/
generate
POST /v1/generate — Generate Images via API
curl --request POST \
  --url https://api.example.com/v1/generate \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "<string>",
  "model": "<string>",
  "width": 123,
  "height": 123,
  "num_images": 123
}
'
{
  "success": true,
  "images": [
    {
      "url": "<string>"
    }
  ],
  "request_id": "<string>",
  "credits_used": 123
}

Documentation Index

Fetch the complete documentation index at: https://docs.artnex.app/llms.txt

Use this file to discover all available pages before exploring further.

The /v1/generate endpoint converts a text prompt into one or more images using your chosen AI model. Send a prompt and model name; receive a list of image URLs you can use immediately or store for later.

Endpoint

POST https://api.artnex.ai/v1/generate

Request parameters

prompt
string
required
The text description of the image you want to generate. Be specific — more detail leads to better results. Maximum 4,000 characters.
model
string
required
The AI model to use for generation. Must be one of the supported model IDs listed in the Models section below.
width
integer
Image width in pixels. Accepted values depend on the model. Defaults to 1024 for most models.
height
integer
Image height in pixels. Accepted values depend on the model. Defaults to 1024 for most models.
num_images
integer
default:"1"
Number of images to generate in a single request. Accepted range: 14. Each image costs the full per-model credit amount.

Response fields

success
boolean
required
true when the request completed successfully.
images
array
Array of generated image objects. Each object contains a url field with a CDN-hosted link to the image.
request_id
string
Unique identifier for this request, useful for support queries or logging.
credits_used
integer
Total credits deducted from your account balance for this request.

Models

Choose the model that fits your quality and budget requirements:
Model IDCredits per imageDescription
z-image-turbo100Fast, affordable generation for prototyping
artsyn-light240Balanced quality and speed
flux-2-pro250High-quality professional output
seedream-v4200Bytedance Seedream v4
seedream-v4.5800Higher-fidelity Seedream output
nano-banana-pro800Premium generation with fine detail
nano-banana-pro-ultra1,000Ultra-high-resolution (up to 8K) output
gpt-image-2VariesOpenAI GPT-Image-2; credits vary by resolution and quality
gpt-image-2 uses dynamic pricing based on resolution (1k, 2k, 4k) and quality (low, medium, high). Pass resolution and quality fields alongside the standard parameters when using this model.

Example requests

curl --request POST \
  --url https://api.artnex.ai/v1/generate \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "prompt": "A serene mountain landscape at sunset, photorealistic, golden hour lighting",
    "model": "flux-2-pro",
    "width": 1024,
    "height": 1024,
    "num_images": 1
  }'

Example response

{
  "success": true,
  "images": [
    {
      "url": "https://cdn.artnex.ai/gen/req_abc123xyz/image_0.jpg"
    }
  ],
  "request_id": "req_abc123xyz",
  "credits_used": 250
}

Error codes

HTTP statusError codeCause
400missing_promptThe prompt field is absent or empty
400invalid_modelThe model value is not a supported model ID
400invalid_dimensionswidth or height is outside the allowed range for the selected model
401invalid_api_keyThe API key is missing, malformed, or revoked
402insufficient_creditsYour account does not have enough credits to complete the request
429rate_limit_exceededYou have exceeded your plan’s daily request quota
Use z-image-turbo (100 credits) during development to conserve credits, then switch to a higher-fidelity model for production.