API Reference

Create Image

Creates an image given a prompt. Compatible with the OpenAI Images API. Automatically routes to the best available provider. No image generation models are currently online — check `GET /v1/models` for current availability before relying on this endpoint.

POST
/v1/images/generations

Authorization

ApiKeyAuth
AuthorizationBearer <token>

Your Yolo Router API key. Format: Authorization: Bearer sk-...

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

curl -X POST "https://api.yolorouter.com/v1/images/generations" \  -H "Content-Type: application/json" \  -d '{    "model": "<image-model-id>",    "prompt": "A cute cat sitting on a sunny beach",    "n": 1,    "size": "1024x1024"  }'
{
  "created": 0,
  "data": [
    {
      "url": "string",
      "b64_json": "string",
      "revised_prompt": "string"
    }
  ]
}
{
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_api_key",
    "message": "Invalid API key"
  }
}
{
  "error": {
    "type": "insufficient_quota",
    "code": "insufficient_quota",
    "message": "Quota exceeded"
  }
}
{
  "error": {
    "type": "string",
    "code": "string",
    "message": "string"
  }
}