anonrouterdocs

Image and speech generation

Generate images over the ticketed relay and synthesize speech through the router.

Beyond text, AnonRouter can generate images and synthesize speech from media models in the catalog. Both features are gated by the deployment operator, so confirm availability before you build on them.

Check availability first

GET /v1/capabilities reports whether image generation is enabled (image_generation.enabled). Image and speech models also appear in GET /v1/models with model_type of image or tts.

Image generation

Image generation uses the same private ticket flow as chat, so the prompt and the generated image travel over the relay and never reach the control plane. Issue a ticket with operation: "image", then post the prompt with the ticket. The ticket binds the model, size, and response format, and the request must match.

# 1. Issue an image ticket.
TICKET=$(curl -s "$ANONROUTER_BASE_URL/inference/tickets" \
  -H "Authorization: Bearer $ANONROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "stabilityai/venice-sd35",
    "operation": "image",
    "size": "1024x1024",
    "response_format": "b64_json"
  }' | jq -r .ticket)

# 2. Generate the image.
curl "$ANONROUTER_BASE_URL/images/generations" \
  -H "Content-Type: application/json" \
  -H "x-anonrouter-ticket: $TICKET" \
  -d '{
    "model": "stabilityai/venice-sd35",
    "prompt": "A watercolor fox in a misty forest",
    "size": "1024x1024",
    "response_format": "b64_json"
  }'

The response returns base64 image data:

{
  "created": 1782097200,
  "model": "stabilityai/venice-sd35",
  "data": [
    { "b64_json": "iVBORw0KGgo...", "mime_type": "image/png" }
  ]
}
  • size is WIDTHxHEIGHT, each dimension between 128 and 2048, default 1024x1024.
  • response_format is always b64_json. No hosted URL is returned.
  • Image models are billed at a flat price per image.

Speech

Speech synthesis is a direct authenticated call with your inference key rather than a ticketed relay request.

curl "$ANONROUTER_BASE_URL/audio/speech" \
  -H "Authorization: Bearer $ANONROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "venice/kokoro-text-to-speech",
    "input": "Hello from AnonRouter."
  }' \
  --output speech.mp3
  • input is the text to synthesize, up to 20,000 characters.
  • voice is an optional, provider-specific string.
  • response_format is mp3. The response body is raw audio with the matching content-type.
  • Speech is billed at a flat price per million input characters.

No video endpoint

Video generation is not part of the API. Only text, image, embedding, and speech models are callable.

On this page