What you will set up
This guide walks through installing Claude Code CLI on your machine, creating one AshnaAI API key, pointing Claude Code at the AshnaAI Anthropic-compatible endpoint, and running your first turn. Official install docs: Claude Code quickstart. Cursor uses a different protocol — see How to use the AshnaAI API in Cursor.
Step 1: Install Claude Code CLI
Claude Code is Anthropic’s terminal agent. Install it once per machine, then route requests to AshnaAI with environment variables. The commands below match the official quickstart.
▸ curl -fsSL https://claude.ai/install.sh | bashirm https://claude.ai/install.ps1 | iex▸ curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd▸ claude --version- Open a terminal in the project folder you want to work in.
- Run the install command for your operating system.
- Confirm the install with claude --version.
- Set ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY in Step 3 before your first turn.
Step 2: Create an AshnaAI API key
Do this once. Claude Code sends the secret on every request to AshnaAI.
- Open Account → API.
- Choose Create key and name it Claude Code.
- Copy the secret immediately. It is shown once.
- Keep it out of git, a gist, and a recorded screen.
Step 3: Point Claude Code at AshnaAI
Export both variables in the same shell that will launch Claude Code. Settings reference: Claude Code settings.
▸ export ANTHROPIC_BASE_URL="https://api.ashna.ai/v1/api"▸ export ANTHROPIC_API_KEY="paste-your-key-here"$env:ANTHROPIC_BASE_URL="https://api.ashna.ai/v1/api"//api.ashna.ai/v1/api"$env:ANTHROPIC_API_KEY="paste-your-key-here"▸ set ANTHROPIC_BASE_URL=https://api.ashna.ai/v1/api▸ set ANTHROPIC_API_KEY=paste-your-key-here- Confirm the base URL includes /v1/api. A host-only value is the usual 404.
- If your wrapper reads ANTHROPIC_AUTH_TOKEN instead, set that name to the same secret.
- Add the export lines to ~/.zshrc, ~/.bashrc, or your shell profile to persist them.
Step 4: Pick a model id
Use an alias or a catalog id. You do not change the URL.
- Set the model to sonnet, opus, haiku, or a catalog id when Claude Code asks.
- For Claude-style routing, choose sonnet, opus, or haiku.
- For a catalog model, type glm-5.3-flash or another listed id.
- To list ids from the API, run: curl -H "Authorization: Bearer YOUR_KEY" https://api.ashna.ai/v1/api/models
Step 5: Run your first Claude Code turn
Start the CLI from the shell that has the two environment variables.
▸ cd /path/to/your/project▸ claude- Send one prompt such as explain the folder structure.
- Claude Code posts to /v1/messages on api.ashna.ai.
- If the turn fails with 401, the key is missing or truncated. Repeat Step 2.
- If the turn fails with 404, the base URL dropped /v1/api. Repeat Step 3.
Fields that have to match
Paste these values. A typo on the base URL is the usual failure.
| Field | Value |
|---|---|
| Install (macOS/Linux) | curl -fsSL https://claude.ai/install.sh | bash |
| Install (Windows) | irm https://claude.ai/install.ps1 | iex |
| ANTHROPIC_BASE_URL | https://api.ashna.ai/v1/api |
| ANTHROPIC_API_KEY | Secret from Account → API |
| Messages path | /v1/messages |
| Example aliases | sonnet, opus, haiku |
Try it now
HTTP reference: AshnaAI API docs and chat completions for other clients.
- Install Claude Code with the command for your OS.
- Create a key in Account → API.
- Export ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY, then run one turn.
Mapped to Anthropic’s Claude Code quickstart (install), Claude Code settings for ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY, and the public AshnaAI HTTP API (Account → API keys, POST /v1/api/v1/messages).
Topics
Related
- AshnaAI for Work
- AshnaAI vs ChatGPT
- AshnaAI vs Claude
- Large Language Model (LLM)
- Foundation Model
- how to use the ashna ai api in cursor
- how to use the ashna ai api in vs code
- how to use the ashna ai api in openclaw cline and codex
- how to call any catalog model through the api
- ashna x1 task aware model routing
Try this in AshnaAI. Create a free account.
Found this article insightful?
Share it with fellow builders, founders, and AI practitioners.


