openai/ prefix.
Prerequisites
- A Token Factory API key. See Authentication.
- Aider installed (this guide was verified with Aider 0.86).
- A model ID from the Token Factory catalog.
1
Store the key and endpoint in your shell
Aider reads the OpenAI-compatible endpoint and key from the environment.Add both lines to your shell profile to make them permanent.
2
Register the model limits
Aider does not read context limits from the endpoint. Without this step it
starts with The cost fields only affect Aider’s local cost display; the published rates
are on the Pricing page.
Warning for openai/zai-org/GLM-5.3: Unknown context window size and costs, using sane defaults. Create .aider.model.metadata.json
in your home directory or the repository root with the Token Factory
models. Use the fully qualified openai/ name.max_output_tokens is a per-response
budget; keep it well below the context window so there is room for input.3
Run Aider
Pass the Token Factory model ID with the Aider uses its To run a single change non-interactively:
openai/ prefix.whole edit format for models it does not know, which
resends entire files on every edit. Both Token Factory models handle the
more economical diff format; pass --edit-format diff or set it in the
config file. To make the model and edit format the default, add them to
.aider.conf.yml in your home directory or the repository root:4
Verify the connection
Aider prints the model name on startup. Ask for a small edit to a file you
added to the chat. Aider shows the model’s reasoning under THINKING,
the diff under ANSWER, applies the edit, and commits it. A completed
edit confirms the endpoint, key, and model ID.
Compatibility notes
- Model IDs. Use
openai/followed by the exactidfromGET /v1/models, for exampleopenai/zai-org/GLM-5.3. IDs are case-sensitive. Do not add acorvex/prefix. - Reasoning. Both models reason before answering. Aider displays the
reasoning separately from the answer. Reasoning tokens count toward
max_output_tokens. - Context length. If a session exceeds the model’s window, the gateway
returns
context_length_exceeded. Drop files from the chat with/dropor start a new session. See Errors. - Input types. Neither model accepts image input. Do not add images with
/pasteor--image; the request returns a structured error.
Related documentation
- Use the OpenAI SDK — the same endpoint from Python or TypeScript.
- Connect OpenCode and Connect Codex — other terminal coding agents.
- Errors — authentication, rate-limit, and validation responses.