Usage

Claude Code

How to use the Ahur API in Claude Code — the automatic route with the Ahur CLI and the manual route

Using Ahur in Claude Code

Claude Code is a command-line tool from Anthropic that lets you write code with the help of AI. There are two ways to use it with Ahur.

The simplest route — the Ahur CLI installs, configures and launches Claude Code for you:

# install the Ahur CLI
npm install -g ahur-cli

# set your API key
ahur config set api_key ak_your_key_here

# run Claude Code through Ahur
ahur launch claude

The Ahur CLI automatically:

  • Installs Claude Code if it isn't already present
  • Fetches the list of Ahur models and shows them so you can pick one
  • Sets the environment variables and starts Claude Code

Resuming a previous conversation

ahur launch claude --resume sess_abc123

Choosing a specific model

ahur launch claude --model ahur/general

Option 2: manual setup

If you'd rather work with Claude Code directly:

1. Get an API key

  • Go to the API keys section of the developer panel.
  • Create a new key and store it somewhere safe.

2. Install Claude Code

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

3. Set the environment variables

On Linux / macOS:

export ANTHROPIC_BASE_URL="https://api.ahur.ir/v1"
export ANTHROPIC_AUTH_TOKEN="ak_your_key_here"

To make this permanent, add it to ~/.bashrc or ~/.zshrc:

echo 'export ANTHROPIC_BASE_URL="https://api.ahur.ir/v1"' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN="ak_your_key_here"' >> ~/.bashrc
source ~/.bashrc

4. Run it

claude
See the pricing page for the full list of models and prices.

Security notes

  • Never share your API key with anyone
  • Track your consumption and costs in the usage statistics section
  • The ~/.config/ahur/config.json file holds your key — keep it protected

Resources