Published September 7, 2026 · 7 min read
OpenAI-Compatible API Key for Cursor, Claude Code & Cline
Use a single OpenAI-compatible API key across Cursor, Claude Code and Cline. Base URL, endpoints and the exact setup for coding agents — with one zcloud key at up to 95% off official pricing.
Cursor, Claude Code and Cline are three of the most powerful coding agents in 2026 — and every one of them lets you bring your own API key and base URL. That single option is worth more than any feature comparison, because it means all three can share one account, one balance and one bill.
Here is how to run all three on a single OpenAI-compatible key, and why that setup cuts your inference spend by up to 95%.
Why "OpenAI-compatible" is the superpower
OpenAI's wire protocol is the de facto standard every coding agent speaks. Almost every one of them ships an option to configure a custom base URL instead of OpenAI's default, which means any server that implements the same protocol — same endpoints, same request and response shapes — can stand in.
zcloud implements that protocol. Its gateway exposes the endpoints coding agents rely on:
POST /v1/chat/completions— the classic chat completion endpoint your agent uses for edits, explanations and completions.POST /v1/responses— the newer Responses API shape for tool-calling loops.POST /v1/messages— an Anthropic-compatible endpoint for agents that prefer the Claude messages protocol.
Because these are the same endpoints the official providers serve, your agent talks to them the same way it talks to OpenAI or Anthropic. The only thing that changes is the base URL and the key.
The one-key setup
The setup is the same shape across all three agents. In each agent's model or provider settings, point it at a custom OpenAI-compatible provider:
- Base URL:
https://api.zrouter.dev - API key: your zrouter key, in the format
zr_<public-id>_<secret>
You create that key once in your workspace, then paste it into each agent. No separate accounts, no separate payment methods, no juggling three balance tallies.
In Cursor, add a custom model provider and set the OpenAI base URL to zcloud. In Claude Code, configure the ANTHROPIC_BASE_URL (and key) to the zcloud /v1/messages endpoint if you want the Anthropic protocol, or use the OpenAI-compatible path. In Cline, choose an OpenAI-compatible provider and set the base URL to zcloud. The exact menu names differ between releases, but they all converge on the same two fields: a base URL and a key.
Do not invent or paste placeholder credentials — generate your real key from the workspace. The key is shown once at creation, so copy it before you close the dialog.
Why one key beats three
The obvious win is convenience: one login, one balance, one place to revoke a leaked key. The less obvious win is cost.
Official coding-agent usage is not cheap. An agent burns tokens on long context windows, repeated file reads and iterative edits — the kind of workload where output and cached-input pricing pile up fast. Running that same workload through a reseller at roughly 5% of official pricing compresses the bill by an order of magnitude, on the exact same models.
There is also a predictability win. Prepaid token plans let you cap your spend: buy a plan from $1, burn through it, and top up when it runs out. It is the natural fit for agent usage, which is bursty and hard to forecast.
Model choice behind the key
One key does not lock you to one model. Point all three agents at the same endpoint and switch models per agent or per task — a fast model for boilerplate, a frontier model for the hard refactors — all behind the same balance. The token pricing index lists every available model with input, output and savings, so you can pick the cheapest option that still gets the job done.
The model catalog shows what a single key opens, and the docs cover the endpoint shapes and authentication in detail. The short version: configurable base URL plus OpenAI compatibility means one key runs every agent you use — at a fraction of what three official accounts would cost.
Frequently asked questions
Do Cursor, Claude Code and Cline all support custom base URLs? Yes. All three let you configure a custom OpenAI-compatible provider, which is exactly what makes the one-key setup work.
Which endpoints does the gateway serve? /v1/chat/completions, /v1/responses and /v1/messages — covering both OpenAI-compatible and Anthropic-compatible agents.
Will my existing agent config keep working? Yes. Because the gateway speaks the same protocol, your prompts, tools and agent behavior stay the same; only the base URL changes.
Can I use one key for multiple agents at once? Yes. One zcloud key works across Cursor, Claude Code, Cline and any other OpenAI-compatible tool, all drawing from one balance.