Aider
Configure Aider to call models through TokenHub.
Aider can call TokenHub models through the OpenAI compatible interface. Keep the official installation flow, then replace only the API key, Base URL, and model ID.
The TokenHub endpoint used by this guide is https://us-api.tokenhub.com/v1/chat/completions.
When to use it
Start in a small repository or test project. First ask the tool to read files, explain code, or produce a plan; only then enable edits, terminal commands, or agent automation.
Install or open the tool
Follow the official Aider documentation to install or open the tool. If menus or command names differ, prefer the current official documentation.
For CLI tools, confirm the executable works before adding TokenHub credentials:
aider --versionPrepare TokenHub credentials
Create a TokenHub API key and choose a model from the TokenHub model list that fits this tool.
export TOKENHUB_API_KEY="sk-..."Keep the key in your local shell, IDE secret storage, or the secure API key field of the tool. Do not commit it to the repository.
Configure TokenHub persistently
Use the tool configuration file or settings page first. This avoids the common problem where a terminal sees the environment variable but the IDE, plugin, or new window does not.
Provider values
| Field | Value |
|---|---|
| Provider | OpenAI Compatible or Custom |
| Base URL | https://us-api.tokenhub.com/v1 |
| API Key | The value of TOKENHUB_API_KEY |
| Model | gpt-4.1 or another TokenHub model ID |
Settings file locations
| Field | Value |
|---|---|
| User config | ~/.aider.conf.yml |
| Project config | .aider.conf.yml |
| API key source | OPENAI_API_KEY=$TOKENHUB_API_KEY |
model: openai/gpt-4.1
openai-api-base: __API_BASE_URL__/v1Keep secrets out of project files. Commit only non-secret defaults such as model and Base URL, then let each developer provide the API key locally.
If the tool separates chat, edit, apply, and fast models, use the same TokenHub model for the first test. Split models later by cost, latency, and reasoning strength.
Temporary environment variables for debugging
Use temporary variables only to confirm the key, network, and model name. After validation, move the same values into the persistent configuration above.
export TOKENHUB_API_KEY="sk-..."
export OPENAI_API_KEY="$TOKENHUB_API_KEY"
export OPENAI_API_BASE="__API_BASE_URL__/v1"Verify the connection
Test with a read-only prompt first, confirming that the model can read context without changing files. Then test edits, Apply, or agent tasks.
Read the project README and summarize it in three sentences. Do not modify any files.After a successful prompt, check TokenHub request logs for model name, endpoint, token usage, and billing group.
Troubleshooting
| Symptom | Fix |
|---|---|
| 401 or authentication failure | Confirm TOKENHUB_API_KEY is valid and saved in the same terminal, IDE, or client profile. |
| 404 or model not found | Use a model ID that exists in your TokenHub workspace and matches the selected protocol. |
| Wrong endpoint | Keep the Base URL exactly as shown. OpenAI-compatible tools usually need /v1; Claude-compatible tools usually do not. |
| Request timeout | Check network access to https://us-api.tokenhub.com, proxy settings, and workspace allowlists. |
| Tool uses another model | Recheck every chat, edit, apply, fast, and autocomplete model slot. |
Last updated on