LLM Providers
AFK supports every major LLM provider through a unified connection system. Configure connections in the browser at Account → LLM. Each connection stores credentials and routing details; sessions choose the model explicitly when they start.
Connections, not providers. A connection is a named, configured access path. You can have multiple connections to the same provider — for example, a personal Anthropic key and a team key, or two different Ollama servers. AFK routes each session to the connection you select at spawn time.
Provider overview
| Provider | Connection key | Model selection | Auth |
|---|---|---|---|
| Anthropic | anthropic | Choose at spawn | API key |
| OpenAI | openai | Choose at spawn | API key |
| Gemini | gemini | Choose at spawn | API key |
| Kimi API | moonshot | Choose at spawn | API key |
| Mistral | mistral | Choose at spawn | API key |
| Groq | groq | Choose at spawn | API key |
| xAI | xai | Choose at spawn | API key |
| DeepSeek | deepseek | Choose at spawn | API key |
| Together AI | together | Choose at spawn | API key |
| Perplexity | perplexity | Choose at spawn | API key |
| Cerebras | cerebras | Choose at spawn | API key |
| OpenRouter | openrouter | Choose at spawn | API key |
| Azure OpenAI | azure | Use deployment model name | API key |
| Local model | local | Choose a local model | None |
| Claude subscription | claude | Choose at spawn | OAuth |
| ChatGPT subscription | chatgpt | Choose at spawn | OAuth |
| Kimi subscription | kimi | Choose at spawn | Device OAuth |
| xAI subscription | xai-subscription | Choose at spawn | Device OAuth |
| GitHub Copilot subscription | copilot | Choose at spawn | Device OAuth |
Anthropic
Uses the Anthropic Messages API with SSE streaming and prompt caching.
- Get an API key at console.anthropic.com.
- In the browser, go to Account → LLM → Add connection → Anthropic.
- Paste the key and click Test.
AFK fetches the live model list when available and preserves manual model entry for providers whose discovery endpoint is incomplete or unavailable.
Provider-supported prompt caching is used automatically where available, reducing costs for long sessions.
OpenAI
Uses the Chat Completions API.
- Get an API key at platform.openai.com.
- Add a connection and paste the key.
AFK reports cache and usage details when the provider returns that information.
Gemini
AFK connects to Gemini via Google's OpenAI-compatible endpoint. Get an API key from Google AI Studio and select the Gemini provider when adding a connection.
OpenAI-compatible providers
Mistral, Groq, xAI, DeepSeek, Together AI, Perplexity, Cerebras, and OpenRouter all use the OpenAIClient under the hood with provider-specific base URLs. Add them via their quick-add buttons in Account → LLM. The workspace dashboard shows remaining credit for OpenRouter, DeepSeek, and Kimi API keys when those providers expose a balance on the stored key.
OpenRouter
OpenRouter gives AFK access to hundreds of models through one OpenAI-compatible API key. AFK uses OpenRouter's default endpoint automatically, so leave Base URL blank unless you route through a custom proxy or gateway.
- Create an OpenRouter API key at openrouter.ai/settings/keys.
- In AFK, go to Account → LLM → Add connection → OpenRouter.
- Paste the API key and save or test the connection.
- Start a new session, select the OpenRouter connection, then choose or type an OpenRouter model slug such as
anthropic/claude-sonnet-4.5,openai/gpt-5.1, orgoogle/gemini-2.5-pro.
If model discovery is incomplete or a new OpenRouter model has not yet appeared in the picker, type the model slug manually when starting the session. When the key exposes a remaining-credit cap, the workspace dashboard shows that balance on the OpenRouter quota card.
Azure OpenAI
Azure requires a deployment URL that includes the resource name and deployment name. Authentication uses the api-key header instead of Authorization: Bearer.
Base URL format:
https://<resource>.openai.azure.com/openai/deployments/<deployment>/AFK appends ?api-version=... automatically when calling the chat endpoint.
Local models (Ollama, LM Studio, vLLM)
A local connection is an OpenAI-compatible server with a user-supplied base URL. Addresses such as localhost:11434 are resolved on the machine running the agent — not on the AFK server. The model list is read from that same machine, so the URL has to be reachable from your daemon.
The same rule applies to a self-hosted gateway or proxy on 127.0.0.1 or a private network range: even when it is added as a regular OpenAI-compatible connection, AFK reads its model list from your daemon rather than from the AFK server. If no daemon can reach the address, the model list stays empty and the connection shows the reason (for example a refused connection) instead of silently reporting no models.
Ollama
AFK can use Ollama through its OpenAI-compatible local endpoint. Use a Local model connection in AFK and point it at the Ollama server URL that is reachable from the selected daemon machine.
- Install Ollama and pull a coding-capable model, for example
ollama pull <model>. - Start Ollama with
ollama serveif it is not already running. - In AFK, go to Account → LLM → Add connection → Local model.
- Set Base URL to
http://localhost:11434/v1when Ollama runs on the same machine as the AFK daemon. If Ollama runs elsewhere, use a URL that the daemon machine can reach. - Save or test it — the daemon that can reach that URL lists the available models.
- Start a new AFK session, choose the Ollama Local model connection, and select or type the model name exposed by Ollama.
If AFK is connected to a shared daemon or remote runner, remember thatlocalhost refers to that daemon machine. Use a network host name or IP address instead when Ollama is running on your laptop but the selected daemon is elsewhere.
Other local OpenAI-compatible servers
- Start Ollama:
ollama serve - Add a Local connection in Account → LLM.
- Set the base URL (e.g.
http://localhost:11434/v1for Ollama orhttp://localhost:1234/v1for LM Studio). - Make sure the daemon running your sessions can reach that URL; AFK lists models from there.
- Choose a local model when spawning a session.
Common base URLs:
| Service | Base URL |
|---|---|
| Ollama | http://localhost:11434/v1 |
| LM Studio | http://localhost:1234/v1 |
| vLLM | http://localhost:8000/v1 |
Claude subscription (OAuth)
If you have a Claude.ai Pro or Team subscription, you can use it in AFK without an API key. AFK uses OAuth 2.0 PKCE flow.
- In Account → LLM, click + Claude subscription.
- Click Connect with Claude. A browser window opens for authorization.
- Complete the authorization flow. The token is stored server-side and auto-refreshed.
If the agent receives a 401 mid-session, AFK automatically refreshes the token and retries the request. Manual reconnection is only needed if the refresh token is revoked.
ChatGPT subscription (OAuth)
ChatGPT Plus or Pro subscribers can use a subscription connection via OAuth without needing an OpenAI API key.
- In Account → LLM, click + ChatGPT subscription.
- Click Connect with OpenAI. AFK opens OpenAI's sign-in page and shows a one-time code.
- Enter the code on the OpenAI page and approve access. AFK detects completion automatically and loads the models available to your subscription.
This uses device authorization, so it works from any browser — the browser does not need to be on the same machine as the daemon, and no daemon is required to sign in.
Kimi subscription (device OAuth)
Kimi members can connect AFK to the Kimi Code service without copying an API key. AFK uses Kimi's device authorization flow and identifies itself as AFK when calling the service.
- In Account → LLM, click + Kimi subscription.
- Click Connect with Kimi. AFK opens Kimi's device authorization page and shows the authorization code.
- Approve access. AFK detects completion and loads the models available to your membership.
Access tokens are refreshed automatically. Available models and context windows depend on your Kimi membership tier; manual model entry remains available.
xAI subscription (device OAuth)
SuperGrok / Grok Build subscribers can connect AFK to xAI without copying an API key. AFK uses xAI's device authorization flow — you approve access on x.ai with a code, and AFK then uses your subscription for chat.
- In Account → LLM, click + xAI subscription.
- Click Connect with xAI. AFK opens xAI's device authorization page and shows the authorization code.
- Approve access. AFK detects completion and loads the models available to your subscription.
Access tokens are refreshed automatically. Available models and context windows depend on your xAI subscription tier; manual model entry remains available.
GitHub Copilot subscription (device OAuth)
GitHub Copilot does not issue a provider API key. Connect AFK with your GitHub account so Copilot usage is billed to your Copilot plan.
- In Account → LLM, click + Copilot subscription.
- Click Connect with GitHub. AFK shows an 8-character device code and opens GitHub's device authorization page.
- Enter the code on GitHub and approve access. AFK detects completion and loads the Copilot chat models available to your plan.
Manual model entry remains available if discovery is incomplete. Copilot is not offered as an API-key connection. Newer Copilot models such as GPT-5.5, GPT-5.6, Grok, and Codex are served through Copilot's Responses API; AFK routes those automatically, while older chat models stay on Chat Completions. The workspace dashboard shows remaining Copilot Chat quota for the connected account. On Copilot Free that is the monthly chat allowance, not the empty premium-credit snapshot GitHub also returns.
Each subscription is its own connection, so a second + Copilot subscription gives you a separate card with its own name and GitHub account. Sign in to the other account on GitHub before approving the second device code; the session you approve is the account AFK bills that connection to.
If a connection test reports rejected or expired authentication, choose Reconnect with GitHub in Account → LLM and complete device authorization again. You can still enter model names manually when discovery is incomplete; manual entry does not repair expired credentials.
Using multiple connections
AFK supports multiple active connections simultaneously. At spawn time, the spawn modal shows a connection picker where you choose which connection (and thus which provider and key) to use for that session, then choose or type the model to run.
Choosing which models are available
Organisations can decide which models each connection exposes. Open Settings → LLM in an organisation context as an organisation owner or admin, expand the connection, and use Available models to switch between All models and Only selected models. In the selected mode you tick the models the connection should offer, and you can add a model id manually when provider discovery is incomplete.
The selection applies to everyone in the organisation, admins included: model pickers in the spawn modal, the composer, and automations only list the approved models, and a session cannot be started or switched onto a model that is not on the list. The connection editor itself still shows the full discovered catalogue so an admin can tick models in or out, and a connection with no selection stays unrestricted.
Only organisation owners and admins can change this list. Managers and members see the resulting model list but cannot edit connections. Models an admin approved stay available even if the provider temporarily fails to report them, and sessions already running an approved model keep running if that model is later removed from the list.
Custom base URL (OpenAI-compatible gateways)
Any OpenAI-compatible API gateway (LiteLLM, Portkey, etc.) can be used by adding an OpenAI connection with a custom base URL pointing to the gateway.
OpenAI-compatible endpoints expose either the Responses API or Chat Completions, and gateways that aggregate several provider catalogs often serve a given model on only one of them. AFK starts on the surface the endpoint most likely serves — Responses for OpenAI and for custom gateway URLs, Chat Completions for the compatible providers that implement only that — and if the surface refuses the model it retries on the other. The surface that answered is remembered per gateway and model in ~/.afk/llm-surfaces.json, so later sessions go straight there. If neither surface accepts the model, the error names each endpoint with its status and the provider's own message, and the full request and response are saved to ~/.afk/llm-last-failure.json for troubleshooting.