Skip to main content
Claude Code reads Anthropic-related configuration. When connecting to 4096bytes, do not paste an OpenAI compatible URL into unrelated fields and do not manually append /v1/messages. Use the Claude Code settings shown in the dashboard.
Prefer managing the Claude Code Provider with CC Switch. It lets you switch between 4096bytes, official Claude, and other Providers without repeatedly editing environment variables.

Prerequisites

  • You have completed Create an account.
  • You have completed Get an API Key.
  • Claude Code is installed and claude can start.
  • You have copied the Claude Code configuration from the dashboard.
If you use both an official Claude subscription and a 4096bytes API Key, keep them in separate terminal profiles or CC Switch profiles to avoid environment variable conflicts.

Install

If Claude Code is not installed, follow the official Claude Code setup documentation. macOS, Linux, or WSL:
Windows with WinGet:
If you use npm for global CLI tools:
After installation, reopen the terminal and verify:

Copy config from the dashboard

1

Open API Keys

Open the dashboard and go to API Keys.
2

Find the target key

Create a dedicated key for Claude Code, such as claude-code-work or claude-code-mac.
3

Open Use key

Click Use key in that key row. If the dashboard offers client options, choose Claude Code.
4

Choose your system

Select macOS / Linux, Windows PowerShell, or Windows CMD, then copy the command shown in the dashboard.
Copy config The dashboard command includes the current API Key. The examples below use YOUR_4096BYTES_API_KEY as a placeholder.

Temporary environment variables

Use this method for a quick test. The variables disappear when you close the terminal.

macOS or Linux

If your Claude Code version requires ANTHROPIC_API_KEY, use this instead:
Do not set both ANTHROPIC_AUTH_TOKEN and ANTHROPIC_API_KEY. Prefer the variable name shown in the dashboard.

Windows PowerShell

If the dashboard uses ANTHROPIC_API_KEY, replace the second line with:

Windows CMD

If the dashboard uses ANTHROPIC_API_KEY, replace the second line with:

Persist in Claude Code settings

For long-term use, write the environment variables into the Claude Code settings file.
A common path is ~/.claude/settings.json. Save the file and restart Claude Code.
Do not put API Keys in project .env files, README files, screenshots, or shared documents. Claude Code reads the current terminal environment, so also avoid exposing keys in logs and screenshots.

Persist in shell config

You can also write the variables into ~/.zshrc or ~/.bashrc.
Then reload the shell:
For Bash:
Run:

Specify a model

If Claude Code needs an explicit model, use the model name shown for Claude Code or Claude compatible access in the dashboard.
The model name must match the dashboard exactly.

Notes

  • Use the root Base URL shown in the dashboard, for example https://api.4096bytes.com. Do not append /v1/messages.
  • After switching Providers, reopen the terminal or confirm the environment variables are updated.
  • If you use CC Switch, confirm the active profile is 4096bytes.
  • If you run Claude Code inside VS Code Terminal, reopen VS Code after changing environment variables.

Troubleshooting