Use Xantly with Aider (CLI)

Aider is a terminal pair-programmer with a clever main/editor/weak model split. One --openai-api-base flag points it at Xantly for 60-70% cost savings via role-split routing.

Aider is a terminal-native pair-programming tool, edit files directly from the command line, get a git commit per change. The simplest Xantly integration in the ecosystem: one flag.

Prerequisites

Setup

One flag:

aider \
  --openai-api-base https://api.xantly.com/v1 \
  --openai-api-key xantly_sk_... \
  --model xantly/auto-quality

Or as environment variables (persistent across sessions):

export OPENAI_API_BASE=https://api.xantly.com/v1
export OPENAI_API_KEY=xantly_sk_...
export AIDER_MODEL=xantly/auto-quality
aider

Drop them in ~/.zshrc or .env in your project root.

Model roles

Aider uses three distinct model roles, you can point each at a different Xantly model for maximum cost/quality control:

aider \
  --openai-api-base https://api.xantly.com/v1 \
  --openai-api-key xantly_sk_... \
  --model xantly/auto-quality \           # main, plans edits
  --editor-model xantly/auto-value \       # applies diffs
  --weak-model xantly/auto-speed           # summaries, commit messages

With this split, a typical Aider session costs 60-70% less than running everything on the main model, without losing quality.

Verify

cd any-git-repo
aider --openai-api-base https://api.xantly.com/v1 --openai-api-key xantly_sk_... --model xantly/auto-quality
# inside aider:
> add a README section explaining what this project does

Aider should propose a diff, you approve it, aider applies it and creates a git commit. Check your Xantly dashboard, you'll see the request logged with its cost.

What you get

Gotchas

--openai-api-base must include /v1. Same rule as the OpenAI SDK. Don't use the bare hostname.

Aider supports Anthropic too. If you prefer the Messages API shape, use --anthropic-api-base https://api.xantly.com with ANTHROPIC_API_KEY=... once Xantly's /v1/messages ships (week 2 of the integrations rollout).

.env in project root overrides shell exports. If OPENAI_API_BASE is set in .env to the old value, shell exports won't help. Check .env first.

Next steps