Quickstart
This guide takes you from a fresh account to your first billed request.
1. Create an account and API key
Section titled “1. Create an account and API key”- Create an account at oxyrouter.in/register.
- Open API keys in the dashboard and create a key.
- Copy the secret immediately. It starts with
oxy_sk_and is shown only once.
The key inherits all three scopes by default: inference:read,
inference:write, and usage:read. See Authentication for
scope details and least-privilege guidance.
2. Set the key in your environment
Section titled “2. Set the key in your environment”export OXYROUTER_API_KEY="oxy_sk_..."All inference requests use this header:
Authorization: Bearer oxy_sk_...3. List available models
Section titled “3. List available models”curl https://api.oxyrouter.in/v1/models \ -H "Authorization: Bearer $OXYROUTER_API_KEY"{ "object": "list", "data": [ { "id": "gpt-4o-mini", "object": "model", "created": 1735689600, "owned_by": "oxyrouter" } ]}The model IDs returned here are the only IDs you should send. OxyRouter keeps upstream provider routing private and resolves it internally.
4. Send a chat completion
Section titled “4. Send a chat completion”curl https://api.oxyrouter.in/v1/chat/completions \ -H "Authorization: Bearer $OXYROUTER_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o-mini", "messages": [ {"role": "user", "content": "Say hello in one short sentence."} ] }'import osfrom openai import OpenAI
client = OpenAI( api_key=os.environ["OXYROUTER_API_KEY"], base_url="https://api.oxyrouter.in/v1",)
completion = client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "Say hello in one short sentence."}],)
print(completion.choices[0].message.content)import OpenAI from 'openai'
const client = new OpenAI({ apiKey: process.env.OXYROUTER_API_KEY, baseURL: 'https://api.oxyrouter.in/v1',})
const completion = await client.chat.completions.create({ model: 'gpt-4o-mini', messages: [{ role: 'user', content: 'Say hello in one short sentence.' }],})
console.log(completion.choices[0].message.content)A successful response looks like this:
{ "id": "chatcmpl-abc123", "object": "chat.completion", "created": 1735689600, "model": "gpt-4o-mini", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help today?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 14, "completion_tokens": 8, "total_tokens": 22 }}The model field always echoes the public OxyRouter model ID you requested.
5. Stream tokens
Section titled “5. Stream tokens”Set stream to true to receive server-sent events:
curl https://api.oxyrouter.in/v1/chat/completions \ -H "Authorization: Bearer $OXYROUTER_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Count to five."}], "stream": true }'data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"One"}}]}
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":", two"}}]}
data: [DONE]6. Check your spend
Section titled “6. Check your spend”Every request is metered from provider-reported token usage and charged to your prepaid INR wallet. Open Usage and Billing & wallet in the dashboard to review spend, top up, and set daily or monthly caps.