> ## Documentation Index
> Fetch the complete documentation index at: https://docs.infyrence.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gateway overview

> A unified, OpenAI-compatible API for 200+ models.

Infyrence is a unified, OpenAI-compatible inference gateway. Call 200+ models from every major provider through a single endpoint and one API key, with automatic failover and edge-fast routing.

<Info>
  The gateway is a hosted commercial API. It is a separate product from the open-source `infy` framework, documented under [Framework](/introduction).
</Info>

## Why the gateway

<CardGroup cols={2}>
  <Card title="One endpoint, one key" icon="plug">
    Reach OpenAI, Anthropic, Google, and more through a single base URL and one Infyrence API key. No per-provider SDKs or keys to juggle.
  </Card>

  <Card title="200+ models" icon="layer-group">
    Switch models by changing the `model` field. Call `GET /v1/models` for the live list available to your account.
  </Card>

  <Card title="Automatic failover" icon="shuffle">
    When an upstream provider is rate limited or briefly unavailable, the gateway retries and routes around it so your request still completes.
  </Card>

  <Card title="Edge-fast routing" icon="bolt">
    Requests are routed at the edge for low-latency delivery to the nearest healthy provider.
  </Card>
</CardGroup>

## OpenAI compatibility

The API mirrors the OpenAI Chat Completions API. To migrate an existing integration, point the base URL at the gateway and set `model` to any id from `GET /v1/models`. No other code changes are required.

```text Base URL theme={null}
https://api.infyrence.com/v1
```

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.infyrence.com/v1",  # change only this line
      api_key="sk-...",
  )

  resp = client.chat.completions.create(
      model="claude-sonnet-5",
      messages=[{"role": "user", "content": "Explain quantum entanglement in one sentence."}],
  )
  print(resp.choices[0].message.content)
  ```

  ```javascript JavaScript theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    baseURL: "https://api.infyrence.com/v1", // change only this line
    apiKey: "sk-...",
  });

  const resp = await client.chat.completions.create({
    model: "claude-sonnet-5",
    messages: [{ role: "user", content: "Explain quantum entanglement in one sentence." }],
  });
  console.log(resp.choices[0].message.content);
  ```

  ```bash curl theme={null}
  curl https://api.infyrence.com/v1/chat/completions \
    -H "Authorization: Bearer sk-..." \
    -H "Content-Type: application/json" \
    -d '{
      "model": "claude-sonnet-5",
      "messages": [
        {"role": "user", "content": "Explain quantum entanglement in one sentence."}
      ]
    }'
  ```
</CodeGroup>

<Tip>
  Because the API is OpenAI-compatible, most existing OpenAI SDKs, tools, and libraries work by only swapping the base URL and key.
</Tip>

## Authentication

Authenticate every request with your Infyrence API key as a Bearer token.

```text theme={null}
Authorization: Bearer sk-...
```

Create and manage keys in your [dashboard](https://www.infyrence.com/dashboard/api-keys). A missing or invalid key returns `401` with an `authentication_error`.

## Models

The `model` field accepts any id returned by `GET /v1/models`. Example ids include `claude-sonnet-5`, `gpt-5.5`, and `gemini-3.1-pro`. Always call the endpoint for the current list, since availability changes over time.

```bash theme={null}
curl https://api.infyrence.com/v1/models \
  -H "Authorization: Bearer sk-..."
```

Each entry reports its `id`, `owned_by`, and `capabilities` (`chat`, `completions`, `embeddings`). See [Models](/gateway/models) for details.

## Billing

Billing is usage-based, per model. You pay for input and output tokens at each model's published per-million-token rate. Every completion response includes a `usage` object with `prompt_tokens`, `completion_tokens`, and `total_tokens`. See the [pricing page](https://www.infyrence.com/pricing) for current rates.

If your account has no remaining balance for platform models, requests return `402` with an `insufficient_credits` error. Add funds, or use your own provider key (BYOK).

### Bring your own key (BYOK)

Instead of drawing on your platform balance, you can supply your own provider key and pay that provider directly. Supported BYOK providers include `openai`, `anthropic`, `groq`, `xai`, `deepseek`, `mistral`, `together`, `cerebras`, `alibaba`, `nvidia`, and `openrouter`. You keep the same single Infyrence endpoint, key management, and OpenAI-compatible surface. See [Pricing and usage](/gateway/pricing-and-usage) for how BYOK is billed.

## What you get

<Steps>
  <Step title="Point your SDK at the gateway">
    Set the base URL to `https://api.infyrence.com/v1` and use your Infyrence API key.
  </Step>

  <Step title="Pick a model">
    Set `model` to any id from `GET /v1/models`.
  </Step>

  <Step title="Send requests">
    Call `POST /v1/chat/completions`. Set `stream: true` for incremental Server-Sent Events.
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/gateway/quickstart">
    Send your first request in a few minutes.
  </Card>

  <Card title="Models" icon="layer-group" href="/gateway/models">
    Browse available models and their capabilities.
  </Card>

  <Card title="Pricing and usage" icon="credit-card" href="/gateway/pricing-and-usage">
    Understand per-model rates, usage, and BYOK.
  </Card>

  <Card title="API reference" icon="code" href="/api-reference/create-chat-completion">
    Explore every endpoint, field, and error type.
  </Card>
</CardGroup>
