Start hereTutorial
Your first request
A copy-paste request, what each field means, and what comes back.
By the end: You can call any text model and read the response and usage figures.
This page takes one request apart, field by field, and shows what comes back.
Request
curl https://www.ary4n73.com/v1/chat/completions \
-H "Authorization: Bearer $ROUTEFORGE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [
{ "role": "system", "content": "Answer briefly." },
{ "role": "user", "content": "What is an API gateway?" }
],
"max_tokens": 200
}'Fields that matter
model— required. Must be an ID fromGET /v1/models.messages— the conversation, oldest first.systemsets behaviour.max_tokens— a ceiling on output. Set it: it bounds a runaway response and its cost.stream—trueto receive server-sent events instead of one JSON body.
Reading the response
Response
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "claude-sonnet-4-6",
"choices": [
{ "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" }
],
"usage": { "prompt_tokens": 28, "completion_tokens": 54, "total_tokens": 82 }
}The usage block is what you are billed on. Input tokens are the prompt, output tokens are the reply. The usage fields reference explains the variations between providers.
Using the official SDKs
OpenAI SDK
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://www.ary4n73.com/v1',
apiKey: process.env.ROUTEFORGE_API_KEY,
});
const res = await client.chat.completions.create({
model: 'claude-sonnet-4-6',
messages: [{ role: 'user', content: 'Hello' }],
});
console.log(res.choices[0].message.content);The official OpenAI SDK can call Anthropic and Gemini models through this endpoint, because the gateway accepts the OpenAI request shape and returns the OpenAI response shape.