contenox

Claude coding agent on Windows: API key setup

Updated · Facts checked

MODEL PROVIDERSAnthropic (Claude)

You can run a Claude coding agent on Windows with Anthropic’s Claude Code, which runs in a terminal (natively in PowerShell), in a desktop app, in IDE extensions and on the web, and signs in with a Claude Pro, Max or Ultra plan or an Anthropic API key. Contenox can run Claude Code inside the app, signed in with your own plan. OpenCode takes an API key, and Max, Ultra and Team plans now include monthly API credits to pay for it. Codex CLI can’t use Claude.

Use Claude with your agent

Agent Supported? How Note
Claude Code Yes claude, then sign in in the browser; or set ANTHROPIC_API_KEY Anthropic’s own agent.
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 Yes, plan or API key Run Claude Code as an agent in Contenox, signed in with your plan; or Backends → Providers → Anthropic with a key Contenox runs Anthropic’s own Claude Code, so your plan works.

Can I use my Claude Pro or Max subscription?

Yes, in three ways, and one way you shouldn’t:

  • In Claude Code. Sign in with your plan. Usage counts against the plan’s limits.
  • In an app that runs Claude Code for you. Anthropic’s terms allow you to sign in to the unmodified Claude Code program with your own plan, also when another platform hosts it. That is how Contenox does it: it runs Claude Code as one of its agents, and Claude Code signs in with your account.
  • 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

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

Install it. On Windows, OpenCode recommends WSL; natively, use npm:

npm install -g opencode-ai

macOS or Linux:

curl -fsSL https://opencode.ai/install | bash

Create a key in the Claude Console. Start opencode in your project, type /connect, choose Anthropic and paste the key. Pick a model with /models. The key is saved in ~/.local/share/opencode/auth.json.

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.1 is for the hardest, longest tasks and is slower. 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

Contenox runs on Windows, macOS and Linux and gives you two ways to use Claude.

With your Claude plan. Open Agents in the sidebar and install Claude Code. Contenox sets it up for you (Node.js 22 or newer needs to be on your computer). Then sign in, either with your Claude subscription or with an Anthropic Console account, and start a chat. You chat with Claude Code like with Contenox’s own agent, on your plan’s usage limits.

Contenox 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.
  • Reads are not, on Windows. Claude Code can read any file your Windows account can read; Windows offers no way to restrict what a program reads. Keep secrets out of reach the usual ways, see keep secrets away from AI agents.

With an API key, including one paid by your plan’s monthly API credits:

  1. Open Backends → Providers and, under Recommended, choose Anthropic.
  2. Select Create key, create a key in the Claude Console and copy it.
  3. Paste it into API Key, select Connect and wait for Connected.
  4. 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. Key rejected means a 401; use Replace to paste a new key.

Related

Esc to close