Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.axiomancer.io/llms.txt

Use this file to discover all available pages before exploring further.

The chat-completions endpoint is a drop-in replacement for https://api.openai.com/v1/chat/completions. The wire format is identical; the routing, logging, and cost accounting happens server-side.

Endpoint

POST https://proxy.routeshift.io/v1/chat/completions
Authorization: Bearer sk-proxy-…
Content-Type: application/json

Request body

Standard OpenAI shape — model, messages, temperature, max_tokens, stream, tools, etc. RouteShift adds two optional extension fields under metadata:
FieldTypeEffect
metadata.route_hintstringOverrides the rule chain and pins this request to the named alias.
metadata.session_idstringForces session stitching to use this ID instead of inferring one. Useful when you already have a conversation ID upstream.
Anything else under metadata is preserved into request_logs.metadata for downstream analytics.

Streaming

Set "stream": true to receive Server-Sent Events. The format matches OpenAI’s data: { ... }\n\n chunks. RouteShift relays chunks as they arrive from upstream — no extra buffering — and writes the request log when the stream closes.

Examples

curl https://proxy.routeshift.io/v1/chat/completions \
  -H "Authorization: Bearer sk-proxy-…" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {"role": "system", "content": "You are concise."},
      {"role": "user", "content": "What is 2 + 2?"}
    ]
  }'

Response headers

Beyond the standard OpenAI response, RouteShift adds:
  • X-RouteShift-Resolved-Model — the upstream model that actually served the request (after aliases and rule chain).
  • X-RouteShift-Provider — provider name.
  • X-RouteShift-Cost-Microcents — actual cost in microcents.
  • X-RouteShift-Session-Id — session ID this request was stitched into.
These mirror the values written to request_logs so you can correlate client-side observability with the dashboard.