# Any OpenAI-compatible API

> Point Claude Code's roles at OpenAI, DeepSeek, Groq, Together, Fireworks or any other OpenAI-compatible API with one endpoint table, use the OpenAI Responses API, and override the wire format per model.
>
> Point a profile at any API that serves chat completions, with one endpoint table and a key from an environment variable. You need that provider's API key.

An `openai-compat` endpoint is a base URL and a key. The gateway translates Claude Code's Anthropic-format requests into chat completions and streams the answer back in Anthropic format. The steps use DeepSeek; swap in any provider from the table below.

1. Export your key

   ```sh
   export DEEPSEEK_API_KEY="<your-deepseek-key>"
   ```

   Export it before the daemon starts. A key exported later needs `sc daemon stop` and a new launch ([why](/docs/gateways#keys-from-the-environment)).

2. Add the endpoint and a profile to `~/.superclaude/config.toml`

   ```toml
   [endpoints.deepseek]
   url = "https://api.deepseek.com"
   format = "openai-compat"
   key_csv = "${DEEPSEEK_API_KEY}"

   [profiles.deepseek]
   opus = { slug = "deepseek/<model-id>" }
   ```

   `url` is everything before `/v1/chat/completions`, because the gateway appends that path. `auth` defaults to `bearer` for this format.

3. Check the routing

   ```sh
   sc profiles deepseek
   ```

   It prints a row for each of opus, sonnet and haiku with the model that role goes to; a role the profile does not set is marked `↑` as inherited (`^` on a terminal without Unicode).

4. Launch with the profile

   ```sh
   sc -u deepseek <project> <agent>
   ```

This profile maps only `opus`, so `sonnet` and `haiku` inherit it and every request goes to DeepSeek. To split the roles, see [Profiles](/docs/custom-profiles#write-your-own-profile).

| Provider | `url` |
|---|---|
| OpenAI | `https://api.openai.com` |
| DeepSeek | `https://api.deepseek.com` |
| Groq | `https://api.groq.com/openai` |
| Together | `https://api.together.xyz` |
| Fireworks | `https://api.fireworks.ai/inference` |

[OpenCode](/docs/provider-opencode), [OpenRouter](/docs/provider-openrouter), [Grok](/docs/provider-grok) and [local servers](/docs/provider-local) use this format too and have their own pages.

**What the provider must support**

- Streaming `POST <url>/v1/chat/completions`. A provider whose path uses another version segment, such as `/v4/chat/completions`, cannot be reached, because the gateway always appends `/v1/chat/completions`.
- Tool calls, because Claude Code sends its tools as function definitions.

A `/v1/models` route is optional; the [launch check](/docs/gateways#the-launch-check) passes a provider without one.

The gateway translates the system prompt, messages, tools, tool results and images. A model that streams its reasoning as `reasoning_content`, or as `reasoning`, shows it in Claude Code as a thinking block, and the gateway sends that reasoning back on later turns.

Providers share no reasoning parameter, so the gateway picks one from the model id: DeepSeek, GLM, Kimi, Qwen, MiniMax and MiMo ids each get their own field, and any other id gets none ([the table](/docs/custom-profiles#write-your-own-profile)).


**Rotate several OpenAI keys**

The `config.toml` that `sc` writes on first run already has an `[endpoints.openai]` table with `type = "pool"` that reads `${OPENAI_KEYS}`. Set that variable to a comma-separated list of keys to use it; the gateway rotates them ([key pools](/docs/gateways#key-pools-and-retries)).


**The OpenAI Responses API**

```toml
[endpoints.openai-responses]
url = "https://api.openai.com"
format = "openai-responses"
key_csv = "${OPENAI_API_KEY}"

[profiles.gpt]
opus = { slug = "openai-responses/<model-id>", reasoning = { effort = "high" } }
```

This format posts to `<url>/v1/responses`. The gateway sends the effort as `reasoning.effort` (`low`, `medium` or `high`; `max` becomes `high`) and asks for a reasoning summary, which Claude Code shows as a thinking block. OpenAI's reasoning models reject a custom `temperature` or `top_p`, so leave sampling off rows that use them. [Codex](/docs/codex-setup) speaks the same API on a ChatGPT subscription.


**Per-model wire overrides**

A provider can serve some models over chat completions and others over the Anthropic wire behind one URL. Set `format` and `auth` on the row that differs. The `research` profile in the config `sc` writes on first run does this for OpenCode's `qwen3.7-max`:

```toml
[profiles.research]
opus   = { slug = "opencode/qwen3.7-max", format = "anthropic-messages", auth = "x-api-key", reasoning = { effort = "high" } }
sonnet = { slug = "opencode/deepseek-v4-pro", temperature = 0.7, params = { top_k = 40, repetition_penalty = 1.05 } }
haiku  = { slug = "opencode/deepseek-v4-flash" }
```

A row's `format` beats the endpoint's, and the endpoint's beats the default, `openai-compat`. `auth` resolves the same way, falling back to the format's default: `x-api-key` for `anthropic-messages`, `bearer` for the two OpenAI formats.
