Skills Quick Start
Add a built-in skill to a chat completion in 30 seconds
Pass a skills array alongside your normal chat completion request. TheRouter injects the skill's tools, executes them server-side when the model calls them, and returns a final response with annotations.
Send a request
curl
curl https://api.therouter.ai/v1/chat/completions \
-H "Authorization: Bearer $THEROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4.5",
"messages": [{ "role": "user", "content": "Latest advances in quantum computing." }],
"skills": [{ "id": "web" }]
}'Response format
The response is a standard chat completion. When the web skill finds sources it adds url_citation annotations to the assistant message.
response.json
{
"choices": [{
"message": {
"role": "assistant",
"content": "Recent breakthroughs in quantum computing include ...",
"annotations": [
{
"type": "url_citation",
"url_citation": {
"url": "https://example.com/quantum-2026",
"title": "Quantum Computing Advances in 2026"
}
}
]
}
}]
}TypeScript SDK
TypeScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.therouter.ai/v1",
apiKey: process.env.THEROUTER_API_KEY,
});
const completion = await client.chat.completions.create({
model: "anthropic/claude-sonnet-4.5",
messages: [{ role: "user", content: "Latest advances in quantum computing." }],
skills: [{ id: "web" }],
} as never);
const message = completion.choices[0]?.message;
console.log(message?.content);
console.log(message?.annotations);Structured JSON outputs?
Try the
response-healing skill when you use response_format: json_schema. It auto-repairs malformed JSON before your parser sees it.