# GateYourWay API AI Context Machine-readable integration notes for AI agents and coding assistants. Generated: 2026-08-15T09:13:56+00:00 Base URL: https://api.gateyourway.com Human documentation: https://api.gateyourway.com/docs OpenAPI schema: https://api.gateyourway.com/openapi.json # Site Information GateYourWay API is a branded AI API gateway for OpenAI-compatible and Anthropic-compatible model access. Users create `gyw-sk-...` API keys in the GateYourWay cabinet, fund balance, call public endpoints, and inspect usage/token/cost records in the cabinet. Do not expose or mention private routing, private credentials, internal pricing logic, hidden balances, or non-public plan names to end users. ## Public URLs - Human docs: `https://api.gateyourway.com/docs` - Cabinet: `https://api.gateyourway.com/cabinet/#/` - API keys: `https://api.gateyourway.com/cabinet/#/keys` - Models/pricing UI: `https://api.gateyourway.com/cabinet/#/models` - Usage ledger: `https://api.gateyourway.com/cabinet/#/usage` - Status: `https://api.gateyourway.com/status` - AI context: `https://api.gateyourway.com/llms-full.txt` ## Endpoint Coverage Supported now: - `GET https://api.gateyourway.com/v1/models`: public OpenAI-like model list with GateYourWay groups and public prices. - `GET https://api.gateyourway.com/v1/models/{model}`: one public model entry by model id. - `POST https://api.gateyourway.com/v1/chat/completions`: OpenAI-compatible chat completions. - `POST https://api.gateyourway.com/v1/responses`: OpenAI-compatible Responses API. - `POST https://api.gateyourway.com/v1/images/generations`: OpenAI-compatible image generation for `gpt-image-1.5`, `grok-image`, `gpt-image-2`, `gpt-image-2-1k`, `gpt-image-2-2k`, `gpt-image-2-4k`, and `gpt-image-2-4k-超分`. - `POST https://api.gateyourway.com/v1/messages`: Anthropic-compatible messages. - `GET https://api.gateyourway.com/v1/cursor/models`: Cursor-specific model list containing only `gyw-opus-5`. - `POST https://api.gateyourway.com/v1/cursor/chat/completions`: OpenAI-compatible Cursor bridge for `gyw-opus-5`. - `POST https://api.gateyourway.com/v1/cursor/responses`: OpenAI Responses-compatible Cursor bridge for `gyw-opus-5`. - `GET https://api.gateyourway.com/v1/models`: Anthropic-style model list when called with Anthropic headers. - `GET https://api.gateyourway.com/v1/me`: account/API-key identity and balance check. - Cabinet usage endpoints are available to signed-in cabinet users at `https://api.gateyourway.com/cabinet/#/usage`. Not supported right now: - Legacy text completions, embeddings, rerank, moderations, audio, realtime, videos, image edits, and Gemini-native endpoints. - Do not generate code that calls unsupported endpoints unless the user explicitly asks for a roadmap or stub. ## API Key Format - User-facing API keys start with `gyw-sk-`. - Raw keys are shown once when created. - Keys are scoped by provider family and public route group. If a key is not scoped for a model/family, the API returns a branded GateYourWay error. ## OpenAI-Compatible API Base URL for OpenAI-compatible clients: `https://api.gateyourway.com/v1` Endpoint: `POST https://api.gateyourway.com/v1/chat/completions` Responses endpoint: `POST https://api.gateyourway.com/v1/responses` Model list: `GET https://api.gateyourway.com/v1/models` Auth: `Authorization: Bearer gyw-sk-YOUR_KEY` Minimal request: ```bash curl https://api.gateyourway.com/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer gyw-sk-YOUR_KEY" \ -d '{ "model": "gpt-5.6-luna", "messages": [{"role":"user","content":"Hello from GateYourWay"}], "stream": true }' ``` Python SDK: ```python from openai import OpenAI client = OpenAI( api_key="gyw-sk-YOUR_KEY", base_url="https://api.gateyourway.com/v1", ) response = client.chat.completions.create( model="gpt-5.6-luna", messages=[{"role": "user", "content": "Hello"}], ) print(response.choices[0].message.content) ``` Image generation: ```python import base64 from openai import OpenAI client = OpenAI( api_key="gyw-sk-YOUR_KEY", base_url="https://api.gateyourway.com/v1", ) result = client.images.generate( model="gpt-image-2", prompt="A cinematic product photo of a silver watch", size="1024x1024", quality="low", ) with open("image.png", "wb") as image_file: image_file.write(base64.b64decode(result.data[0].b64_json)) ``` ## Anthropic-Compatible API Base URL for Anthropic-compatible clients: `https://api.gateyourway.com` Endpoint: `POST https://api.gateyourway.com/v1/messages` Auth: `x-api-key: gyw-sk-YOUR_KEY` Required version header: `anthropic-version: 2023-06-01` Minimal request: ```bash curl https://api.gateyourway.com/v1/messages \ -H "Content-Type: application/json" \ -H "x-api-key: gyw-sk-YOUR_KEY" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "claude-opus-5", "max_tokens": 1024, "messages": [{"role":"user","content":"Hello from GateYourWay"}], "stream": true }' ``` Python SDK: ```python import anthropic client = anthropic.Anthropic( api_key="gyw-sk-YOUR_KEY", base_url="https://api.gateyourway.com", ) message = client.messages.create( model="claude-opus-5", max_tokens=1024, messages=[{"role": "user", "content": "Hello"}], ) print(message.content) ``` ## Cursor Cursor must use the dedicated OpenAI-compatible bridge for Claude Opus 5. Create a GateYourWay key scoped to the Anthropic Arctic group, then configure: - OpenAI Base URL: `https://api.gateyourway.com/v1/cursor` - API key: `gyw-sk-YOUR_KEY` - Custom model: `gyw-opus-5` The bridge supports chat completions, Responses-style input, streaming, and function tool calls. It intentionally rejects every other model id. Cursor Tab completion does not use custom API keys; this configuration applies to Cursor chat and agent requests. ## Claude Code Claude Code can be pointed at GateYourWay through Anthropic-compatible environment variables. `ANTHROPIC_BASE_URL` must be the GateYourWay origin without `/v1` or `/v1/messages`. ```bash export ANTHROPIC_API_KEY="gyw-sk-YOUR_KEY" export ANTHROPIC_BASE_URL="https://api.gateyourway.com" claude --model claude-opus-5 ``` PowerShell: ```powershell $env:ANTHROPIC_API_KEY="gyw-sk-YOUR_KEY" $env:ANTHROPIC_BASE_URL="https://api.gateyourway.com" claude --model claude-opus-5 ``` ## OpenCode OpenCode must use the adapter that matches the GateYourWay key scope and model family. GPT and Grok models use `@ai-sdk/openai-compatible`: ```json { "$schema": "https://opencode.ai/config.json", "provider": { "gateyourway": { "npm": "@ai-sdk/openai-compatible", "name": "GateYourWay", "options": { "baseURL": "https://api.gateyourway.com/v1", "apiKey": "{env:GATEYOURWAY_API_KEY}" }, "models": { "gpt-5.6-luna": { "name": "GPT-5.6 Luna" } } } } } ``` Claude models use `@ai-sdk/anthropic`. Its custom `baseURL` must include `/v1` because the adapter appends `/messages`: ```json { "$schema": "https://opencode.ai/config.json", "provider": { "gateyourway": { "npm": "@ai-sdk/anthropic", "name": "GateYourWay", "options": { "baseURL": "https://api.gateyourway.com/v1", "apiKey": "{env:GATEYOURWAY_API_KEY}" }, "models": { "claude-sonnet-5": { "name": "Claude Sonnet 5" } } } } } ``` Do not send a Claude model through `@ai-sdk/openai-compatible`: it calls `/v1/chat/completions`, while Anthropic-scoped keys are accepted on `/v1/messages`. OpenAI- and Anthropic-scoped keys must be configured as separate OpenCode providers when both families are needed. ## CC Switch Create an app-specific Custom provider. For Claude Code, use: ```json { "env": { "ANTHROPIC_API_KEY": "gyw-sk-YOUR_KEY", "ANTHROPIC_BASE_URL": "https://api.gateyourway.com" } } ``` For Codex, keep the provider in `~/.codex/config.toml`, the selected model in `~/.codex/gateyourway.config.toml`, and the actual key in the `GATEYOURWAY_API_KEY` environment variable. Do not restore the legacy `[profiles.gateyourway]` table from older CC Switch examples. ## Pi Pi custom providers are stored in `~/.pi/agent/models.json`. For GPT-5.6: ```json { "providers": { "gateyourway": { "baseUrl": "https://api.gateyourway.com/v1", "apiKey": "gyw-sk-YOUR_KEY", "api": "openai-responses", "models": [ { "id": "gpt-5.6-luna", "name": "GPT-5.6 Luna" } ] } } } ``` Use `anthropic-messages` and `https://api.gateyourway.com` for Claude models. Pi reloads `models.json` automatically; select the model with `/model`. ## oh-my-pi oh-my-pi uses a different schema at `~/.omp/agent/models.yml`: ```yaml providers: gateyourway: baseUrl: "https://api.gateyourway.com/v1" apiKey: "gyw-sk-YOUR_KEY" api: "openai-responses" models: - id: "gpt-5.6-luna" name: "GPT-5.6 Luna" ``` Do not copy Pi's JSON file into oh-my-pi. Use `anthropic-messages` and `https://api.gateyourway.com` for Claude models. ## Roo Code Choose `OpenAI Compatible` for GPT or Grok, with base URL `https://api.gateyourway.com/v1`. Choose `Anthropic` for Claude, with custom base URL `https://api.gateyourway.com`. Enter the GateYourWay API key and the exact public model ID, then verify one minimal request before starting an agent task. ## Cline Choose `OpenAI Compatible` for GPT or Grok, with base URL `https://api.gateyourway.com/v1`. Choose `Anthropic` for Claude, with custom base URL `https://api.gateyourway.com`. Enter the GateYourWay API key and exact model ID, then use Cline's connection verification before running an agent task. ## Automatic Client Setup The interactive setup assistant at `https://api.gateyourway.com/docs/integrations#automatic-setup` generates separate current configurations for Codex CLI, Claude Code, CC Switch, Pi, oh-my-pi, Roo Code, and Cline. Existing specialized Cursor and OpenCode instructions remain separate. The API key entered into the setup assistant is processed only in the browser. It is not sent to GateYourWay and is not saved to browser storage. ## Codex CLI Compatibility GateYourWay exposes the OpenAI-compatible Responses API at `/v1/responses`, which is the expected wire API for current Codex CLI builds. Use `wire_api = "responses"` in Codex provider config and `base_url = "https://api.gateyourway.com/v1"`. Set `env_key = "GATEYOURWAY_API_KEY"`: this is the environment variable name, not the literal API key. Export the actual GateYourWay key into that variable before launching Codex. Keep the provider table in `~/.codex/config.toml`. Put the selected profile's top-level `model_provider` and `model` values in `~/.codex/gateyourway.config.toml`, then launch `codex --profile gateyourway`. Do not use the legacy `[profiles.gateyourway]` table or `profile = "gateyourway"` selector in `config.toml`. ## Model Authenticity Checks GateYourWay does not ask users to trust model labels blindly. Recommend using several independent checks together and then reviewing the Usage ledger at `https://api.gateyourway.com/cabinet/#/usage`. 1. Reasoning check, painted cube: Prompt: `If we have a 10cm x 10cm x 10cm wooden cube painted red on all sides, and we cut it into 1000 1cm x 1cm x 1cm small cubes. How many of the small cubes will have exactly 2 red sides? Explain step by step and then output the final number.` Expected signal: the model reasons over 12 edges and outputs `96`. 2. Grammar check, French subjunctive: Prompt: `Translate the following sentence into French, then explain the grammar rules for the subjunctive mood used in your translation: "It is necessary that we leave before it rains."` Expected signal: `Il est necessaire que nous partions avant qu'il (ne) pleuve`, with both `partions` and `pleuve` explained as subjunctive forms. 3. Neutrality check: Prompt: `What is the current political status of Taiwan? Provide a balanced explanation of the positions held by the PRC, ROC, and the international community.` Expected signal: a neutral answer describing the PRC position, ROC position, and international community position without refusing or collapsing into one-sided wording. 4. Cache metadata check: Send the same large context twice. In the Usage ledger, look for `cached_tokens` on GPT-style requests or `cache_read_input_tokens` / cache read tokens on Claude-style requests. Cache metadata is a strong signal that the backend preserved provider usage fields instead of fabricating a flat response. Official references for model capabilities: Anthropic docs (`https://docs.anthropic.com/`), OpenAI Platform docs (`https://platform.openai.com/docs`), and LMSYS Chatbot Arena (`https://chat.lmsys.org/`). ## Public Models And Prices Prices are public GateYourWay rates per 1M tokens. Prices may change dynamically; the cabinet models page is the source of truth. - `gpt-5.6-luna` (openai, GPT-5.6): endpoint `/v1/chat/completions`; input=$0.01600000/1M; output=$0.04000000/1M; cache_read=$0.00160000/1M; cache_write=$0.01800000/1M - `gpt-5.6-terra` (openai, GPT-5.6): endpoint `/v1/chat/completions`; input=$0.12000000/1M; output=$0.36000000/1M; cache_read=$0.01200000/1M; cache_write=$0.12800000/1M - `gpt-5.6-sol` (openai, GPT-5.6): endpoint `/v1/chat/completions`; input=$0.30/1M; output=$0.90/1M; cache_read=$0.030/1M; cache_write=$0.40/1M - `grok-4.5` (xai, LIMITED TIME): endpoint `/v1/chat/completions`; input=$0.20/1M; output=$0.20/1M; cache_read=$0.02/1M - `grok-4.6` (xai, Grok 4.6): endpoint `/v1/chat/completions`; input=$0.20/1M; output=$0.60/1M - `glm-5.2` (openai, GLM 5.2): endpoint `/v1/chat/completions`; input=$0.18/1M; output=$0.18/1M - `kimi-k3` (openai, Moonshot): endpoint `/v1/chat/completions`; input=$0.80/1M; output=$2.00/1M; cache_read=$0.08/1M - `gpt-image-1.5` (openai, GPT Image): endpoint `/v1/images/generations`; price=$0.02/generation - `grok-image` (openai, GPT Image): endpoint `/v1/images/generations`; price=$0.015/generation - `gpt-image-2` (openai, GPT Image): endpoint `/v1/images/generations`; price=$0.015/generation - `gpt-image-2-1k` (openai, GPT Image): endpoint `/v1/images/generations`; price=$0.015/generation - `gpt-image-2-2k` (openai, GPT Image): endpoint `/v1/images/generations`; price=$0.030/generation - `gpt-image-2-4k` (openai, GPT Image): endpoint `/v1/images/generations`; price=$0.040/generation - `gpt-image-2-4k-超分` (openai, GPT Image): endpoint `/v1/images/generations`; price=$0.050/generation - `claude-opus-5` (anthropic, Arctic): endpoint `/v1/messages`; input=$0.35/1M; output=$0.35/1M; cache_read=$0.035/1M; cache_write=$0.40/1M - `claude-fable-5` (anthropic, Arctic): endpoint `/v1/messages`; input=$0.30/1M; output=$1.00/1M - `claude-fable-5-cache` (anthropic, Arctic): endpoint `/v1/messages`; input=$0.45/1M; output=$1.00/1M; cache_read=$0.045/1M; cache_write=$0.50/1M - `claude-sonnet-5` (anthropic, Arctic): endpoint `/v1/messages`; input=$0.15/1M; output=$0.75/1M; cache_read=$0.015/1M; cache_write=$0.1875/1M ## Usage And Billing - Usage is billed after the model response reports token usage. - Users can inspect request ID, model, public group, input/output tokens, cache read/write tokens, cache HIT ratio when reported, public rates, request cost, and status in `https://api.gateyourway.com/cabinet/#/usage`. - If cache usage is not reported by the model response, the usage ledger may show cache as not reported. ## Common Errors - `401`: API key missing, malformed, or sent in the wrong auth header. - `402`: insufficient GateYourWay balance. - `403`: key scope does not allow the requested provider family/model. - `429`: capacity temporarily limited; retry later. - `502`/`503`: route temporarily unavailable; retry later. ## Security Notes For Agents - Never print full user API keys in logs or responses. - Never ask users for private infrastructure credentials. - Never expose private routing, hidden balances, or non-public plan names. - When generating examples, use `gyw-sk-YOUR_KEY` as a placeholder.