AI Coding Agents and Custom API Endpoints: Cursor vs Claude Code vs Devin Desktop — What Operators Actually Control
Cursor, Claude Code, and Devin Desktop (formerly Windsurf) all support custom API endpoints — but the routing control, governance surface, and gateway compatibility differ wildly. We compared the operator-facing configuration of six coding agents to help you pick the one that fits your infrastructure.
Every major coding agent in mid-2026 claims "bring your own API key" support. But when you actually try to route all your coding traffic through a single gateway — enforcing key rotation, model governance, spend caps, and audit trails — the differences become obvious. We tested the custom endpoint configuration of six tools and documented what operators can actually control.
Sources: Cursor Forum — Custom OpenAI Compatible API, retrieved 2026-07-30; Claude Code — LLM Gateway Docs, retrieved 2026-07-30; Devin Desktop — AI Models, retrieved 2026-07-30; Zed — Use API Access, retrieved 2026-07-30; Codex CLI Configuration (ofox.ai), retrieved 2026-07-30; GitHub Copilot BYOK — agentgateway.dev, retrieved 2026-07-30; Cursor Sub-Agent Model Bug Report, retrieved 2026-07-30; Devin Desktop FAQ — Windsurf Rebrand, retrieved 2026-07-30.
OpenAI-compatible means a provider exposes a chat-completions endpoint whose request and response shape matches the OpenAI API contract closely enough that an unmodified OpenAI SDK call works against it after swapping three values: API key, base URL, and model name. The minimum surface in practice is POST /v1/chat/completions with messages, model, and an OpenAI-shaped streaming response.
TL;DR — Operator Control at a Glance
| Dimension | Cursor | Claude Code | Devin Desktop | Codex CLI | GitHub Copilot | Zed |
|---|---|---|---|---|---|---|
| Custom API endpoint | Override OpenAI Base URL | ANTHROPIC_BASE_URL env var | No custom endpoint — uses managed model router | OPENAI_BASE_URL env var | Enterprise-only proxy | Per-provider api_url in settings.json |
| Protocol | OpenAI-compatible | Anthropic-native (Messages API) | Proprietary (credit-based) | OpenAI-compatible | Proprietary + BYOK (OpenAI-compatible since 2025) | OpenAI-compatible + Anthropic-compatible |
| Sub-agent routing | Ignores custom URL (known bug) | Inherits gateway config | N/A — managed routing | Single process, consistent | N/A | Separate from external agents |
| Key management | Settings UI or env var | Env var only | Managed by Devin platform | Env var only | GitHub org settings | System keychain + env var |
| Model selection | User picks from model list + custom models | Fixed to Claude family | Credit-based model picker | Any model at endpoint | GitHub-managed roster | Full provider catalog |
| Governance / audit | None built-in | Organization-level via Claude Enterprise | SOC 2, role-based access | None built-in | GitHub org policies, audit log | None built-in |
| Gateway-friendly | Partial (main agent only) | Yes | No | Yes | Enterprise only | Yes |
Cursor: Override Base URL, Lose Your Sub-Agents
Cursor's custom API endpoint support lives in Settings → Models → OpenAI API Key + Override OpenAI Base URL. Set your gateway URL, add your API key, and Cursor's main agent routes through it.
The catch: Cursor's sub-agent runner ignores the custom base URL entirely. When Cursor spawns background agents to handle multi-step tasks, those sub-agents revert to Cursor's default routing. This is a known and actively reported bug as of July 2026. If your governance model requires all LLM traffic to flow through a gateway, Cursor currently breaks that guarantee.
What you can configure:
Override OpenAI Base URL— your gateway endpoint (e.g.,https://gateway.yourcompany.com/v1)OpenAI API Key— the key your gateway validates- Custom model names in the model dropdown
- HTTP/1.1 compatibility mode (required for some gateways — set via Settings → Network → HTTP Compatibility Mode)
What you cannot configure:
- Sub-agent routing — always uses Cursor's internal endpoint
- Per-model routing rules — one base URL for all custom models
- Key rotation policy — manual update in settings UI
- Request-level audit headers — no custom header injection
# Cursor configuration (Settings UI)
# Override OpenAI Base URL: https://your-gateway.example.com/v1
# OpenAI API Key: sk-your-gateway-key
# HTTP Compatibility Mode: HTTP/1.1 (if gateway requires)
Claude Code: Gateway-Native by Design
Claude Code takes a different approach — it was built with gateway routing in mind. The ANTHROPIC_BASE_URL environment variable redirects all API calls, including sub-agent and background-agent calls, through your endpoint.
What you can configure:
ANTHROPIC_BASE_URL— full gateway URL (e.g.,https://gateway.yourcompany.com)ANTHROPIC_API_KEY— key for the gateway- Organization-level settings via Claude Enterprise (spend limits, SSO, audit)
- Permission model — sandboxing, allowed tools, network restrictions
What you cannot configure:
- Model family — Claude Code only talks the Anthropic Messages API, so your gateway must speak it too
- Per-request model override — Claude Code selects its own model tier (though enterprise admins can constrain tiers)
# Claude Code gateway configuration
export ANTHROPIC_BASE_URL="https://your-gateway.example.com"
export ANTHROPIC_API_KEY="sk-your-gateway-key"
# All Claude Code traffic — main agent, sub-agents, background tasks —
# now routes through your gateway. No exceptions.
claude code
Claude Code's enterprise tier adds organization-level governance: SSO enforcement, API key scoping, spend controls, and audit log integration. Combined with the gateway env var, this is the most governance-ready coding agent we tested.
Devin Desktop (Formerly Windsurf): Managed Routing, No Custom Endpoint
Windsurf was rebranded to Devin Desktop on June 2, 2026, when Cognition AI unified its product line. The model access story changed significantly: Devin Desktop uses a managed model router that automatically selects models, with pricing expressed in credits rather than direct API costs.
You pick a model from Devin's catalog (Claude Sonnet 4, Claude Opus 4.5, GPT-4.1, GPT-5-Codex, SWE-1.7, etc.), and Devin handles the routing, billing, and infrastructure. There is no base_url override, no custom endpoint configuration, and no way to bring your own gateway.
What you can configure:
- Model selection within Devin's catalog
- Credit allocation per team member
- SOC 2-compliant workspace isolation
- Role-based access controls
What you cannot configure:
- Custom API endpoint — all traffic routes through Devin's infrastructure
- Direct provider API key usage — Devin intermediates
- Gateway integration — not supported
- Per-request routing rules
This is the most opinionated approach: Devin Desktop prioritizes simplicity and security-by-default over operator routing flexibility. For teams that want a managed experience, this works. For teams that need traffic to flow through their own infrastructure, it does not.
OpenAI Codex CLI: Simple Env Vars, Full Gateway Support
Codex CLI — OpenAI's terminal-based coding agent — is the most straightforward to gateway-route. Two environment variables control everything:
# Codex CLI gateway configuration
export OPENAI_BASE_URL="https://your-gateway.example.com/v1"
export OPENAI_API_KEY="sk-your-gateway-key"
# Codex CLI now routes all requests through your gateway
codex
Because Codex CLI is a single-process agent (no sub-agent spawning), the OPENAI_BASE_URL override is consistent — every request hits your gateway. The tradeoff is simpler agentic capabilities compared to Cursor or Claude Code.
What you can configure:
OPENAI_BASE_URL— full control over endpointOPENAI_API_KEY— gateway key- Any model name your endpoint supports
- Configuration file (
~/.codex/config.yaml) for persistent settings
What you cannot configure:
- Built-in governance — none; delegate to your gateway
- Audit trail — relies on gateway-side logging
- Sandbox controls — OS-level only (Codex uses a sandbox on macOS/Linux)
GitHub Copilot: Enterprise-Only Custom Endpoints
GitHub Copilot added custom endpoint support (BYOK) — but only for Copilot Business and Enterprise plans. Individual plans cannot configure a custom proxy.
Enterprise admins configure the proxy URL in GitHub organization settings. Copilot routes completions and chat through the proxy, which can intercept, log, and re-route requests. This is the only coding agent where the endpoint configuration is org-level rather than user-level — which is both a governance strength and a flexibility constraint.
What you can configure (Enterprise only):
- Custom proxy endpoint at the org level
- Model roster managed by GitHub
- Org-level policies (content exclusions, audit log, IP restrictions)
- Copilot in VS Code, JetBrains, Neovim, and CLI
What you cannot configure:
- User-level endpoint override (individual plans)
- Model selection beyond GitHub's curated list
- Per-request routing — org-wide proxy only
- Direct provider API key usage in the standard Copilot flow
Zed: Most Flexible Per-Provider Configuration
Zed takes the most granular approach to API configuration. Each provider can have its own api_url, custom headers, and API key — configured either through the Settings UI, settings.json, or environment variables.
// Zed settings.json — OpenAI-compatible provider pointing to a gateway
{
"language_models": {
"openai": {
"api_url": "https://your-gateway.example.com/v1",
"custom_headers": {
"X-Team-Id": "engineering",
"X-Cost-Center": "platform"
},
"available_models": [
{ "name": "gpt-5.5-mini", "max_tokens": 131072 }
]
}
}
}
Zed supports both OpenAI-compatible and Anthropic-compatible custom endpoints, with separate configuration for each. Keys are stored in the system keychain (not plaintext in config files), and environment variables take precedence when set.
What you can configure:
- Per-provider
api_url— different gateways for different providers - Custom HTTP headers per provider — useful for cost attribution and audit
- Custom model definitions with token limits
- System keychain storage for API keys
What you cannot configure:
- Built-in governance beyond key management
- External agent routing (Zed Agent and external agents use separate config)
- Team-wide policy enforcement (Zed is single-user)
Decision Matrix: Pick Your Agent by Routing Needs
| You need… | Best pick | Runner-up |
|---|---|---|
| All traffic through one gateway, no exceptions | Claude Code (env var covers everything) | Codex CLI (simple, consistent) |
| Per-provider routing with different gateways | Zed (per-provider api_url) | None — others use a single endpoint |
| Enterprise governance + audit trail | GitHub Copilot Enterprise (org policies + proxy) | Claude Code Enterprise (SSO + spend controls) |
| Model selection flexibility with your own keys | Zed (full provider catalog) | Cursor (custom models, but sub-agent caveat) |
| Managed experience, no infrastructure to run | Devin Desktop (fully managed routing) | GitHub Copilot (GitHub-managed models) |
| Sub-agent consistency (all agents route the same) | Claude Code (inherits gateway) | Codex CLI (no sub-agents to break) |
Gateway Integration Patterns
For teams running a routing gateway, here is how each agent connects:
Pattern 1: OpenAI-Compatible Gateway (Cursor, Codex, Zed, Copilot)
Your gateway exposes /v1/chat/completions with OpenAI-compatible request/response format. Most agents connect with a base URL and API key.
# What your gateway receives from Cursor / Codex / Zed
# POST /v1/chat/completions
{
"model": "claude-opus-4-8", # Gateway resolves to upstream provider
"messages": [...],
"stream": true
}
The gateway handles model-to-provider mapping, key rotation, spend limits, and fallback routing. The agent does not need to know which upstream provider serves the request.
Pattern 2: Anthropic-Compatible Gateway (Claude Code)
Claude Code speaks the Anthropic Messages API, not OpenAI-compatible. Your gateway must accept POST /v1/messages with Anthropic-format requests.
# What your gateway receives from Claude Code
# POST /v1/messages
{
"model": "claude-sonnet-4-20250514",
"max_tokens": 8192,
"messages": [...],
"stream": true
}
Gateways like LiteLLM, Portkey, and TheRouter can translate between formats. If your gateway only speaks OpenAI-compatible, you will need an Anthropic-to-OpenAI translation layer.
Pattern 3: No Gateway Possible (Devin Desktop)
Devin Desktop does not support custom endpoints. All traffic flows through Devin's managed infrastructure. If regulatory or compliance requirements mandate that LLM traffic stays within your network, Devin Desktop is not an option.
What None of Them Solve Well Yet
Despite rapid progress, several operator-level concerns remain open across all six agents:
-
Unified audit trail — No agent natively exports structured logs (request ID, model, tokens, latency, cost) in a format ready for your observability stack. You need gateway-side logging.
-
Cross-agent policy enforcement — If your team uses Cursor and Claude Code, there is no single pane of glass for model governance. Each agent has its own config mechanism.
-
MCP tool governance — Agents increasingly use MCP tools, but there is no standard for restricting which MCP servers an agent can call. Claude Code's permission model is the closest, but it is Claude-specific.
-
Automatic key rotation — Only GitHub Copilot Enterprise and Claude Code Enterprise offer admin-managed key lifecycle. For others, developers manage their own keys.
-
Cost attribution by project/team — Zed's custom headers come closest to enabling cost attribution, but none of the agents have built-in cost center tagging.
A routing gateway addresses (1), (2), and (5) by centralizing traffic. Where OpenAI-compatible requests flow through a single endpoint, the gateway can tag, log, and enforce policies regardless of which coding agent originated the request. TheRouter routes OpenAI-compatible requests through configured providers, supporting the unified endpoint pattern for agents that support custom base URLs.
FAQ
Q: Can I use Cursor with a non-OpenAI provider through a gateway? Yes — set Override OpenAI Base URL to your gateway, and the gateway can route to Anthropic, DashScope, DeepSeek, or any provider. The limitation is that Cursor's sub-agents bypass this override (known bug as of July 2026).
Q: Does Claude Code work with OpenAI-compatible gateways? Only if your gateway also speaks the Anthropic Messages API. Claude Code does not send OpenAI-format requests. Gateways like LiteLLM and Portkey support both formats.
Q: Is Windsurf still available? Windsurf was rebranded to Devin Desktop on June 2, 2026. Existing Windsurf settings port automatically.
Q: Which agent is best for air-gapped or on-premise deployments? Codex CLI and Claude Code both support pointing to a local endpoint. Zed supports local models via Ollama or LM Studio. Devin Desktop and GitHub Copilot require cloud connectivity.
Q: Can I enforce a model allowlist across my team? GitHub Copilot Enterprise offers org-level model roster control. Claude Code Enterprise allows tier constraints. For others, enforce at the gateway level — reject requests for models not on your approved list.
Pricing, feature availability, and sub-agent behavior may change as vendors ship updates. Verify current configuration against each tool's official documentation before deploying.