Connect a Provider
Flux needs one model provider. The easiest path is:
- choose one provider
- set its credential in the same terminal where you will start Flux
- launch Flux with that provider and model
- ask one read-only question to confirm it works
If you are not sure which provider to pick, use OpenAI, Anthropic, or Gemini if you already have an API key. Use Ollama if you want to run locally.
#Fastest path
If you already have an OpenAI key, this is the quickest first run:
export OPENAI_API_KEY="your-key"
flux --provider openai --model gpt-5.4-mini --deny-writes
Then ask:
What files are in this repository? Do not change anything.
#OpenAI
export OPENAI_API_KEY="your-key"
flux --provider openai --model gpt-5.4-mini
#Anthropic
export ANTHROPIC_API_KEY="your-key"
flux --provider anthropic --model claude-sonnet-4-20250514
#Google Gemini
export GEMINI_API_KEY="your-key"
flux --provider gemini --model gemini-3.5-flash-lite
#Ollama
Start Ollama and make sure at least one model is installed:
ollama list
flux --provider ollama
Flux lists the models available at the default http://localhost:11434 endpoint. You can also select one directly:
flux --provider ollama --model llama3.2
For a remote Ollama server, set OLLAMA_ENDPOINT and, when required, OLLAMA_API_KEY. If you prefer host and port separately, Flux also supports OLLAMA_HOST and OLLAMA_PORT.
#Make it stick
If you do not want to pass --provider and --model every time, save defaults in your user config file:
- macOS or Linux:
~/.flux/config.json - Windows:
%USERPROFILE%\\.flux\\config.json
Example:
{
"provider": "openai",
"model": "gpt-5.4-mini"
}
Keep cloud API keys in environment variables when possible. Flux can also read provider keys from config, but environment variables are safer for shared machines and less likely to end up in version control.
#Verify the connection
Start a read-only session in any repository:
flux --provider openai --model gpt-5.4-mini --deny-writes
Replace the provider and model with your choice. Then ask:
What files are in this repository? Do not change anything.
If Flux reports a missing key, confirm that the matching environment variable is set in the same terminal where you launched Flux. An explicitly selected provider will not silently use a different provider.
If the key is set but Flux still cannot connect:
- open a fresh terminal and set the variable again
- confirm the variable name matches the provider exactly
- for Ollama, confirm the server is running and reachable
- for remote Ollama, confirm
OLLAMA_ENDPOINT, orOLLAMA_HOSTplusOLLAMA_PORT
You can switch providers or models later with /model. To save defaults, see configuration. Keep cloud API keys out of project configuration and version control.