How to Use Claude Code with DeepSeek, GLM or GPT, Without an Anthropic Subscription
Run Claude Code on DeepSeek V4.1 Flash, GLM or GPT through NusaGate: one-command setup, manual settings.json, which model for which role, and a real task that cost about $0.05.
NusaGate team · · 6 min read
Claude Code is a coding agent for the terminal: it reads your project, edits files, runs commands and fixes its own errors. Out of the box it needs an Anthropic subscription or a paid Anthropic API key, and subscriptions can hit a usage limit in the middle of your work.
Claude Code can also talk to another gateway. This guide shows how to run it on DeepSeek, GLM or GPT through NusaGate: pay per token from a prepaid balance, top up with USDC, no Anthropic account needed.
Why Claude Code can run on DeepSeek
Claude Code speaks the Anthropic Messages API format, and the environment variable ANTHROPIC_BASE_URL decides where those requests go. NusaGate serves the same format at /v1/messages and forwards each request to the model you pick. The app stays Claude Code; the model is DeepSeek, GLM, Qwen, GPT or anything else in the NusaGate catalog.
What does it cost? A real run
We asked Claude Code, connected to deepseek-v4.1-flash, to add features to a small point-of-sale app: plus and minus buttons, change calculation and a printable receipt. The agent worked for 3 minutes 18 seconds, ran 15 tool steps (including taking a screenshot of its own result) and sent 26 requests to the API.
The bill was about $0.05. That run was on 21 October 2026, when V4.1 Flash cost less than it does now. At today’s price ($0.08 input, $0.33 output per 1M tokens), the same task comes to roughly $0.09 to $0.10.
Step 1: Set up an account and balance
- Sign up at nusagate.com/register with your email. No credit card.
- In the dashboard, open API keys and create a key. It starts with
nsk_and is shown only once. - Open Wallet and top up: from $2 in USDC on Solana with no top-up fee, or in rupiah with QRIS, virtual account or e-wallet.
No Claude Code yet? Install it with npm install -g @anthropic-ai/claude-code (needs Node.js 18 or newer).
Step 2 (fast): one command with the helper
The official NusaGate helper writes the right settings to ~/.claude/settings.json for you. Run:
npx @nusagate-gateway/helperThe wizard asks for your API key (checked against NusaGate right away), then you pick Claude Code from the list of agents and choose a model, with its price per 1M tokens shown next to it. Nothing else in your file changes. Need it without prompts, on a server for example? Use the non-interactive mode:
npx @nusagate-gateway/helper apply --key nsk_xxx --model deepseek-v4.1-flash --agents claude --yesStep 2 (manual): edit settings.json
To set it up yourself, open ~/.claude/settings.json (on Windows: %USERPROFILE%\.claude\settings.json) and add this env block:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.nusagate.com",
"ANTHROPIC_AUTH_TOKEN": "nsk_...",
"ANTHROPIC_MODEL": "deepseek-v4.1-flash",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4.1-flash",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-flash",
"API_TIMEOUT_MS": "600000"
}
}- Set
ANTHROPIC_BASE_URLwithout/v1: Claude Code adds/v1/messagesitself. - Use
ANTHROPIC_AUTH_TOKEN, notANTHROPIC_API_KEY, so it doesn’t clash with an Anthropic key you may still have saved. - A 10-minute
API_TIMEOUT_MSleaves room for long answers on big tasks.
For one terminal session only
To leave your settings file alone, set the variables before starting Claude Code:
export ANTHROPIC_BASE_URL=https://api.nusagate.com
export ANTHROPIC_AUTH_TOKEN=nsk_...
export ANTHROPIC_MODEL=deepseek-v4.1-flash
claudeStep 3: Run it and check the bill
Open a project folder, run claude and start with a small task, such as "explain the structure of this project". Then open Activity in the dashboard: every request is listed with its model, token count and cost.
Which model for which role?
Claude Code picks a model through three roles: opus for heavy tasks, sonnet for everyday work, and haiku for small background jobs. You can fill each role with any model. Prices as of 2 December 2026, per 1M tokens:
| Model | Input | Output | Good for |
|---|---|---|---|
deepseek-v4.1-flash | $0.08 | $0.33 | Sonnet role. Cheap, 1M-token context, reads images. |
deepseek-v4-pro | $0.43 | $1.28 | Opus role. Deeper reasoning, text only. |
glm-5.3-flash | $0.06 | $0.17 | Haiku role. Fast and cheap for small tasks. |
glm-5.3 | $0.80 | $2.50 | Opus alternative for coding and agents. |
gpt-5.6-terra | $1.17 | $5.11 | A balance of quality and cost. |
kimi-k3 | $1.69 | $8.89 | Long tasks that need a top-tier model. |
Live prices and the rest of the models are on the models page, and the LLM API price list compares all of them.
Tips to spend less
- Prompt caching works automatically. Claude Code resends the same context at every step. The part read from cache is billed far lower: for DeepSeek, 10% of the input price.
- Use a Coding Plan if you code every day. Coding Plan Week costs about $2.22 and gives you $5.00 of API balance for 7 days, with no request limit. See the Coding Plan guide.
- Give the haiku role a cheap model. Small background jobs don’t need an expensive one.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| 401 / invalid API key | Wrong key, or the old Anthropic key is still in use. | Check ANTHROPIC_AUTH_TOKEN and remove the old ANTHROPIC_API_KEY. |
| 402 insufficient balance | The balance ran out. | Top up in Wallet and try again. |
| 404 model not found | Typo in the model name. | Copy the model ID exactly from the models page. |
| Requests go to api.anthropic.com | The settings were not picked up. | Restart the terminal, or run the helper's status command. |
Frequently asked questions
Is this Anthropic's Claude model?
No. You keep the Claude Code app, but the model behind it is DeepSeek V4.1 Flash, GLM 5.3 or another model on NusaGate. NusaGate does not sell Claude models.
Is Claude Code allowed to point at another gateway?
Yes. Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN so it can be used with an LLM gateway. NusaGate serves the Anthropic Messages API format at /v1/messages, so Claude Code works without a plugin.
Do I need a Claude Pro or Max subscription?
No. You don't need an Anthropic account at all. You need Claude Code installed, a NusaGate API key, and a balance, which you can top up from $2 in USDC.
Which model works best with Claude Code?
Start with deepseek-v4.1-flash: cheap, 1M-token context and strong at coding. For harder reasoning, use deepseek-v4-pro or glm-5.3 for the opus role, and glm-5.3-flash for the small background tasks of the haiku role.
Does Claude Code hit a usage limit this way?
Not a subscription limit. You pay per token from a prepaid balance, so the session runs as long as you have balance. The only cap is a rate limit of 150 requests per minute per account.
How do I switch back to my Claude account?
Run npx @nusagate-gateway/helper reset. It only removes the NusaGate settings from ~/.claude/settings.json and leaves the rest of the file alone.
Using OpenCode, Codex or Cline instead? The same helper configures all of them at once. See the agent setup guide in the documentation.
Try it now
Sign up free, top up from IDR 10,000 with QRIS, and make your first request in minutes.