DEV Community

江流石
江流石

Posted on

Point Codex at a free relay API (config.toml walkthrough)

Want to run Codex without paying per token? Point it at a third-party relay that mirrors the API and gives you signup credit. Here's a minimal ~/.codex/config.toml using AgentRouter.

model = "gpt-6-astra"
model_provider = "relay"
[model_providers.relay]
base_url = "https://agentrouter.org/v1"
env_key = "RELAY_API_KEY"
wire_api = "chat"
Enter fullscreen mode Exit fullscreen mode

Then export the key:

export RELAY_API_KEY="sk-****your-key****"
Enter fullscreen mode Exit fullscreen mode

Notes:

  • OpenAI-compatible endpoint — base URL ends with /v1.
  • The key goes in an env var via env_key, not in the file, so the config is safe to back up.
  • Start with wire_api = "chat"; most relays expose chat completions, not the responses API.
  • Copy the exact model string from the station's model list.

Plenty of these free stations exist (signup + daily check-in credit), so register whichever you like. Full list with tested dates: AI relay station list

Signup links there carry my referral param — drop ?aff= if you prefer.

Top comments (0)