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)
Local connections use OpenAIClient with a user-supplied base URL and must be bound to a specific daemon. The URL like localhost:11434 is resolved on the daemon machine — not on the AFK server.
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. - Bind the connection to that daemon machine, then save or test it.
- 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). - Select the daemon machine this URL resolves on.
- 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.
- Ensure the daemon is running on the same machine as the browser.
- In Account → LLM, click + ChatGPT subscription.
- Click Connect with ChatGPT and complete the flow.
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.
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.
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.