
# 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.

```ts
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);
```

```text
hello
```

The 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](/gateway/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](/gateway/api-keys).
- **Budgets** that refuse requests once a key, a person, a workspace or a model has spent its limit. See [Budgets](/gateway/budgets).
- **Routing,** with routers that choose among several models and fall back when one fails. See [Routers and fallback](/gateway/router).
- **A trace of every request,** with its tokens, cost, latency and the provider that answered. See [Find and inspect a request](/gateway/requests-and-sessions).

## Paths by role

Everyone starts with the [Gateway quickstart](/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](/gateway/connect-your-app), [Connect a coding agent](/gateway/coding-agents), [Find a model](/gateway/models), then [Errors, limits and request IDs](/gateway/errors-and-limits). Look up endpoints, headers and request fields in the [API reference](/gateway/api-reference).
- **You manage access and spend in the dashboard.** [People and workspaces](/gateway/people-and-workspaces), [Provider credentials](/gateway/provider-credentials), [API keys](/gateway/api-keys), [Budgets](/gateway/budgets), then [Spend and usage](/gateway/spend-and-usage). To do the same from a terminal or a script, use the [CLI](/cli).
- **You run the gateway for others.** [Deploy to production](/gateway/deploy), [HTTPS and reverse proxies](/gateway/https), [Single sign-on](/gateway/single-sign-on), then [Backup and restore](/gateway/backup-restore). Once people have accounts, keep the master key for recovery only, since it has full access.
