Synrouter Docs
Quickstart
Use Synrouter by changing your base URL and sending an sk-sr API key. The examples below use the OpenAI-compatible Chat Completions API first, then show the Anthropic-compatible Messages API.
1. Choose a base URL
For OpenAI-compatible SDKs, set the base URL to https://synrouter.ai/api/v1.
For Anthropic-compatible clients, set the base URL to https://synrouter.ai/api/anthropic.
2. Authenticate
Send your Synrouter API key in the Authorization header.
http
1Authorization: Bearer sk-sr-...
3. Make your 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": "system", "content": "You are a concise coding assistant." },
8 { "role": "user", "content": "Explain what an API gateway does in one sentence." }
9 ]
10 }'
OpenAI SDK examples
python
1from openai import OpenAI
2
3client = OpenAI(
4 base_url="https://synrouter.ai/api/v1",
5 api_key="sk-sr-...",
6)
7
8response = client.chat.completions.create(
9 model="deepseek/deepseek-v4-flash",
10 messages=[
11 {"role": "user", "content": "Write a tiny Python function that adds two numbers."}
12 ],
13)
14
15print(response.choices[0].message.content)
typescript
1import OpenAI from "openai";
2
3const client = new OpenAI({
4 baseURL: "https://synrouter.ai/api/v1",
5 apiKey: process.env.SYNROUTER_API_KEY,
6});
7
8const response = await client.chat.completions.create({
9 model: "deepseek/deepseek-v4-flash",
10 messages: [
11 { role: "user", content: "Write a short TypeScript debounce function." },
12 ],
13});
14
15console.log(response.choices[0]?.message?.content);
Anthropic-compatible request
bash
1curl https://synrouter.ai/api/anthropic/v1/messages \
2 -H "Authorization: Bearer sk-sr-..." \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "anthropic/claude-sonnet-4.6",
6 "max_tokens": 256,
7 "messages": [
8 { "role": "user", "content": "Summarize prompt caching for coding agents." }
9 ]
10 }'