Using Ling in Claude Code
Claude Code is the official AI coding tool from Anthropic. Ant Ling provides an Anthropic compatible interface, so you can use Ant Ling models in Claude Code with just a few configuration steps.
What You Need
- Create API Key
- Install Claude Code
Configuration
Claude Code uses environment variables to specify the Anthropic compatible endpoint and API key. You can also map all of Claude Code’s internal Opus / Sonnet / Haiku tiers to the same Ling model to prevent it from falling back to Anthropic’s own model IDs.
Configure the API Endpoint and Key
| Environment Variable | Value |
|---|---|
| ANTHROPIC_BASE_URL | https://api.ant-ling.com/anthropic |
| ANTHROPIC_API_KEY | Your Ling API Key |
Configure Model Mapping
The following variables map the default model and each tier to a Ling model ID. The example uses Ling-2.6-flash — change it to Ling-2.6-1T, Ling-2.5-1T, or Ring-1T as needed.
| Environment Variable | Example Value |
|---|---|
| ANTHROPIC_MODEL | Ling-2.6-flash |
| ANTHROPIC_DEFAULT_OPUS_MODEL | Ling-2.6-flash |
| ANTHROPIC_DEFAULT_SONNET_MODEL | Ling-2.6-flash |
| ANTHROPIC_DEFAULT_HAIKU_MODEL | Ling-2.6-flash |
Managing Config with .env
If you prefer to manage configuration per project, create a .env file in your project root. Claude Code automatically reads the .env file in the current directory on startup.
# .env (do not commit to version control)
ANTHROPIC_BASE_URL=https://api.ant-ling.com/anthropic
ANTHROPIC_API_KEY=<YOUR_API_KEY>
ANTHROPIC_MODEL=Ling-2.6-flash
ANTHROPIC_DEFAULT_OPUS_MODEL=Ling-2.6-flash
ANTHROPIC_DEFAULT_SONNET_MODEL=Ling-2.6-flash
ANTHROPIC_DEFAULT_HAIKU_MODEL=Ling-2.6-flashThe .env file contains your API Key. Never commit it to version control. Add .env to your .gitignore.
Quick Start
Temporary (current session)
export ANTHROPIC_BASE_URL=https://api.ant-ling.com/anthropic
export ANTHROPIC_AUTH_TOKEN=<YOUR_API_KEY>Specify the Ling model using the --model flag, for example:
# Use Ling-2.6-flash (general conversation, fast)
claude --model Ling-2.6-flash
# Use Ling-2.6-1T (complex reasoning, code debugging)
claude --model Ling-2.6-1TUsage Example
# Set environment variables
export ANTHROPIC_BASE_URL="https://api.ant-ling.com/anthropic"
export ANTHROPIC_API_KEY="<YOUR_API_KEY>"
# Run a one-off task in non-interactive mode
claude -p "Explain what this Go code does" --model Ling-2.6-flash
# Start an interactive session in your current project
cd /your/project
claude --model Ling-2.6-flashFAQ
AuthenticationError / 401 Error
- Confirm
ANTHROPIC_API_KEYis set to your Ling API Key (not an Anthropic key) - Confirm
ANTHROPIC_BASE_URLhas no trailing path — the correct value ishttps://api.ant-ling.com/anthropic - Verify your API Key is valid in the API Console
Model Name Not Recognized
Ling model names are case-sensitive. Make sure you use the exact names: Ling-2.6-1T, Ling-2.6-flash, Ling-2.5-1T, Ring-1T, etc.
How Do I Verify I’m Using the Ling Backend?
claude -p "Which model are you?" --model Ling-2.6-flashA Ling model will introduce itself as part of Ant Ling’s Ling series, not as Claude.