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.
Authorization
ApiKeyAuth 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"
}
}Create Embeddings POST
Creates an embedding vector for the provided input. Compatible with the OpenAI Embeddings API.
Create Message POST
Creates a model response using the Anthropic Claude Messages API format. Supports streaming via `stream: true`. Automatically routes to the best available provider (Anthropic, Google, OpenAI-compatible). Set `ANTHROPIC_BASE_URL` to this server's base URL in Claude Code or any Anthropic SDK to use Yolo Router as a drop-in replacement.