Aider

Use Foza models with Aider AI pair programming

Setup#

Connect Aider to the Foza gateway using environment variables.

Aider expects OpenAI-compatible model names to be prefixed with openai/ on the command line. Because Foza model slugs already include a provider prefix, the full Aider model string often looks like openai/anthropic/claude-sonnet-4.6.

1

Get your API key

Create an API key at Console → API Keys and subscribe it to a model.

2

Set environment variables

export OPENAI_API_BASE=https://api.foza.ai/v1
export OPENAI_API_KEY=sk-foza-xxxxx

Add these to your ~/.bashrc or ~/.zshrc to persist them.

3

Run Aider

aider --model openai/anthropic/claude-sonnet-4.6

Or for OpenAI models:

aider --model openai/openai/gpt-4o
4

Start with a narrow request

aider --model openai/anthropic/claude-sonnet-4.6 README.md

Then ask Aider to make a small documentation change before letting it edit source files.

Persistent project config#

Create .aider.conf.yml in your project root:

openai-api-base: https://api.foza.ai/v1
openai-api-key: sk-foza-xxxxx
model: openai/anthropic/claude-sonnet-4.6

You can also keep the key in OPENAI_API_KEY and omit openai-api-key from the file.

Troubleshooting#

SymptomWhat to check
Aider warns about unknown modelThe model can still work; confirm the Foza slug is correct
Auth failureOPENAI_API_KEY is set in the shell running Aider
Wrong endpointOPENAI_API_BASE should be https://api.foza.ai/v1
Model string confusionUse openai/<foza-model-slug>

Run Aider on a small set of files first, for example aider src/app/page.tsx, so the model has focused context and produces smaller diffs.