Skip to content
API documentation

Use the protocol your application expects.

Use your RouteMesh API key as a Bearer token and pass an explicit model ID. The gateway returns a Generation ID in every response.

Chat Completions quickstart

Use your RouteMesh API key as a Bearer token and pass an explicit model ID. The gateway returns a Generation ID in every response.

curl
curl https://api.routemesh.ai/v1/chat/completions \
  -H "Authorization: Bearer $ROUTEMESH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-6-astra",
    "stream": true,
    "messages": [{"role": "user", "content": "Hello RouteMesh"}],
    "provider": {"zdr": true, "allow_fallbacks": true}
  }'

Gateway endpoints

POST/v1/chat/completions

OpenAI-compatible completions and SSE.

POST/v1/responses

OpenAI Responses input items and event streams; built-in image_generation tools are currently rejected.

POST/v1/images/generations

OpenAI image generation and partial-image events.

POST/v1/images/edits

JSON image references or multipart image editing with an OpenAI-compatible model.

POST/v1/images/variations

Multipart image variations for supported models.

POST/v1/messages

Anthropic-compatible Messages API.

POST/v1/embeddings

OpenAI-compatible vector embeddings.

GET/v1/models

Public model catalog.

GET/v1/generations/{id}

Trace provider, usage, latency, and cost.

Provider policy

Use provider.order, only, ignore, allow_fallbacks, max_price, data_collection, and zdr to constrain the endpoint set. Fallback never changes the selected model.

Error contract

Errors return a structured object with code, message, type, and request_id. Invalid keys return 401, insufficient credits return 402, rate limits return 429, and unavailable endpoints return 503.