Claude coding agent on Windows: API key setup
Updated
To run a Claude coding agent on Windows, open the Code tab in Claude Desktop, use the Claude Code extension in your editor, or run claude in PowerShell. A personal subscription, a team seat and a Console API key are different billing choices. In Contenox Harness, choose Anthropic to connect a key for the built-in agent. Choose Agents → Claude Code to run the external agent. Claude Code overview
Use Claude with your agent#
| Agent | Supported? | How | Note |
|---|---|---|---|
| Claude Code | Yes | Open the Code tab in Claude Desktop, the IDE extension, or run claude. |
A Claude subscription or an invited team seat uses its own allowance. Console or cloud credentials bill the associated account. |
| Codex CLI | No | Codex talks to custom providers through the OpenAI Responses API only. Anthropic’s OpenAI compatibility covers Chat Completions, and is meant for testing. | |
| OpenCode | Yes, API key | /connect → Anthropic → paste a Console key |
Max, Ultra and Team include monthly API credits for this. |
| Contenox Harness | Yes | Backends → Providers → Anthropic takes a Console API key. Agents → Claude Code installs the external agent. | The external agent offers Console sign-in by default. Personal subscription sign-in is an optional unofficial setting. |
Can I use my Claude Pro or Max subscription?#
Your options depend on the application and on which account should pay for the work.
- In Claude Code. Sign in with your plan. Usage counts against the plan’s limits.
- In a host app. Anthropic distinguishes a customer signing in to its unmodified Claude Code binary from a third-party application routing requests with subscription credentials. Contenox Harness labels subscription sign-in for its external agent unofficial and ships it switched off. Anthropic’s credential-use terms · Contenox Harness setup
- Through the monthly API credits. Max, Ultra and Team plans now include API credits every month: $100 on Max, $200 on Ultra, up to $500 pooled on Team. Link a Claude Console organization under Settings → Billing → API credits on claude.ai (on Team, Organization settings → Billing), create an API key there, and use it in any agent, OpenCode included. The credits don’t roll over, and they don’t cover Claude Code itself. Pro, Free and Enterprise plans don’t get them.
The plugin trap: there are third-party plugins that make OpenCode and other tools sign in with a Claude plan directly. Anthropic’s terms forbid routing requests through Free, Pro, Max or Ultra plan credentials in other developers’ products, and Anthropic says it may enforce this without notice. You risk the account the plan is on.
The free Claude.ai plan does not include Claude Code.
A case for a second provider: on 12 June 2026, Anthropic’s statement said a US export-control directive required suspending all access to Fable 5 and Mythos 5 by foreign nationals. Complying meant switching both models off for every customer, while other Claude models kept working. Anthropic’s later post reports the controls lifted on 30 June. The same event is retold in Shouldn’t AI Move From Cloud to Local Compute? as the reason a connected second provider is worth having: access to one model can end overnight for reasons unrelated to the account holder.
Claude Code on Windows#
Claude Desktop. Install the desktop app, sign in, open Code, select a local project folder and start a session. The Code tab lets you review diffs, edit files and run work in parallel. On a current unmanaged installation, the sign-in screen also offers Use your Claude API account for a Console login or API key. An organization can restrict this option. Desktop walkthrough · API account sign-in
Editor and cloud. Use the VS Code extension or JetBrains integration to work in an open repository. To leave a task running when you close your laptop, start a cloud session in the browser or from the Code tab on mobile. Cloud sessions require an eligible plan or seat and, in a managed workspace, permission to start them. Supported interfaces · Cloud sessions
Install the CLI#
Install from PowerShell, no admin rights needed:
irm https://claude.ai/install.ps1 | iex
claude --version
macOS, Linux or WSL:
curl -fsSL https://claude.ai/install.sh | bash
winget install Anthropic.ClaudeCode and brew install --cask claude-code work too, but
don’t update themselves.
Run claude in your project folder and sign in in the browser with your Claude plan or a
Console account. To use an API key instead, set it before you start. PowerShell:
$env:ANTHROPIC_API_KEY = "your-key-here"
claude
macOS or Linux:
export ANTHROPIC_API_KEY=your-key-here
claude
Claude Code asks once whether to use the key.
The key-wins trap: if ANTHROPIC_API_KEY is set, Claude Code uses it instead of your
subscription once you approve it, and bills the key. Remove the variable to go back to the
plan, and run /status to see which one is active.
Anthropic recommends Git for Windows so Claude Code can run Bash commands; without it, it runs commands through PowerShell. Sandboxed command execution needs WSL 2. See Anthropic’s setup guide.
On AWS, Google Cloud or Azure, Claude Code can also run through Amazon Bedrock, Google Cloud’s Agent Platform (Vertex AI) or Microsoft Foundry, billed to that account.
OpenCode#
OpenCode offers a desktop app and a terminal client. For the terminal flow, install the current CLI for your platform and run opencode in your project. In /connect, select Anthropic and enter a Claude Console API key, then choose a Claude model in /models. OpenCode downloads · Connect a provider
Which Claude model should I pick?#
Anthropic’s models overview suggests starting with Claude Opus 5.5 for most work, and describes it as built for long-running agentic coding. Claude Sonnet 5.5 is faster and cheaper, and handles routine edits well. Claude Fable 5.2 is for demanding reasoning and long-running tasks. Claude Haiku 5.5 suits quick, simple jobs more than multi-file changes.
How API billing works#
You pay per token: everything the agent sends (your files, the conversation, tool results) and everything the model writes. Agent sessions resend a lot of context, so long sessions in large projects cost more than chat.
Anthropic places new accounts on a usage tier with a monthly spend cap, and you can set a lower limit yourself on the Billing page in the Claude Console. Current prices and limits are on Anthropic’s pricing and rate limits pages.
Common errors#
- 401: the key is wrong, revoked or expired. Create a new one in the Console.
- 429
rate_limit_error: you hit a per-minute rate limit. Wait and try again. If the message says your organization crossed its monthly usage threshold, you reached your tier’s spend cap, and retrying will not help until it resets or you request a higher tier on the Rate limits page in the Console. - 400 “You have reached your specified API usage limits”: a spend limit you set yourself. Raise it on the Billing page.
- 402
billing_error: check your payment details in the Console. - 529
overloaded_error: Anthropic is under heavy load. Try again shortly, or switch to another provider.
Contenox Harness#
Contenox Harness runs on Windows, macOS and Linux and gives you two ways to use Claude.
Run the external Claude Code agent. Open Agents and install Claude Code. Have Node.js 22 or newer and npm on the computer. The standard sign-in uses your Anthropic Console account and its billing. If you specifically want the personal subscription option, read the warning in Settings → Unofficial sign-ins → Allow unofficial sign-ins before enabling it. That option lets the agent use your existing Claude sign-in. Return to Agents, check the agent’s sign-in status, and start a chat with it.
Contenox Harness runs Claude Code in a sandbox, and the chat’s permission set decides what it may do without asking. Two things to know:
- Writes are limited to the chat’s project folder and Claude Code’s own settings folder.
- File reads on Windows. The external agent can read files accessible to the Windows account running Contenox Harness. For guidance on separating secrets from a project, see Keep secrets away from AI agents.
With an API key, including one paid by your plan’s monthly API credits:
- Open Backends → Providers and, under Recommended, choose Anthropic.
- Select Create key, create a key in the Claude Console and copy it.
- Paste it into API Key, select Connect and wait for Connected.
- Pick a Claude model in the Model chip on the message box.
To keep the key out of the app, enter ANTHROPIC_API_KEY under Advanced in
Environment variable name, set it with setx ANTHROPIC_API_KEY "your-key-here", and
reopen Contenox Harness. Key rejected means a 401; use Replace to paste a new key.
Related#
Claude Code on Windows: install, Git Bash, WSL and sandboxing in depthClaude Code on Windows: install, setup and common fixesInstall Claude Code on Windows 11 from PowerShell, CMD or WinGet, pick Git Bash or PowerShell, decide on WSL, and fix PATH, proxy and duplicate-install errors.
AI coding subscription comparison: Claude plans next to ChatGPT, Copilot and othersAI coding subscription comparison: which plan works whereAI coding subscription comparison: ChatGPT, Claude, Copilot, Cursor, Google, GLM, Kimi, MiniMax and OpenCode Go, the tools each plan works in and how limits work.
AWS Bedrock: Claude billed to your cloud accountAWS Bedrock coding agent: Claude Code, Codex, OpenCodeRun an AWS Bedrock coding agent: setup for Claude Code, Codex CLI and OpenCode, the IAM permissions and model access it needs, and AccessDenied fixes.
Vertex AI: Claude billed to your cloud accountVertex AI coding agent: Claude Code, Codex, OpenCode setupRun a Vertex AI coding agent on your Google Cloud project: Claude Code, Codex CLI and OpenCode setup, the roles you need, global vs regional, and 403 fixes.
OpenRouter: one key for many model makersOpenRouter coding agent: Claude Code, Codex, OpenCode setupUse OpenRouter with a coding agent: setup for Claude Code, Codex CLI and OpenCode, a capped API key, models that call tools well, and 401 and 402 fixes.
How to choose a model for codingHow to compare AI coding models on your own codebaseCompare AI coding models on five tasks from your repository. Score each run on passing tests, unnecessary edits, elapsed time and cost per finished task.
AI coding costs: why agents use so many tokensAI coding costs: why agents burn tokens and how to cut itAI coding costs explained: why one agent session can send hundreds of millions of tokens, what sessions really cost, and the habits that cut the bill.
Keep secrets away from AI agentsHow to keep secrets away from AI agents (and out of git)How to keep secrets away from AI agents: block .env reads in Claude Code, OpenCode and Codex, stop keys leaking through commands, and what to do if one leaked.
ChatGPT subscriptionUse your ChatGPT subscription for a coding agent | ContenoxUse your ChatGPT subscription for a coding agent. Set up device sign-in in Contenox or use Codex on desktop, in an editor or in the terminal. Check plan limits.
GitHub Copilot subscriptionUse your GitHub Copilot subscription in other coding agentsUse your GitHub Copilot subscription outside VS Code: sign-in steps for OpenCode, Codex and Contenox Harness, which plans you need, and how AI Credits are billed.
GeminiGemini coding agent: API key, free tier and setup | ContenoxSet up a Gemini coding agent: AI Studio key in OpenCode, Antigravity CLI or Contenox Harness, why Claude Code and Codex can't, free-tier data use, models and 429 fixes.
DeepSeekDeepSeek coding agent: API key, models and setup | ContenoxSet up a DeepSeek coding agent: DeepSeek Harness, or your API key in OpenCode, Codex CLI, Claude Code or Contenox Harness, plus models, errors and where your code goes.