Synrouter Docs
Synrouter documentation
Synrouter is an inference API gateway purpose-built for AI agents. It wraps OpenAI-compatible and Anthropic-compatible APIs, automatically optimizes token usage, and cuts agent API costs by up to 85% — all without changing your client code.
Start here
Quickstart
Make your first request with curl, the OpenAI SDK, or an Anthropic-compatible client.
Models
Fetch the current model list and choose a configured model ID for your workload.
Pricing & Usage
Per-token pricing for all models, cache savings details, and billing info.
API reference
Review public endpoints, authentication, request examples, and Synrouter response headers.
Agent clients
Configure Claude Code, Codex CLI, and other agent tools to use Synrouter.
How Synrouter works
Synrouter sits between your agent client and upstream LLM providers. Every request passes through three optimization layers before reaching the model:
- Cache injection — Synrouter automatically inserts
cache_controlbreakpoints at the system message, tool definitions, and key positions in message history. This achieves 85-95% cache hit rates for coding agents, turning most input tokens into cheap cache reads. - Tool result trimming — Large tool outputs in conversation history are intelligently truncated. Synrouter keeps the head and tail, removes redundant middle content, and reduces input tokens before they reach the upstream model.
- Session fingerprinting — Synrouter groups consecutive turns into sessions, enabling cross-request cache persistence. The same system prompt and tool set across hundreds of turns means near-zero input cost after the first request.
Base URLs
Use https://synrouter.ai/api/v1 for OpenAI-compatible clients (Chat Completions API) and https://synrouter.ai/api/anthropic for Anthropic-compatible clients (Messages API).
Most agent tools only need a base URL change and an sk-sr-* API key. No SDK modifications, no code changes.
First request
bash
1curl https://synrouter.ai/api/v1/chat/completions \
2 -H "Authorization: Bearer sk-sr-..." \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "deepseek/deepseek-v4-flash",
6 "messages": [
7 { "role": "user", "content": "Say hello from Synrouter." }
8 ]
9 }'