Claude Code

This guide explains how to configure Claude Code to work with Claude models available through AIML API.

Overview

Claude Code is a powerful coding agent by Anthropic that can analyze codebases, generate code, and assist with development workflows. By pointing it to AIML API, you can use Claude models available on our platform without connecting directly to Anthropic.

Prerequisites


1

Step 1 — Install Claude Code

Install the CLI globally:

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

Verify installation:

claude --version
2

Step 2 — Configure AIML API

Claude Code uses Anthropic-compatible environment variables. You need to override them to point to AIML API.

Set API Key

export ANTHROPIC_API_KEY=<YOUR_AIMLAPI_KEY>

Set Base URL

export ANTHROPIC_BASE_URL=https://api.aimlapi.com
3

Step 3 — Select a Model

Claude Code requires a model name. Use any Claude model available on AIML API:

export ANTHROPIC_MODEL=claude-haiku-4-5
4

Step 4 — Run Claude Code

Navigate to your project and start the agent:

cd your-project
claude

Usage Examples

Ask about your codebase

claude "Explain the architecture of this project"

Refactor code

Generate new functionality

How It Works

Claude Code communicates using the Anthropic API format. AIML API provides a compatible interface, so no changes to request structure are required.

All requests are routed through:

Using CLAUDE.md files

CLAUDE.md is a markdown file placed in your project root that Claude Code automatically reads at the beginning of each session. It can be used to define coding conventions, architectural guidelines, preferred libraries, workflows, and review requirements.

Usage & Cost Monitoring

If you need to monitor usage and costs separately, you can create a dedicated API key for Claude Code usage in your Account. After that, you can view token usage details and corresponding USD costs in the dashboard under the Usage section.

For details, see the API keys and Usage sections in the Starter Guide.


Troubleshooting

Claude command not found

Make sure the package is installed globally:

Authentication error

Check your API key:

Model not available

Ensure that you:

Connection issues

Verify the base URL:

Expected:

Summary

By configuring Claude Code to use AIML API, you can:

  • Run Claude models via a unified API

  • Integrate coding agents into your workflow

  • Avoid direct dependency on Anthropic infrastructure

Last updated

Was this helpful?