TokenFlux Docs

Aider

Set up Aider with a TokenFlux API key, endpoint and model. Verify the connection and resolve common errors.

Aider connects to TokenFlux through its OpenAI-compatible API settings. Requests are charged to your TokenFlux balance.

This guide was tested with Aider 0.86.2 on Python 3.12 and gpt-6-luna for streaming replies.

Before you start

  1. Start with Aider installed. Configuration details are in the official OpenAI-compatible API guide.
  2. Create and copy a key on the web app’s API keys page. The full key is shown only once.
  3. Check that your balance is above zero on Billing.
  4. Copy a model ID from Models and pricing and check its supported protocols.

Set the endpoint and key

In Bash or Zsh, set the OpenAI-compatible endpoint and key:

export TOKENFLUX_API_KEY="YOUR_TOKENFLUX_KEY"
export OPENAI_API_BASE="https://tokenflux.ai/v1"
export OPENAI_API_KEY="$TOKENFLUX_API_KEY"

Replace YOUR_TOKENFLUX_KEY with the key you copied. Keep the key out of Git.

Aider sends requests to /v1/chat/completions. Keep these variables in the terminal that starts Aider.

Choose a model

Use a model ID from the TokenFlux catalog, with the openai/ adapter prefix: aider --model openai/YOUR_MODEL_ID. If the catalog ID itself contains /, keep it after the adapter prefix. For example, a catalog ID of openai/gpt-6-luna becomes openai/openai/gpt-6-luna in Aider.

Verify the connection

Run these commands in a scratch directory. If the client asks for file access, check the path before you approve it.

printf 'TOKENFLUX_GUIDE_OK\n' > marker.txt
aider --model openai/YOUR_MODEL_ID --no-git \
  --message "Read marker.txt and return its contents without changes" marker.txt

The reply should contain TOKENFLUX_GUIDE_OK. Check the model, key, token count and cost on Usage. Delete marker.txt after the test.

Troubleshooting

Aider uses another provider. Keep the openai/ adapter prefix and check OPENAI_API_BASE in the same terminal.

Unknown model or context-window warning. Aider may not have metadata for a gateway model. Check the exact catalog ID and the model limits before continuing; the warning alone does not prove an API failure.

Installation tries to compile SciPy. Use a supported Python version with binary wheels. This guide was tested with Python 3.12.

401, 429 or a model error. Check that the key is enabled, the full model ID is correct, and your account has balance and available rate limits. Do not switch models automatically.

API reference

See Chat Completions, Models and API overview.

On this page