Clients
Connect VS Code, GitHub Copilot CLI, Cursor, Continue, Claude Code and any MCP client to the gateway.
The gateway publishes ready-to-paste configuration for the tools people actually use. Nothing on these endpoints is secret — your key is always a placeholder you fill in locally — so they are public and CORS-open.
VS Code (Copilot Chat, Custom Endpoint)
VS Code's Custom Endpoint language-model provider takes a JSON object describing the models to add to the picker. The gateway serves it prebuilt:
GET https://ai.codai.ro/vscode/chatLanguageModels.jsonIn VS Code (Insiders recommended), run Chat: Manage Language Models → Add Models → Custom Endpoint. This creates a user-level chatLanguageModels.json.
Fetch the provider object and paste it into the array in that file:
curl.exe -s https://ai.codai.ro/vscode/chatLanguageModels.json | Set-ClipboardVS Code prompts for ${input:chat.lm.secret.codai} — paste your codai_… key. It is stored in the OS keychain. Restart VS Code if the models do not appear.
The picker gets three entries, each a fixed model identity:
| Picker entry | Alias | Why it exists |
|---|---|---|
| Codai | codai | Opus 5 with the effort dial (low → max) exposed in VS Code's Thinking Effort menu. |
| Codai (fast) | codai-fast | Haiku 4.5 for chat.utilitySmallModel — titles, intent detection, commit messages. Task-free. |
| Codai (explorer) | codai-explorer | Sonnet 5 for the Explore agent — many short read/search turns. |
The served config sets headers that keep the gateway a transparent transport: X-Codai-Disable-Subagents: 1, X-Codai-No-Recall: 1, X-Codai-Compact: off, plus X-Codai-Thinking: 1 with a per-alias budget and X-Codai-Cache: 1. Copilot owns orchestration and the transcript; the gateway never runs a second agent loop behind it.
The config deliberately omits X-Codai-Session-Id. VS Code does not interpolate ${workspaceFolder} in requestHeaders, so a templated value would bucket every workspace into one session. The gateway derives a per-conversation key instead, which keeps prompt caches warm.
Two companion endpoints publish a curated settings baseline: GET /vscode/settings.json (VS Code user settings) and GET /vscode/.copilot/settings.json (Copilot CLI ~/.copilot/settings.json).
GitHub Copilot CLI (BYOK)
Copilot CLI runs in bring-your-own-key mode when COPILOT_PROVIDER_BASE_URL is set — GitHub sign-in is not required. codai is a drop-in provider.
$env:COPILOT_PROVIDER_API_KEY = 'codai_xxxxxxxx'
Invoke-RestMethod https://ai.codai.ro/copilot/env.ps1 | Out-File env.ps1
. .\env.ps1 # dot-source: sets the vars and launches copilotGET /copilot/config returns the same values as JSON, including the alternative aliases you may use as the wire model (codai-fast, codai-deep, codai-agent, codai-max, codai-explorer, codai-vision) and the capability flags (streaming, tool calling, vision and prompt caching are on; GitHub-hosted memory and remote delegation stay GitHub-routed and are unavailable in BYOK mode).
Base URL differs by wire type. With COPILOT_PROVIDER_TYPE=openai the CLI appends /chat/completions, so the base must be https://ai.codai.ro/v1. With anthropic it appends /v1/messages, so the base must be the root https://ai.codai.ro. Getting this wrong yields a 404 that looks like an auth failure.
Persistent memory for BYOK sessions
BYOK mode loses GitHub's memory. Add the codai MCP server instead:
mkdir -p ~/.codai
curl -fsSL -o ~/.codai/mcp-codai-memory.mjs https://ai.codai.ro/copilot/mcp-bridge.mjs
curl -s https://ai.codai.ro/copilot/mcp.json # paste `mcpServers` into ~/.copilot/mcp-config.jsonThe snippet registers a local stdio bridge, not an http server: the CLI does not expand ${ENV} placeholders in http headers, so a remote server with a templated Authorization header sends the literal placeholder and hangs the 60 s handshake. The bridge reads CODAI_API_KEY or COPILOT_PROVIDER_API_KEY from the environment and forwards JSON-RPC to /mcp. Replace ~ in args with your absolute home directory — the CLI does not expand it.
Cursor, Continue, Cline, Zed and other OpenAI-compatible tools
Any client with an OpenAI-compatible provider option works. Set:
| Setting | Value |
|---|---|
| Base URL | https://ai.codai.ro/v1 |
| API key | codai_xxxxxxxx |
| Model | codai (or any alias from models) |
If the tool lets you set custom headers, X-Codai-Effort: high or max is the one worth adding. If it offers a model list, it can read GET /v1/models with your key.
Claude Code and Anthropic-native tools
Set the Anthropic base URL to the root and the key to your codai key:
export ANTHROPIC_BASE_URL='https://ai.codai.ro'
export ANTHROPIC_API_KEY='codai_xxxxxxxx'
export ANTHROPIC_MODEL='codai'POST /v1/messages accepts both Authorization: Bearer and x-api-key, so the SDK's default header works unchanged.
MCP server
The gateway is itself a remote MCP server (Streamable HTTP, spec 2025-11-25, wire-compatible with 2025-06-18):
POST https://ai.codai.ro/mcpTools: chat, list_models, memory_search, memory_store, memory_list, memory_forget, memory_graph. It also exposes prompts (slash commands), resources (codai://models, codai://memory/recent) and prompt-argument completion.
Two ways to authenticate:
- API key —
Authorization: Bearer codai_…. Use this from scripts or via the stdio bridge above. - OAuth 2.1 — clients that support it (VS Code, Claude Desktop, Claude Code, ChatGPT connectors) need no key at all. Point them at the URL; an unauthenticated request returns
401with aWWW-Authenticate: Bearer resource_metadata=…challenge, andGET /.well-known/oauth-protected-resource/mcppoints to auth.codai.ro for self-onboarding.
{
"servers": {
"codai": { "type": "http", "url": "https://ai.codai.ro/mcp" }
}
}Send Accept: text/event-stream and a chat tool call streams notifications/progress while in flight, then the JSON-RPC result. Every MCP request passes the same rate limiter as /v1, and tool calls that reach an upstream write a usage record.
Which one should I use?
- You live in VS Code → the Custom Endpoint config. Effort dial, three roles, keychain-stored key.
- You live in a terminal → Copilot CLI BYOK plus the memory bridge.
- You use another editor → its OpenAI-compatible provider with the
/v1base URL. - You are wiring an agent framework → the SDKs, or the OpenAI/Anthropic SDK against the matching base URL.