Aider
Connect Aider, the terminal AI pair programmer, to GreenPT Code via the openai/ model prefix.
Aider is an open-source AI pair programmer for the
terminal, with tight git integration. It connects to any OpenAI-compatible
endpoint via environment variables — GreenPT works out of the box using the
openai/ model prefix.
Prerequisites
- Aider installed (
python -m pip install aider-install && aider-install) - A GreenPT API key from your GreenPT dashboard
Quick start
export OPENAI_API_BASE=https://api.greenpt.ai/v1
export OPENAI_API_KEY=your-greenpt-key
aider --model openai/glm-5.3The openai/ prefix tells Aider (via LiteLLM) to treat GreenPT as an
OpenAI-compatible endpoint. The part after the prefix must exactly match a model
ID from GreenPT's /v1/models endpoint.
Recommended models
Use openai/glm-5.3 as the default and openai/deepseek-v4.1-flash for quick,
low-cost edits.
glm-5.3z.aiFlagshipThe newest z.ai flagship reasoning model, successor to glm-5.2, with agentic tool-use at the same price.
Use it for: The default: agentic, multi-file work across a large codebase.
deepseek-v4.1-flashDeepSeekDeepSeek V4.1 Flash, a multimodal reasoning model with a 1M-token context window for chat and agentic coding.
Use it for: Routine edits, quick questions and test runs, at a fraction of the cost.
Persistent configuration
Instead of flags and exports, put your defaults in ~/.aider.conf.yml (global)
or .aider.conf.yml in the repo root (project — takes precedence):
openai-api-base: https://api.greenpt.ai/v1
model: openai/glm-5.3Keep the API key out of the YAML file — set it in your shell profile or a .env
file in the repo root:
# .env
OPENAI_API_BASE=https://api.greenpt.ai/v1
OPENAI_API_KEY=your-greenpt-keyModel metadata (context window & pricing)
Aider warns about unknown models because GreenPT's model IDs aren't in LiteLLM's
built-in database. Register them in ~/.aider.model.metadata.json so Aider
knows each model's context window and shows accurate costs in-session:
{
"openai/glm-5.3": {
"max_input_tokens": 1000000,
"input_cost_per_token": 0.0000011,
"output_cost_per_token": 0.0000044,
"litellm_provider": "openai",
"mode": "chat"
},
"openai/deepseek-v4.1-flash": {
"max_input_tokens": 1000000,
"input_cost_per_token": 0.00000022,
"output_cost_per_token": 0.0000011,
"litellm_provider": "openai",
"mode": "chat"
}
}Costs are per single token (price per million ÷ 1,000,000), at the EU rates on
Model Cards. Add max_output_tokens only if you want Aider to
cap replies.
Recommended edit format
For strong coding models like these, Aider's diff edit format is usually the
most token-efficient. Set it per model in ~/.aider.model.settings.yml:
- name: openai/glm-5.3
edit_format: diff
use_repo_map: true
- name: openai/deepseek-v4.1-flash
edit_format: diff
use_repo_map: trueIf a model produces malformed diffs, fall back to edit_format: whole.
Verify the connection
curl https://api.greenpt.ai/v1/models \
-H "Authorization: Bearer $OPENAI_API_KEY"You should get back a list including the model IDs above.
Troubleshooting
| Symptom | Fix |
|---|---|
| "Unknown model" warning | Expected for custom providers — silence it by adding the model to ~/.aider.model.metadata.json as shown above |
| 401 Unauthorized | Confirm OPENAI_API_KEY holds your GreenPT key and is exported in the shell running Aider |
| 404 / model not found | Model string must be openai/ + the exact ID from GreenPT's /v1/models (case-sensitive) |
| Requests going to api.openai.com | OPENAI_API_BASE isn't set in the current shell — re-export it or use the .env / YAML config |
| Malformed edits | Switch that model's edit_format to whole in .aider.model.settings.yml |