Gateway overview#
The gateway is a server you run between your apps and model providers such as OpenAI, Anthropic and Google, with a dashboard to manage who calls which model and what it costs.
An app keeps its client and changes three values: the base URL, the API key and the model ID.
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'http://127.0.0.1:4000/v1', // the gateway, in place of the provider
apiKey: process.env['TOKEDEX_API_KEY'], // a gateway API key, in place of the provider's
});
const completion = await client.chat.completions.create({
model: 'openai/gpt-6-luna', // a model the key can call, from any connected provider
messages: [{ role: 'user', content: 'Reply with exactly the word "hello".' }],
});
console.log(completion.choices[0]?.message.content);helloThe same client calls models from other providers too, such as anthropic/claude-haiku-5.5 from Anthropic. The gateway serves OpenAI Chat Completions, OpenAI Responses, Anthropic Messages and Gemini GenerateContent, so the OpenAI SDK, the Anthropic SDK, curl and coding agents such as Claude Code and Codex all connect the same way.
Gateway features#
- One place for provider keys. Your apps never hold a provider's key. See Provider credentials.
- A key for each app or person, limited to the models it needs, so a leaked key is revoked without stopping anything else. See API keys.
- Budgets that refuse requests once a key, a person, a workspace or a model has spent its limit. See Budgets.
- Routing, with routers that choose among several models and fall back when one fails. See Routers and fallback.
- A trace of every request, with its tokens, cost, latency and the provider that answered. See Find and inspect a request.
Paths by role#
Everyone starts with the Gateway quickstart: the gateway on your machine and a first request in a few minutes. Connect one provider and send that request before you invite anyone: the Quick start card says why a request fails and what one costs, so you find a provider problem before others depend on the gateway. Then follow the path for your job.
- You call models from an app or a coding agent. Connect your app, Connect a coding agent, Find a model, then Errors, limits and request IDs. Look up endpoints, headers and request fields in the API reference.
- You manage access and spend in the dashboard. People and workspaces, Provider credentials, API keys, Budgets, then Spend and usage. To do the same from a terminal or a script, use the CLI.
- You run the gateway for others. Deploy to production, HTTPS and reverse proxies, Single sign-on, then Backup and restore. Once people have accounts, keep the master key for recovery only, since it has full access.