# Inferris API: plug your agent in

Inferris serves open models (today: `glm-5.3`) behind OpenAI- and Anthropic-compatible endpoints.
Point your agent at the base URL, give it a key, pick the model. Nothing else changes.

Human-readable version: https://inferris.ai/developers

## The settings

| Setting                       | Value                                                                                 |
| ----------------------------- | ------------------------------------------------------------------------------------- |
| OpenAI-compatible base URL    | `https://api.inferris.ai/v1`                                                          |
| Anthropic-compatible base URL | `https://api.inferris.ai` (clients add `/v1/messages`)                                |
| Authentication                | `Authorization: Bearer $INFERRIS_API_KEY` (on `/v1/messages`, `x-api-key` also works) |
| Model ID                      | `glm-5.3` (`GET /v1/models` with your key lists every model it can call)              |
| Context window                | Not published yet                                                                     |
| Max output tokens             | Not published yet                                                                     |

`https://inferris.ai/v1` is the same gateway as `https://api.inferris.ai/v1`.

Get a key: sign in at https://inferris.ai and open API keys (https://inferris.ai/keys).
Keep it in an environment variable; anyone with the key can spend your balance.

```
export INFERRIS_API_KEY="sk-..."
```

## Endpoints

| Endpoint                    | API shape                                              | Used by                                      |
| --------------------------- | ------------------------------------------------------ | -------------------------------------------- |
| `POST /v1/chat/completions` | OpenAI Chat Completions (stream with `"stream": true`) | OpenAI SDKs, OpenCode, Cline, Continue, curl |
| `POST /v1/responses`        | OpenAI Responses                                       | Codex CLI                                    |
| `POST /v1/messages`         | Anthropic Messages                                     | Claude Code, Anthropic SDKs                  |
| `GET /v1/models`            | Models your key can call                               | Any client                                   |

## Connect your agent

### Claude Code

Uses the Anthropic Messages endpoint. Add these to your shell profile, then run `claude`.

```
export ANTHROPIC_BASE_URL="https://api.inferris.ai"
export ANTHROPIC_AUTH_TOKEN="$INFERRIS_API_KEY"
export ANTHROPIC_MODEL="glm-5.3"
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.3"
export ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.3"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-5.3"
```

### Codex CLI

Uses the OpenAI Responses endpoint. Add to `~/.codex/config.toml` and export `INFERRIS_API_KEY`.

```
model = "glm-5.3"
model_provider = "inferris"

[model_providers.inferris]
name = "Inferris"
base_url = "https://api.inferris.ai/v1"
wire_api = "responses"
env_key = "INFERRIS_API_KEY"
```

### OpenCode

Uses the OpenAI Chat Completions endpoint. Add a provider to `opencode.json` (project) or
`~/.config/opencode/opencode.json`. Format from the OpenCode documentation; not yet run end to end
against Inferris.

```
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "inferris": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Inferris",
      "options": {
        "baseURL": "https://api.inferris.ai/v1",
        "apiKey": "{env:INFERRIS_API_KEY}"
      },
      "models": {
        "glm-5.3": {
          "name": "glm-5.3"
        }
      }
    }
  }
}
```

### Cline, Roo Code, Continue and other OpenAI-compatible tools

Choose the "OpenAI Compatible" provider (the name varies by tool) and fill in three fields. Field
names differ between tools; we have not tested each tool individually.

```
Base URL:  https://api.inferris.ai/v1
API key:   <your Inferris key>
Model ID:  glm-5.3
```

## Call it from code

### curl (OpenAI)

```
curl https://api.inferris.ai/v1/chat/completions \
  -H "Authorization: Bearer $INFERRIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'
```

### Python (OpenAI)

```
# pip install openai
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.inferris.ai/v1",
    api_key=os.environ["INFERRIS_API_KEY"],
)

reply = client.chat.completions.create(
    model="glm-5.3",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(reply.choices[0].message.content)
```

### Node.js (OpenAI)

```
// npm install openai
import OpenAI from 'openai'

const client = new OpenAI({
  baseURL: 'https://api.inferris.ai/v1',
  apiKey: process.env.INFERRIS_API_KEY,
})

const reply = await client.chat.completions.create({
  model: 'glm-5.3',
  messages: [{ role: 'user', content: 'Say hello in one sentence.' }],
})
console.log(reply.choices[0].message.content)
```

### curl (Anthropic)

```
curl https://api.inferris.ai/v1/messages \
  -H "Authorization: Bearer $INFERRIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3",
    "max_tokens": 512,
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'
```

### Python (Anthropic)

```
# pip install anthropic
import os
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.inferris.ai",
    api_key=os.environ["INFERRIS_API_KEY"],
)

reply = client.messages.create(
    model="glm-5.3",
    max_tokens=512,
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(reply.content[0].text)
```

### Node.js (Anthropic)

```
// npm install @anthropic-ai/sdk
import Anthropic from '@anthropic-ai/sdk'

const client = new Anthropic({
  baseURL: 'https://api.inferris.ai',
  apiKey: process.env.INFERRIS_API_KEY,
})

const reply = await client.messages.create({
  model: 'glm-5.3',
  max_tokens: 512,
  messages: [{ role: 'user', content: 'Say hello in one sentence.' }],
})
console.log(reply.content[0].type === 'text' ? reply.content[0].text : '')
```

## Errors and retries

Errors come back as JSON with `error.message` and `error.type`. Branch on the HTTP status code;
some messages are still in Chinese.

| Status          | Meaning                                                                                      | Retry? | What to do                                                                                          |
| --------------- | -------------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------- |
| 400             | The request body is invalid.                                                                 | No     | Fix the request. The same body will fail again.                                                     |
| 401             | Key missing, wrong, disabled or expired.                                                     | No     | Check the key.                                                                                      |
| 403             | Balance or key quota used up (`insufficient_user_quota`), or the key may not use this model. | No     | Top up in Wallet or raise the key limit.                                                            |
| 429             | Rate limit reached, or the model is at capacity.                                             | Yes    | Wait for `Retry-After` (seconds) when present; otherwise back off 1, 2, 4 … up to 30 s with jitter. |
| 503             | No capacity is available for this model right now.                                           | Yes    | Retry with backoff; check https://inferris.ai/status if it lasts.                                   |
| 500 / 502 / 504 | The gateway or the model backend failed or timed out.                                        | Yes    | Retry with backoff.                                                                                 |

Live rate limits: https://inferris.ai/docs/rate-limits

## More

- Agent setup instructions: https://inferris.ai/agents.md
- Site index for language models: https://inferris.ai/llms.txt
- Models and prices: https://inferris.ai/pricing
- Status: https://inferris.ai/status
