---
title: Use the Claude API with Aider
description: "Run Aider on Claude through apiToken.sale: export ANTHROPIC_API_BASE and your key, pick a Claude model, and pair-program in the terminal at 60–80% off."
url: https://apitoken.sale/docs/learn/claude-api-aider
language: en
---

# Use the Claude API with Aider

Aider is a terminal pair-programmer that burns tokens fast on long sessions. Point it at the discounted gateway with two environment variables and keep the exact same workflow.

## Two environment variables

```
export ANTHROPIC_API_KEY=sk-pool-•••
export ANTHROPIC_API_BASE=https://api.apitoken.sale

aider --model anthropic/claude-opus-4-8
```

Aider routes Anthropic traffic through LiteLLM under the hood, which honours ANTHROPIC_API_BASE — so no config file is required.

## Picking a model for Aider

- anthropic/claude-opus-4-8 — hardest refactors and long agentic edits.
- anthropic/claude-sonnet-5 — the everyday default; near-Opus coding quality.
- anthropic/claude-haiku-4-5 — quick edits and cheap experimentation.

Long Aider sessions are exactly where the token discount compounds: repo maps, diffs and multi-file edits all bill as input and output tokens.

## Frequently asked questions

### Does Aider work with a custom Claude endpoint?

Yes. Aider uses LiteLLM for Anthropic models, and LiteLLM honours the ANTHROPIC_API_BASE environment variable — set it to https://api.apitoken.sale and start Aider normally.

### Which Claude model is best in Aider?

claude-sonnet-5 is the best default for most coding; switch to claude-opus-4-8 for the hardest multi-file work. Both run on the same key.

### How much cheaper is a long Aider session?

Every request is billed at official token rates minus your 60–80% discount, so a session that would cost $10 direct costs $2–4 here.

---
Get a key: https://apitoken.sale/register
More guides: https://apitoken.sale/docs/learn
