How aider connects to an OpenAI-compatible API
aider connects to an OpenAI-compatible API through LiteLLM, which reads the prefix on the model name to pick the transport: openai/ selects the OpenAI-compatible one. aider itself is AI pair programming in your terminal: you describe a change, and it edits the files in your git repo and commits each edit by default. To use a Lyceum model in aider, run aider on Python 3.12, set OPENAI_API_BASE to our OpenAI-compatible base URL and OPENAI_API_KEY to your Lyceum API key, then start it with --model openai/ followed by the Lyceum model id, for example openai/z-ai/glm-5.2.
Our serverless inference is a good fit for aider because it is one such endpoint: we serve open models such as GLM-5.2, DeepSeek-V4-Flash-0731 and Kimi-K2.7-Code through one OpenAI-compatible API, billed per token with no base fee, so the hours between coding sessions cost nothing. Our API also works with Claude Code, OpenCode, Cline, Roo Code, Kilo Code, goose and Pi. For an application that already calls the OpenAI SDK, the same switch is covered in switching the OpenAI SDK to an open model.
- Python 3.12, or an installer that brings its own: uv or aider-install. Python 3.13 does not work yet; the next section covers why.
- An API key from the Lyceum dashboard.
- A git repository to work in, because aider commits its edits by default.
This guide shows how to run aider against an open model on our serverless inference, without the Python 3.13 install trap.
How to install aider on Python 3.12, not 3.13
Install aider on Python 3.12: it does not yet run on Python 3.13, where the install fails with ModuleNotFoundError: No module named 'pyaudioop'. The cause is in the Python 3.13 release notes: audioop is one of 19 legacy modules removed from the standard library under PEP 594.
Use uv. It installs a separate Python 3.12 for aider if your system does not have one, and the 3.13 trap disappears:
uv tool install --python 3.12 aider-chat| Install route | Host Python it needs | Installs Python 3.12 itself |
|---|---|---|
| uv tool install | No existing Python required | Yes, if needed |
| aider-install | 3.8 to 3.13 | Yes, if needed |
| pipx | 3.9 to 3.12 | No |
| pip | 3.9 to 3.12 | No |
aider's own installer works the same way: it puts aider in its own Python environment and adds a separate Python 3.12 if needed, according to aider's install documentation:
python -m pip install aider-install
aider-installpip and pipx installs need Python 3.9 to 3.12 already present. If you use pip, install into a virtual environment so aider's dependencies stay out of your project's.
How to point aider at the Lyceum OpenAI-compatible endpoint
Point aider at our endpoint with 2 environment variables and one model flag: OPENAI_API_BASE takes the base URL shown in your Lyceum dashboard, OPENAI_API_KEY takes your Lyceum API key, and --model takes openai/ plus the Lyceum model id. The endpoint is well suited to proprietary code because it is sovereign European AI inference: our GPUs run in European data centres, and prompts and outputs are processed, not stored, and never used for training. From your repository, in a macOS or Linux shell:
export OPENAI_API_BASE=https://api.lyceum.technology/openai/v1
export OPENAI_API_KEY="your-lyceum-api-key"
cd /to/your/project
aider --model openai/z-ai/glm-5.2The openai/ prefix tells LiteLLM to use its OpenAI-compatible transport. Write openai/z-ai/glm-5.2, not z-ai/glm-5.2: the prefix is routing information for aider, not part of the Lyceum model id. aider's documentation on OpenAI-compatible APIs uses the same two environment variables and the same openai/ prefix for any such endpoint.
GLM-5.2 is the model used throughout this guide. Its list prices as of 9 October 2026, from GLM-5.2's model page: $1.50 per 1M input tokens, $0.38 per 1M cached input tokens and $4.50 per 1M output tokens, with a 1M token context window. We recommend it for long agentic coding tasks, because its 1M token context window leaves room for many files and a long session history. There is no base fee: you pay per token, and repeated prompt starts still in GPU memory bill at the cached input price.
How to set the model in the aider config file (.aider.conf.yml)
Set the model in .aider.conf.yml to keep the setup after the shell session ends: set openai-api-base and model there, and supply OPENAI_API_KEY through your shell environment. aider looks for this file in your home directory, the root of your git repo and the current directory, in that order, and files loaded last take priority. A key in the repo-root file therefore overrides the same key in your home directory.
openai-api-base: https://api.lyceum.technology/openai/v1
model: openai/z-ai/glm-5.2How to use a cheaper editor model in aider architect mode
A cheaper editor model only takes effect in aider's architect mode: the main model proposes the change, and the editor model turns that proposal into file edits. aider starts in code mode, so add --architect. --editor-model then points the editor role at a cheaper model while the main model plans:
aider --architect --model openai/z-ai/glm-5.2 --editor-model openai/deepseek/deepseek-v4-flash-0731The price gap between the two roles is the point. Our list prices as of 9 October 2026, from our model list:
| Model | Input per 1M tokens | Cached input per 1M | Output per 1M tokens | Context window |
|---|---|---|---|---|
| GLM-5.2 model | $1.50 | $0.38 | $4.50 | 1M tokens |
| DeepSeek-V4-Flash-0731 model | $0.25 | $0.06 | $0.30 | 1M tokens |
| Kimi-K2.7-Code model | $1.25 | $0.31 | $4.50 | 256K tokens |
On these list prices, DeepSeek-V4-Flash-0731 costs 6 times less per input token and 15 times less per output token than GLM-5.2. Architect mode sends two requests per change, which aider's documentation says can increase costs, so the split pays off only when the editor's tokens are a large share of a session: check it against your own usage in the dashboard. DeepSeek-V4-Flash-0731 is tuned for agentic coding and tool use; Kimi-K2.7-Code is a coding model for long software engineering tasks.
Common aider errors with custom models and how to fix them
Four problems are worth knowing before a first session with a custom OpenAI-compatible endpoint: a missing openai/ prefix, aider's unknown-model warning, a cost count that is not the bill, and a 429 error.
- Missing openai/ prefix. Without the prefix, LiteLLM does not know to use its OpenAI-compatible transport for the Lyceum endpoint. The model id stays z-ai/glm-5.2; the prefix goes in front of it.
- Unknown-model warning. For a model aider does not know, it prints "Unknown context window size and costs, using sane defaults", then uses an unlimited context window and assumes a zero cost. aider's model warnings page says this is not usually a significant problem.
- Cost mismatch. Because aider assumes a zero cost, its own token and cost count is not the bill. Billed usage is in the Lyceum dashboard.
- 429 Too Many Requests. This means more requests were sent than the current limit allows, or the model is under heavy load. Wait and retry, ideally with exponential backoff. If it keeps happening, contact us about your limits or a dedicated endpoint.
How to check your first aider edit on a git branch
Check aider's first edit on a new git branch: aider commits its edits to git by default, and it commits any uncommitted changes first. A branch keeps the whole session reviewable, or droppable, in one move. Inside aider, /diff shows the changes since your last message and /undo discards the last change.
For scripts and CI, aider makes a one-shot edit with --message, which sends a single message, processes the reply and exits:
aider --model openai/z-ai/glm-5.2 --yes-always --message "Add type hints to utils.py"--yes-always answers every confirmation with yes, and aider still commits the change, so run it on a branch too and inspect the commit before merging.
aider is one of several coding tools that can use our models. Cline, Cursor, Zed and OpenCode take the same OpenAI-compatible base URL and key; Claude Code uses our Anthropic-compatible endpoint instead, set via ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. Our setup guide for each:
- Lyceum models in Cline
- Lyceum models in Cursor
- Lyceum models in Zed
- Lyceum models in OpenCode
- The Lyceum API in Claude Code
Create an API key in the Lyceum dashboard and run aider on a branch of your own repository.