Two months ago, I sat with an engineering manager onboarding ten full-stack developers onto an agentic coding workflow spanning terminal, editor, and automated PR triage. Every developer wanted Claude Code for deep repo refactors, Cursor for fast visual diffs, and Cline inside VS Code for transparent step-by-step feature builds. We budgeted thirty minutes for tooling setup. Instead, we burned three hours and five minutes—and not a single pull request got opened before lunch. Finance had to chase corporate card approvals across three separate billing portals (Anthropic Console, OpenAI Platform, and a prepaid DeepSeek wallet), three Windows engineers tripped over persistent environment variable quirks, two macOS engineers hit 404 errors from a stray /v1 suffix, and by 4 PM a runaway retry loop in Cline burned $84 in forty minutes because nobody had configured a per-developer daily cap.
That disaster had nothing to do with model quality and everything to do with fragmented developer tooling. Once you connect Claude Code Cursor Cline one API key through a dual-protocol unified gateway like TOP AI, the multi-portal billing tax disappears overnight. One signup at /daftar drops 5,000 TP of free trial credit into your ledger (1 TP = Rp 1), one dashboard at /dashboard/kunci lets you mint up to 20 scoped tp-... API keys with independent daily spend caps and model allowlists, and one prepaid balance speaks native Anthropic /v1/messages and OpenAI /v1/chat/completions side by side.
Executive Answer: You can connect Claude Code, Cursor, and Cline to one TOP AI account in under 10 minutes by pointing each tool at its matching protocol surface on the same gateway:
https://topai.id(native Anthropic/v1/messagesfor Claude Code CLI) andhttps://topai.id/v1(OpenAI-compatible/v1/chat/completionsfor Cursor and Cline). All three editors draw from one prepaid TOP Points balance, preserve full native Anthropic prompt caching without proxy translation loss, and unlock dual-model Plan vs Act routing in Cline that cuts agentic coding spend by more than 55%.
This field guide skips the shallow "paste key, click save" fluff. I am going to walk through the exact protocol mechanics behind the two base URLs, hand you copy-paste shell exports for macOS/Linux (zsh/bash) and Windows PowerShell, share a battle-tested .claude/settings.json, lay out the honest edge cases in Cursor (including what stays on Cursor's own servers), prove the cost math behind Cline's Plan vs Act split, give you the cross-platform onboarding scripts that slashed our 10-engineer setup from 185 minutes to 18 minutes, and finish with a diagnostic playbook for every 401, 403, and 404 header conflict you will hit in the wild.
Why One Unified Key Needs Two Distinct Base URLs
Direct answer: Every scoped tp-... key in TOP AI is valid across the entire gateway, yet Claude Code requires https://topai.id while Cursor and Cline require https://topai.id/v1. The reason is wire-protocol framing: Anthropic's official SDK automatically appends /v1/messages and /v1/messages/count_tokens to the base URL, whereas OpenAI-compatible IDE extensions expect /v1 in the base URL so they can append /chat/completions and /models.
A common mistake when evaluating AI gateways is assuming every router translates requests into an OpenAI schema behind the scenes. That "forced translation" design quietly breaks modern agentic coding tools. Claude Code CLI relies heavily on native Anthropic wire semantics: structured Server-Sent Events (message_start, content_block_start, content_block_delta), extended thinking blocks, explicit cache_control: {"type": "ephemeral"} breakpoints for multi-tier prompt caching, and zero-cost preflight calls to /v1/messages/count_tokens. Whenever a generic proxy converts Claude Code payloads into OpenAI chat completions and back again, cache breakpoints vanish, tool-use schemas drift, and your token bill jumps 4x to 8x on long repository sessions.
TOP AI avoids translation loss by exposing two first-class protocol surfaces in front of a single authentication engine and prepaid TOP Points ledger. Requests hitting https://topai.id/v1/messages validate x-api-key or Authorization: Bearer tp-..., enforce your key's daily TP limit and model allowlist, and stream native Anthropic frames directly upstream with automatic provider failover—an architecture we unpack in detail in our zero-downtime multi-provider AI failover architecture breakdown. Meanwhile, requests hitting https://topai.id/v1/chat/completions accept standard OpenAI payloads from Cursor, Cline, Roo Code, Continue.dev, or Aider and route cleanly across claude-opus-5, claude-sonnet-5-5, gpt-6-astra, deepseek-v4-pro, deepseek-v4-1-flash, and qwen3-coder-480b.

Before editing a single dotfile or IDE panel, review the exact protocol contract across the six most common AI coding clients. Pay close attention to the Final Path Appended and Prompt Caching Pass-Through columns—those two details explain nearly every mysterious setup failure and unexpected invoice spike.
| Coding Client / Agent | Wire Protocol | Required Base URL | Final Path Appended by Client | Auth Header Sent | Native Prompt Caching | Preflight count_tokens |
|---|---|---|---|---|---|---|
| Claude Code CLI | Native Anthropic | https://topai.id | /v1/messages & /v1/messages/count_tokens | x-api-key or Authorization: Bearer | Full pass-through (up to 90% read discount) | Automatic (0 TP) |
| Cursor IDE (Chat & Agent) | OpenAI Compatible | https://topai.id/v1 | /v1/chat/completions | Authorization: Bearer | Upstream model dependent | Not native |
| Cline (VS Code) | OpenAI Compatible | https://topai.id/v1 | /v1/chat/completions | Authorization: Bearer | Supported on Claude & DeepSeek models | Client estimate / optional |
| Roo Code (VS Code) | OpenAI Compatible | https://topai.id/v1 | /v1/chat/completions | Authorization: Bearer | Supported on compatible models | Client estimate |
| Continue.dev (FIM & Chat) | OpenAI Compatible | https://topai.id/v1 | /v1/chat/completions & /v1/completions | Authorization: Bearer | Supported for chat prefixes | Not native |
| Aider CLI | Anthropic or OpenAI | https://topai.id (Anthropic) or https://topai.id/v1 (OpenAI) | Depends on chosen provider flag | Depends on chosen provider flag | Full pass-through in Anthropic mode | Optional via wrapper |
If your platform engineering group is consolidating not only local developer editors but also CI/CD PR reviewers and production microservices behind one gateway, our unified AI gateway field guide for 2026 covers the broader routing, observability, and latency budget patterns.
Step 0: Mint Scoped tp-... Keys & Smoke-Test Your 5,000 TP Free Trial
Direct answer: Never paste an unrestricted master key across ten developer laptops. Register at /daftar to claim your 5,000 TP free trial (1 TP = Rp 1, roughly $0.31 USD of starter credit), open /dashboard/kunci to mint a scoped tp-... key with a daily spend cap and explicit model allowlist, and verify both endpoints via curl before opening any IDE.
Let's clear up one important security nuance around the phrase connect Claude Code Cursor Cline one API key. If you are a solo engineer working on a personal laptop, reusing one scoped tp-... key across Claude Code, Cursor, and Cline is clean and practical. If you manage a team of five to twenty engineers, "one API key architecture" means one unified gateway, one central prepaid balance, and one repeatable configuration template—while issuing an individual scoped tp-... key per engineer. Because TOP AI allows up to 20 active API keys per account at /dashboard/kunci, a 10-developer squad can give every engineer their own isolated key and still keep 10 slots free for staging agents, automated code review pipelines, and evaluation harnesses.
Every tp-... key supports three guardrails you should configure before anyone touches an editor:
- Daily TP spend cap: For solo daily work, 50,000 TP/day (~$3.10/day) is plenty for heavy coding without risking a runaway agent bill. For senior engineers running multi-repo migrations, 150,000–250,000 TP/day (~$9–$15/day) gives generous headroom while still killing infinite retry loops automatically.
- Model allowlist: Restrict IDE keys strictly to coding models—
claude-opus-5,claude-sonnet-5-5,gpt-6-astra,deepseek-v4-pro,deepseek-v4-1-flash, andqwen3-coder-480b—so a leaked laptop key cannot be abused for unrelated multimodal generation workloads. - Per-key audit logs: Every request carries key attribution, letting you pinpoint which engineer, editor, or runaway loop drove a spike without digging through three vendor billing CSVs. For deeper governance templates, read our guide on enterprise AI API key governance: daily caps, allowlists, and audit logs.
Once your scoped tp-... key is generated, spend fifteen seconds running this three-command terminal smoke test. It verifies your key, checks remaining balance, and probes the native Anthropic parser at 0 TP cost.
# Export temporarily in the current shell for verification
export TOPAI_KEY="tp-replace-with-your-scoped-key"
# 1. Verify OpenAI-compatible surface (/v1/models)
curl -sS https://topai.id/v1/models \
-H "Authorization: Bearer ${TOPAI_KEY}" | jq '.data[0:6] | .[].id'
# 2. Verify prepaid balance and active daily cap
curl -sS https://topai.id/v1/balance \
-H "Authorization: Bearer ${TOPAI_KEY}" | jq '{balance_tp, daily_spent_tp, daily_limit_tp}'
# 3. Verify native Anthropic surface for 0 TP using preflight count_tokens
curl -sS https://topai.id/v1/messages/count_tokens \
-H "x-api-key: ${TOPAI_KEY}" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"messages": [{"role": "user", "content": "Verify native Anthropic connectivity."}]
}' | jq .That third command is my favorite deployment trick. Calling POST /v1/messages/count_tokens costs 0 TP, yet it exercises TLS, corporate proxy pass-through, x-api-key validation, model allowlist enforcement, and Anthropic's native tokenizer pipeline. If it returns {"input_tokens": 14}, you know Claude Code will authenticate cleanly. You can also wire that same endpoint into custom CI scripts as a preflight budget gate—see preflight token counting with /v1/messages/count_tokens for the middleware patterns. Before rolling out to a team, check current per-million-token TP rates on the TOP AI pricing page and bookmark the API documentation for header references.
Step 1: Configure Claude Code CLI (macOS, Linux, Windows PowerShell & .claude/settings.json)
Direct answer: Point Claude Code CLI at TOP AI by setting ANTHROPIC_BASE_URL="https://topai.id" (never append /v1) and ANTHROPIC_API_KEY="tp-..." (or ANTHROPIC_AUTH_TOKEN="tp-...", never both simultaneously), then lock your default model and command guardrails in ~/.claude/settings.json.
Claude Code shines when you live in the terminal: tracing failing integration suites, refactoring shared libraries across a monorepo, inspecting database migrations, and running iterative git diff loops without copy-pasting stack traces into a chat sidebar. It is also the pickiest of the three tools when it comes to environment hygiene.
Watch out for two classic traps. First, never include /v1 in ANTHROPIC_BASE_URL. Because Claude Code's built-in Anthropic SDK appends /v1/messages, setting https://topai.id/v1 produces https://topai.id/v1/v1/messages and triggers an immediate 404. Second, understand ANTHROPIC_API_KEY versus ANTHROPIC_AUTH_TOKEN. Exporting ANTHROPIC_API_KEY sends x-api-key: tp-...; exporting ANTHROPIC_AUTH_TOKEN sends Authorization: Bearer tp-.... TOP AI accepts either header on its native Anthropic endpoint, but newer builds of Claude Code throw authentication conflicts when both variables exist in the environment—or when a leftover OAuth token from a prior claude login session sits in ~/.claude/.credentials.json. Run claude logout first if you previously authenticated with a direct Anthropic subscription.
Permanent Shell Exports on macOS & Linux (zsh / bash)
Append the block below to ~/.zshrc (macOS default) or ~/.bashrc (Ubuntu/Debian/WSL), then reload your shell:
# --- TOP AI Unified Gateway for Claude Code ---
export ANTHROPIC_BASE_URL="https://topai.id"
export ANTHROPIC_API_KEY="tp-your-scoped-dev-key"
# Prevent dual-header auth collisions
unset ANTHROPIC_AUTH_TOKEN
# Default daily driver model (override anytime with `claude --model claude-opus-5`)
export ANTHROPIC_MODEL="claude-sonnet-5-5"Reload and confirm the masked variables before invoking claude:
source ~/.zshrc # or source ~/.bashrc
env | grep -E '^ANTHROPIC_' | sed 's/tp-.*/tp-***REDACTED***/'
claude --versionPermanent Environment Setup on Windows PowerShell
On Windows, assigning $env:ANTHROPIC_API_KEY = "..." only survives inside that single PowerShell tab—integrated terminals inside VS Code or Cursor won't see it. Persist the values into the Windows "User" registry scope via [Environment]::SetEnvironmentVariable and mirror them into your active session immediately:
# Persist permanently in Windows User environment (inherited by VS Code, Cursor & Windows Terminal)
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://topai.id", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "tp-your-scoped-dev-key", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", $null, "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "claude-sonnet-5-5", "User")
# Apply to the current PowerShell session right away
$env:ANTHROPIC_BASE_URL = "https://topai.id"
$env:ANTHROPIC_API_KEY = "tp-your-scoped-dev-key"
Remove-Item Env:ANTHROPIC_AUTH_TOKEN -ErrorAction SilentlyContinue
$env:ANTHROPIC_MODEL = "claude-sonnet-5-5"
# Verify masked values
Get-ChildItem Env:ANTHROPIC_* | ForEach-Object {
$val = if ($_.Name -like "*KEY*") { "tp-***REDACTED***" } else { $_.Value }
"{0}={1}" -f $_.Name, $val
}Production .claude/settings.json (Repo-Safe & Cost-Controlled)
Keep your API key out of Git, and commit a shared .claude/settings.json inside your repository root so every teammate inherits consistent base URL routing, safe bash allowlists, and bounded extended thinking budgets:
{
"model": "claude-sonnet-5-5",
"env": {
"ANTHROPIC_BASE_URL": "https://topai.id",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"MAX_THINKING_TOKENS": "12000"
},
"permissions": {
"allow": [
"Bash(npm test*)",
"Bash(pnpm test*)",
"Bash(go test ./...)",
"Bash(git status)",
"Bash(git diff*)",
"Read(./src/**)",
"Read(./tests/**)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Bash(rm -rf *)",
"Bash(git push --force*)"
]
},
"cleanupPeriodDays": 14
}Notice why routing Claude Code through native https://topai.id pays for itself on day one: Anthropic Prompt Caching remains 100% intact. When Claude Code ingests forty TypeScript files plus your MCP tool definitions on turn 1, the prefix writes to cache at a 25% premium; turns 2 through 18 read that exact repository snapshot at a 90% discount. If you want the exact breakeven curve and cache-TTL math behind those savings, read Anthropic prompt caching math explained. Whenever a session needs deep architectural reasoning—say debugging a subtle distributed lock race—switch models mid-session with /model claude-opus-5, then drop back to claude-sonnet-5-5 once the plan is clear.
Step 2: Configure Cursor IDE (OpenAI Base URL Override & Honest Trade-Offs)
Direct answer: Inside Cursor IDE, navigate to Cursor Settings → Models, paste your tp-... key into OpenAI API Key, toggle on Override OpenAI Base URL with https://topai.id/v1, add TOP AI's model IDs (claude-opus-5, claude-sonnet-5-5, gpt-6-astra, deepseek-v4-pro, qwen3-coder-480b), disable conflicting built-in aliases, and hit Verify.
Cursor earned its loyal following through sheer editor ergonomics: inline Cmd/Ctrl+K diffs, clean hunk-level Accept/Reject controls, and fast Composer multi-file edits. The friction shows up once your team scales past casual usage—monthly seat tiers throttle fast requests during heavy sprint weeks, and usage-based overages stack a markup on top of raw token costs. Pointing Cursor at TOP AI via OpenAI Base URL override lets you pick the exact frontier or open-weights model for each task while paying transparent prepaid token rates.
Exact Cursor Settings Walkthrough
Follow this sequence carefully—skipping step 5 is the most common reason Cursor silently bypasses your custom endpoint:
Live TOP AI API Pricing for Models Mentioned
Frequently Asked Questions
Why does Claude Code use https://topai.id while Cursor and Cline require https://topai.id/v1?+
Claude Code runs on Anthropic's native SDK, which automatically appends /v1/messages and /v1/messages/count_tokens to ANTHROPIC_BASE_URL. Adding /v1 manually makes Claude Code call /v1/v1/messages and fail with 404. OpenAI-compatible clients like Cursor and Cline append /chat/completions to the configured Base URL, so they require the explicit /v1 suffix.
Can one single tp- API key run Claude Code, Cursor, and Cline simultaneously?+
Yes. A single tp- key authenticates against both the native Anthropic surface and the OpenAI-compatible surface against one shared TOP Points balance. For engineering teams, however, we recommend minting one scoped tp- key per developer at /dashboard/kunci (up to 20 active keys per account) so each person gets an isolated daily cap and clear audit trail.
Does Cursor Tab autocomplete route through my TOP AI API key?+
No. Cursor's Override OpenAI Base URL routes Chat, Composer or Agent Mode, and inline edits for your custom models through TOP AI, while Cursor Tab speculative next-edit predictions and server-side @Codebase indexing still run on Cursor's own proprietary backend.








