XRToken API Docs

Generate images

API Configuration
After saving, the Try It panel below sends real requests with this key.
Base: api.xrtoken.ai

Generate images from text descriptions. Billing: charged per generated image x unit price (CNY). Returns a list of image URLs on success.

POST
/v1/images/generations

Authorization

BearerAuth
AuthorizationBearer <token>

API key authentication (OpenAI format). Pass in the Authorization header:

Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X post "https://api.xrtoken.ai/v1/images/generations" \  -H "Content-Type: application/json" \  -d '{    "model": "stabilityai/stable-diffusion-3-5-large",    "prompt": "A white unicorn running under a starry sky, oil painting style"  }'
{
  "created": 0,
  "data": [
    {
      "url": "http://example.com",
      "b64_json": "string"
    }
  ],
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0,
    "total_tokens": 0
  }
}
{
  "error": "model field is required",
  "type": "invalid_request_error"
}
{
  "error": "invalid or missing API key",
  "type": "auth_error"
}
{
  "error": "insufficient balance -- please top up or upgrade your plan",
  "type": "billing_error"
}
{
  "error": "rate limit exceeded",
  "type": "rate_limit_error"
}
{
  "error": "upstream provider error",
  "type": "server_error"
}