Authentication

Connect the account or API key fx should use for model requests.

Model providers

Open fx and run /provider to choose where fx sends model requests and how you connect.

ProviderConnect withTerminal command
CodexChatGPT subscriptionfx login codex
GrokGrok subscriptionfx login grok
AI GatewayVercel account or API keyfx login vercel for an account, or fx setup for a key

Your provider determines the available models and where usage is billed. fx remembers the model you selected for each provider. Use /model to choose another one, or learn more about models.

To switch an existing connection from your terminal, run fx provider codex, fx provider grok, or fx provider gateway.

Custom endpoints

You can also connect Ollama, vLLM, OpenRouter, or another compatible Chat Completions endpoint. Define it in ~/.fx/settings.json, then select it with fx provider <name> or FX_PROVIDER.

Custom connections can run without authentication or read a bearer key from an environment variable. See Custom model connections for examples and supported fields.

Use an AI Gateway API key

Create an AI Gateway API key, then save it with:

$fx setup

For a script or CI job, set AI_GATEWAY_API_KEY and select Gateway:

export AI_GATEWAY_API_KEY="your-api-key"
fx provider gateway
fx ask "Summarize this repository"

Credential selection

Use /provider to choose which AI Gateway credential fx should use. Choosing a Vercel login or API-key source saves that exact source for later runs. It takes priority over VERCEL_OIDC_TOKEN and AI_GATEWAY_API_KEY. If the chosen source is unavailable, fx reports it instead of switching accounts.

When no Gateway credential source is saved, fx checks credentials in this order:

SourceSelected when
VERCEL_OIDC_TOKENThe environment contains a non-empty OIDC token.
AI_GATEWAY_API_KEYThe environment contains a non-empty API key but no OIDC token.
Vercel loginNeither environment credential resolves, and the saved login can be loaded or refreshed.
Saved API keyThe key is available and none of the earlier sources resolves.

Environment values apply to fx processes started with them. fx setup saves a key but does not select it. Without a saved choice, fx reaches that key through the order above. Use /provider to select it explicitly.

Manage connections

Run fx status or /status to see the active provider, model, and credential source.

To sign out from your terminal:

ProviderCommand
ChatGPT subscriptionfx logout codex
Grok subscriptionfx logout grok
Vercel AI Gatewayfx logout vercel

In fx, /logout signs out of the active provider.

Change Vercel team

fx teams chooses the AI Gateway team for your saved Vercel login and selects that login for Gateway requests. The chosen team determines the models and credits available to fx. API keys and environment credentials do not use this team selection.