Aider can connect to a model provider that exposes an OpenAI-compatible API. You need three values from that provider: its API base URL, your API key and the exact model ID. The openai/ prefix in Aider selects its OpenAI-compatible adapter; it does not change the provider's model ID.
Copy the base URL from the provider's current API docs. It often ends in /v1, but provider paths vary. Do not add /chat/completions unless the provider specifically documents that as the base.
Install Aider
Aider's official install instructions use the aider-install package:
python -m pip install aider-install
aider-installOpen a terminal in the Git repository you want Aider to work with, then set the API details for that terminal session.
Set the endpoint and key
macOS or Linux
export OPENAI_API_BASE="https://api.example.com/v1"
read -s OPENAI_API_KEY
export OPENAI_API_KEYWindows PowerShell
$env:OPENAI_API_BASE = "https://api.example.com/v1"
$secret = Read-Host "Provider API key" -AsSecureString
$env:OPENAI_API_KEY = (New-Object System.Net.NetworkCredential("", $secret)).Password
Remove-Variable secretReplace the example URL with the provider's documented base. On macOS or Linux, paste the key after read -s and press Enter; the terminal hides it. PowerShell uses a hidden prompt. These environment variables apply to the current shell session; open a new terminal and set them again when needed.
Start Aider with the exact model
aider --model openai/provider-model-idReplace provider-model-id with the exact ID in the provider's API documentation or account. For example, if the provider says its model ID is model-name, pass it as openai/model-name. If the ID itself contains a slash, keep that part after Aider's openai/ prefix.
ChinaGenAI connection values
If you want to try this site's automatic route, use these settings. Availability is read from the current service configuration; it does not mean an Aider session or live model request has been tested.
| Aider setting | Value |
|---|---|
| API base URL | https://chinagenai.com/v1 |
| API key | Your ChinaGenAI site key from API access |
| Model argument | openai/free |
| Chat route | POST https://chinagenai.com/v1/chat/completions |
Limited free API access is available. Daily and per-key concurrency limits apply. Current limits: 6,000 input characters, 256 output tokens, 20 attempts per network or verified account per UTC day, 200 attempts across the site per UTC day, up to 1 concurrent request per key and 2 across the site, and 48-hour site keys. Recheck live API status before using a key.
Aider may include repository context that exceeds the input cap, and 256 output tokens is too short for many code edits. Treat this route as a very short text-only check, not a full coding-agent setup. Do not issue a time-limited site key until you are ready to send a request.
Keep a key in a local Aider env file
Aider can read a .env from your home directory, Git repository root, current directory or a file you select with --env-file. A home-level file keeps the key outside the repository:
AIDER_OPENAI_API_BASE=https://api.example.com/v1
AIDER_OPENAI_API_KEY=YOUR_API_KEYSave those lines in a private file outside the project and start Aider with aider --env-file /path/to/aider.env --model openai/provider-model-id. If you choose a repository-level .env, add it to .gitignore before saving a real key and verify it is not tracked.
Read the first error at the right layer
- 401 or unauthorized: check that the key belongs to the selected provider, is active and has access to the requested model.
- 404 or route not found: compare the base URL with the provider's docs. Check whether the client or provider appends
/v1or the chat route automatically. - Model not found: copy the provider's API model ID exactly. The provider's display name can differ from the ID expected in requests.
- Unknown-model warning: Aider may not know the model's context size or token cost and uses defaults that assume the model is free. Check the provider's current billing page before sending a request; the warning itself does not test connectivity.
- 400 or unsupported parameter: check the provider error body and its supported Chat Completions fields. OpenAI-compatible endpoints can differ in optional parameters and tool behavior.
For another CLI coding assistant, compare the OpenCode and Continue setup guides. To inspect a response you already received, use the local response checker; it does not send a model request.
Official Aider references
- Aider: OpenAI-compatible APIs — installation, endpoint environment variables and model prefix.
- Aider: configuration with .env — supported file locations and environment variable names.
- Aider: options reference — model, API base, key and env-file options.
- Aider: model warnings — unknown-model context and cost metadata.
Aider documentation checked 21 October 2026. This guide explains the documented configuration only; no Aider session or provider inference request was run.
Free API access and limits
Check the site free API access and limits before trying to obtain a site key. Read the current status and request limits before using a site key. It is not a source of official provider keys.
ChinaGenAI is not affiliated with the providers named here. This release contains setup guidance and explicitly labeled fictional examples, not claimed live model benchmarks.