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.2The 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.
Available models
| Model ID | Aider model string | Input (€/1M) | Output (€/1M) | Context |
|---|---|---|---|---|
glm-5.2 | openai/glm-5.2 | €1.32 | €4.62 | 1M |
minimax-m2.5 | openai/minimax-m2.5 | €0.17 | €0.99 | 200k |
kimi-k2.6 | openai/kimi-k2.6 | €0.83 | €3.85 | 256k |
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.2Keep 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.2": {
"max_input_tokens": 1000000,
"max_output_tokens": 131072,
"input_cost_per_token": 0.00000132,
"output_cost_per_token": 0.00000462,
"litellm_provider": "openai",
"mode": "chat"
},
"openai/minimax-m2.5": {
"max_input_tokens": 200000,
"input_cost_per_token": 0.00000017,
"output_cost_per_token": 0.00000099,
"litellm_provider": "openai",
"mode": "chat"
},
"openai/kimi-k2.6": {
"max_input_tokens": 256000,
"input_cost_per_token": 0.00000083,
"output_cost_per_token": 0.00000385,
"litellm_provider": "openai",
"mode": "chat"
}
}Costs are per single token (price per million ÷ 1,000,000). max_output_tokens
is only set for glm-5.2 (131,072 confirmed); add it for the other models once
known.
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.2
edit_format: diff
use_repo_map: true
- name: openai/kimi-k2.6
edit_format: diff
use_repo_map: true
- name: openai/minimax-m2.5
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 |