Aider is one of the best AI pair programming tools, but by default it connects directly to OpenAI or Anthropic. What if you want to route through a custom API endpoint β for cost savings, failover, or unified billing? Here's how to set it up. The Problem You're using Aider and want to: Access multiple model providers (Claude, GPT, Gemini) without juggling API keys Route through a gateway for reliability or cost optimization Use a self-hosted or third-party API endpoint Solution: Environment Variables Aider uses the OpenAI SDK under the hood, which means it respects OPENAI_API_BASE for custom endpoints. Step 1: Set Environment Variables export OPENAI_API_BASE = https://futurmix.ai/v1 export OPENAI_API_KEY = your-gateway-key Enter fullscreen mode Exit fullscreen mode Step 2: Run Aider with Any Model # Use Claude Sonnet 4.5 aider --model claude-sonnet-4-5-20250929 # Use GPT-5.4 aider --model gpt-5.4 # Use Gemini 2.5 Pro aider --model gemini-2.5-pro Enter fullscreen mode Exit fullscreen mode That's it.β¦