Create Image
Creates an image given a prompt. Compatible with the OpenAI Images API. Automatically routes to the best available provider. Image model availability differs by deployment: the self-hosted gateway serves this endpoint with any image-output model you configure, and `GET /v1/models` lists what is currently available on the instance you are calling. With `stream=true`, the response is a Server-Sent Events stream of partial and completed image events for `gpt-image-*` models; any other model rejects the streaming ask with a 400.
Self-hosting? Replace https://api.yolorouter.com with your own instance, which defaults to http://localhost:8080.
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.