Get API Key Get API
Docs

Using OpenVeer in Claude Code

A detailed guide on configuring and using OpenVeer API services in Claude Code CLI, enabling you to access multiple AI models for assisted programming with simple configuration.

Prerequisites

Claude Code is a command-line AI programming assistant by Anthropic that supports direct AI conversation, code generation, and debugging in the terminal.
By connecting to OpenVeer, you can use multiple models including GPT, Claude, and Gemini within Claude Code.

Before you begin, make sure you have:

  1. Obtained an OpenVeer API Key
    Log in to the OpenVeer Console to get your API key (starts with sk-)
Note

If you don't have an OpenVeer account yet, please register at OpenVeer first and obtain your API key.

Step 1: Install Claude Code

Choose any of the following methods to install:

Install with the official script:

curl -fsSL https://claude.ai/install.sh | bash

Or install via Homebrew:

brew install --cask claude-code
Note

If you encounter permission issues, add sudo before the command.

Windows

PowerShell:

irm https://claude.ai/install.ps1 | iex

CMD:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

NPM Install

If you have Node.js 18 or newer installed, you can install via npm:

npm install -g @anthropic-ai/claude-code

Works on all operating systems.

Verify Installation

After installation, run the following command to confirm:

claude --version

If a version number is displayed (e.g., 1.x.x), the installation was successful.

Step 2: Configure OpenVeer API

Three configuration methods are available. Choose the one that suits your workflow.

The most stable approach — configure once and it persists.

1. Locate the configuration directory:

  • Windows: Press Win + R, enter %userprofile%\.claude
  • macOS: Press Command + Shift + G, enter ~/.claude
  • Linux: Navigate to ~/.claude
Note

If the directory doesn't exist, run claude once in the terminal and press Ctrl + C to exit — the directory will be created automatically.

2. Create or edit the settings.json file:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.openveer.com",
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxxxxxxxx",
    "ANTHROPIC_MODEL": "claude-opus-5",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
Parameter Description
ANTHROPIC_BASE_URL OpenVeer API address, fixed as https://api.openveer.com
ANTHROPIC_AUTH_TOKEN Your OpenVeer API key (starts with sk-)
ANTHROPIC_MODEL Default model to use, choose from the model list below
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC Set to 1 to reduce non-essential network requests

Save the file and restart Claude Code to apply.

Method 2: Permanent Environment Variables

Write configuration to system environment so all terminal windows load it automatically.

macOS (zsh)

echo 'export ANTHROPIC_BASE_URL="https://api.openveer.com"' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY="sk-xxxxxxxxxxxx"' >> ~/.zshrc
echo 'export ANTHROPIC_MODEL="claude-opus-5"' >> ~/.zshrc
source ~/.zshrc

macOS / Linux (bash)

echo 'export ANTHROPIC_BASE_URL="https://api.openveer.com"' >> ~/.bashrc
echo 'export ANTHROPIC_API_KEY="sk-xxxxxxxxxxxx"' >> ~/.bashrc
echo 'export ANTHROPIC_MODEL="claude-opus-5"' >> ~/.bashrc
source ~/.bashrc

Windows

Option A: GUI Settings

  1. Right-click "This PC" → "Properties" → "Advanced system settings" → "Environment Variables"
  2. Add new user variables:
    * ANTHROPIC_BASE_URL = https://api.openveer.com
    * ANTHROPIC_API_KEY = sk-xxxxxxxxxxxx
    * ANTHROPIC_MODEL = claude-opus-5
  3. Restart the terminal

Option B: PowerShell Commands

[System.Environment]::SetEnvironmentVariable('ANTHROPIC_BASE_URL', 'https://api.openveer.com', 'User')
[System.Environment]::SetEnvironmentVariable('ANTHROPIC_API_KEY', 'sk-xxxxxxxxxxxx', 'User')
[System.Environment]::SetEnvironmentVariable('ANTHROPIC_MODEL', 'claude-opus-5', 'User')

Method 3: Temporary Environment Variables

Suitable for quick testing — configuration is lost when the terminal is closed.

macOS / Linux

export ANTHROPIC_API_KEY="sk-xxxxxxxxxxxx"
export ANTHROPIC_MODEL="claude-opus-5"
export ANTHROPIC_BASE_URL="https://api.openveer.com"
claude

Windows (PowerShell)

$env:ANTHROPIC_API_KEY="sk-xxxxxxxxxxxx"
$env:ANTHROPIC_MODEL="claude-opus-5"
$env:ANTHROPIC_BASE_URL="https://api.openveer.com"
claude

Windows (CMD)

set ANTHROPIC_API_KEY=sk-xxxxxxxxxxxx
set ANTHROPIC_MODEL=claude-opus-5
set ANTHROPIC_BASE_URL=https://api.openveer.com
claude
Warning

Temporary environment variables only work in the current terminal window. You'll need to set them again after switching windows or closing the terminal.

Step 3: Start Using

Verify Configuration

Launch Claude Code and send a simple message to confirm:

claude "Hello"

If you receive an AI response, the configuration is successful. If you see 401, 403, or other errors, refer to the FAQ below.

Usage Modes

Claude Code offers two interaction modes:

  • Interactive mode: Run claude for continuous conversation, ideal for complex tasks
  • Single command: Run claude "your question" for a one-off response, ideal for quick queries

Supported Models

OpenVeer supports the full Claude model series. You can flexibly switch based on your needs:

Model Name Features Recommended Use
claude-opus-5 Next-generation flagship Complex architecture, difficult debugging
claude-opus-4-6 Strong overall capability Complex architecture, difficult debugging
claude-sonnet-4-6 Balanced performance and speed Daily programming, code generation
claude-opus-4-5-20251101 Advanced reasoning Complex code, deep analysis
claude-sonnet-4-5-20250929 Excellent code capability Algorithm design, code optimization
claude-haiku-4-5-20251001 Ultra-fast response Quick Q\&A, code snippets

All models above support a Thinking (extended reasoning) version — append -thinking to the model ID, e.g., claude-opus-4-6-thinking. Thinking mode is ideal for complex tasks requiring deep reasoning.

Tip

Model Recommendations:

  • 🚀 High Performance: claude-opus-5 — For the most complex code and architecture challenges
  • ⚖️ Balanced Performance: claude-sonnet-4-6 — For daily programming
  • ⚡ Fast Response: claude-haiku-4-5-20251001 — When you need instant feedback
  • 🧠 Deep Thinking: claude-opus-5-thinking — When deep reasoning is needed

To switch models, use the /model command in interactive mode, or modify the ANTHROPIC_MODEL field in your configuration and restart.

Common Commands

Here are frequently used commands and shortcuts in Claude Code:

Command Description
claude Enter interactive mode
claude "question" Single query
claude --version Check version
/model Switch model in interactive mode
/help View help information
Ctrl + C Exit interactive mode

FAQ

Q1: Still seeing the login selection page after configuration?

If "Select login method" still appears after startup, the configuration hasn't taken effect.

Troubleshooting steps:

  1. Using settings.json: Check if the file path is correct
    * Windows: C:\Users\<username>\.claude\settings.json
    * macOS / Linux: ~/.claude/settings.json
  2. Using environment variables: Make sure you launched Claude Code from the same terminal window where you set the variables
  3. Check JSON format: Ensure brackets, commas, and quotes are all correct

Q2: Getting 401 / 403 errors?

Error Code Meaning Solution
401 Unauthorized API key missing or invalid Check if the key is correct and starts with sk-
403 Forbidden Insufficient permissions or expired key Go to Console to verify key status

Also ensure ANTHROPIC_BASE_URL is set to https://api.openveer.com, not the official Anthropic address.

Q3: "Unable to connect" error?

This means Claude Code failed to connect to the API service.

  1. Check your network connection
  2. Verify ANTHROPIC_BASE_URL is configured correctly
  3. If using a proxy, ensure it allows access to api.openveer.com

Q4: "Auth conflict" error?

If you see a message like:

Auth conflict: Both a token (claude.ai) and an API key (ANTHROPIC_API_KEY) are set.

This means you're logged into claude.ai and have an API Key set at the same time, causing a conflict.

Solution: Run /logout in Claude Code interactive mode to sign out of claude.ai, keeping only the API Key configuration.

Q5: max_tokens error when using non-Claude models?

If you see an error like:

max_tokens is too large: 32000. This model supports at most 16384 completion tokens.

This is because Claude Code sends requests with Claude model parameters by default (32000 tokens), while some non-Claude models (e.g., gpt-4o) have lower token limits.

Solution: Switch to a Claude model (e.g., claude-sonnet-4-6), which is natively compatible with Claude Code and won't cause this issue.

Q6: Slow response?

  1. Switch to a faster model (e.g., claude-haiku-4-5-20251001 or claude-sonnet-4-6)
  2. Shorten your prompts to reduce context length
  3. Check your network conditions

Q7: How to switch models?

Two ways:

  1. In interactive mode: Enter the /model command
  2. Edit configuration: Change the ANTHROPIC_MODEL field in settings.json or environment variables, then restart Claude Code

Q8: Does Claude Code automatically read local files?

No. Claude Code requires you to explicitly reference files, and it will ask for confirmation before performing sensitive operations. It's recommended to use it in dedicated project directories.

Q9: How to analyze local files with Claude Code?

In interactive mode, you can reference files by:

  • Entering the file path directly
  • Dragging files into the terminal window
  • Copy-pasting file content

Q10: How to check usage and costs?

Log in to the OpenVeer Console to view:

  • API call statistics
  • Token consumption details
  • Cost statistics and trends

Support

If you encounter any issues:


Get Started with OpenVeer

Sign up for OpenVeer now, get your API key, and experience multi-model programming assistant in Claude Code!

This documentation is built and hosted on Mintlify, a developer documentation platform.