SDKs and clients
Choose the compatible protocol and do not mix Anthropic-scoped and OpenAI-scoped keys in one provider configuration.
SDK
from openai import OpenAI
client = OpenAI(
api_key="gyw-sk-YOUR_KEY",
base_url="https://api.gateyourway.com/v1",
)import anthropic
client = anthropic.Anthropic(
api_key="gyw-sk-YOUR_KEY",
base_url="https://api.gateyourway.com",
)OpenAI Base URL: https://api.gateyourway.com/v1/cursor
API key: gyw-sk-YOUR_KEY
Custom model: gyw-opus-5# ~/.codex/config.toml
[model_providers.gateyourway]
name = "GateYourWay"
base_url = "https://api.gateyourway.com/v1"
# env_key is the environment variable name, not the API key itself.
env_key = "GATEYOURWAY_API_KEY"
wire_api = "responses"
# ~/.codex/gateyourway.config.toml
model_provider = "gateyourway"
model = "gpt-5.6-luna"Compatibility rules
| Client | Protocol / base URL | Note |
|---|---|---|
| Claude Code | https://api.gateyourway.com | ANTHROPIC_API_KEY + ANTHROPIC_BASE_URL |
| OpenCode / Claude | https://api.gateyourway.com/v1 | @ai-sdk/anthropic |
| OpenCode / GPT, Grok | https://api.gateyourway.com/v1 | @ai-sdk/openai-compatible |
| Cursor / Opus 5 | https://api.gateyourway.com/v1/cursor | gyw-opus-5 |
| Codex CLI | https://api.gateyourway.com/v1 | wire_api = "responses" |
| CC Switch | Custom OpenAI or Anthropic | Match the protocol to the key family. |
| Pi | ~/.pi/agent/models.json | openai-responses, openai-completions, or anthropic-messages |
| oh-my-pi | ~/.omp/agent/models.yml | Separate YAML schema; do not reuse the Pi config. |
| Roo Code | OpenAI Compatible or Anthropic | Set a custom base URL and the exact model ID. |
| Cline | OpenAI Compatible or Anthropic | Verify the connection before starting an agent task. |
Cursor + Claude Opus 5
Cursor Agent/Chat uses a dedicated OpenAI-compatible bridge. Do not use the normal Anthropic model ID here.
| Setting | Value |
|---|---|
| Mode | Custom OpenAI API |
| OpenAI Base URL | https://api.gateyourway.com/v1/cursor |
| Model | gyw-opus-5 |
| Key group | Claude Arctic |
| Context profile | 1,000,000 |
| Default maximum output | 128,000 |
| Reasoning | adaptive, default max |
Bridge smoke check
curl https://api.gateyourway.com/v1/cursor/models \
-H "Authorization: Bearer gyw-sk-YOUR_CLAUDE_ARCTIC_KEY"The response should contain only gyw-opus-5. Then verify a real Agent/Chat turn, a tool call, and continuation after the tool result.
OpenCode + Claude Opus 5
OpenCode uses the native Anthropic Messages transport through @ai-sdk/anthropic. Opus 5 requires a Claude Arctic key.
{
"$schema": "https://opencode.ai/config.json",
"model": "gateyourway/claude-opus-5",
"small_model": "gateyourway/claude-opus-5",
"attachment": {
"image": {
"auto_resize": true,
"max_width": 2000,
"max_height": 2000,
"max_base64_bytes": 5242880
}
},
"compaction": {
"auto": true,
"prune": true,
"reserved": 128000
},
"provider": {
"gateyourway": {
"npm": "@ai-sdk/anthropic",
"name": "GateYourWay",
"options": {
"baseURL": "https://api.gateyourway.com/v1",
"apiKey": "{env:GATEYOURWAY_API_KEY}",
"timeout": 1800000,
"chunkTimeout": 120000
},
"models": {
"claude-opus-5": {
"name": "Claude Opus 5 - 1M / 128K",
"attachment": true,
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"limit": {
"context": 1000000,
"output": 128000
}
}
}
}
}
}baseURLalready includes/v1; do not append/messages.small_modelis pinned to Opus 5 so background operations do not switch to an unsupported model.modalities.inputdeclares text + image support; without it OpenCode may drop the image part.timeout/chunkTimeoutallow long reasoning and tool loops to complete.
API smoke check outside the client
curl https://api.gateyourway.com/v1/messages \
-H "x-api-key: $GATEYOURWAY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5",
"max_tokens": 256,
"messages": [{"role":"user","content":"Reply with exactly: GateYourWay OpenCode OK"}]
}'After starting OpenCode, verify opencode debug config, two consecutive turns, tool-result continuation, and vision with a real attachment rather than a text file path.
Current configuration formats
These paths and fields follow the latest official client guides. Pi and oh-my-pi configuration formats are not interchangeable.
| Client | Configuration target | Critical rule |
|---|---|---|
| Codex CLI | ~/.codex/config.toml + ~/.codex/gateyourway.config.toml | env_key contains the name GATEYOURWAY_API_KEY, not the secret. Do not use [profiles.gateyourway]. |
| Claude Code | Current shell environment | ANTHROPIC_API_KEY + ANTHROPIC_BASE_URL; base URL without /v1 |
| CC Switch | App-specific Custom provider | Use env JSON for Claude Code; keep the new separate profile file for Codex. |
| Pi | ~/.pi/agent/models.json | JSON provider; Pi reloads the file automatically. |
| oh-my-pi | ~/.omp/agent/models.yml | YAML provider with an explicit api. |
| Roo Code | Settings → API Provider | OpenAI Compatible for GPT/Grok; Anthropic for Claude. |
| Cline | API Provider settings | Set the custom base URL, key, and model ID, then run Verify. |
Official sources: Codex CLI, Claude Code, CC Switch, Pi, oh-my-pi, Roo Code, Cline.
Troubleshooting
| Symptom | Check |
|---|---|
| Codex: Missing environment variable | env_key must be GATEYOURWAY_API_KEY. Export the actual key in that environment variable. |
| Codex: legacy profile error | Remove profile = "gateyourway" and [profiles.gateyourway]; use a separate gateyourway.config.toml. |
| Cursor 404 / model missing | Check /v1/cursor and model ID gyw-opus-5. |
| OpenCode 404 / provider error | Use /v1, claude-opus-5, and @ai-sdk/anthropic. |
| Image was not received | Check attachment: true, image modality, and a real attachment preview. |
| First turn works, second stalls | Save the time, client version, request ID, and last six key characters; never send the full key. |
Automatic setup
The assistant generates separate current configurations for Codex CLI, Claude Code, CC Switch, Pi, oh-my-pi, Roo Code, and Cline. Cursor and OpenCode keep their existing specialized instructions.
Build a client configuration
The key is inserted only into the local browser result and is not saved to storage.