Skip to main content
Corvex Token Factory connects to Aider as an OpenAI-compatible endpoint. Set two environment variables, register the model’s limits in a metadata file, and pass the model ID with the openai/ prefix.

Prerequisites

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 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.
The cost fields only affect Aider’s local cost display; the published rates are on the Pricing page. 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 openai/ prefix.
Aider uses its 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:
To run a single change non-interactively:
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 exact id from GET /v1/models, for example openai/zai-org/GLM-5.3. IDs are case-sensitive. Do not add a corvex/ 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 /drop or start a new session. See Errors.
  • Input types. Neither model accepts image input. Do not add images with /paste or --image; the request returns a structured error.
Last modified on September 28, 2026