As an agent user, I want to add a model provider and its API key to my agent server, so that my agents have a model to think with.
Situation
I have an identity and my agent server is "Online". I hold an API key from a model company, or I run a local model server. No agent can be created until at least one provider exists.
What I do
In the Agents tab, tap "Model providers".
Look at "Configured" to see what is already there.
Under "Add a provider", choose a "Type".
Keep or change the provider name, and fill in the address if the type asks for one.
Paste my API key.
Tap "Save provider".
What I should see
The Providers sheet has the title "Model providers" and a single "Done" button.
"Configured" lists each provider by name with its type under it, and " · subscription" after the type when it was signed in with a subscription. With none it reads "No providers configured yet."
The "Type" menu offers OpenAI, Anthropic, Google, OpenRouter, DeepSeek, Groq, xAI (Grok), Ollama and Custom (OpenAI-compatible). It starts on Anthropic.
The name field starts as the type's name ("Anthropic") and follows the type until I type my own.
For a hosted type the address is shown as plain text I cannot edit, for example "https://api.anthropic.com".
For Ollama and Custom there is a "Base URL" field. Ollama's is filled with "http://localhost:11434/v1".
The key field hides what I type. Its hint is "API key", or "API key (optional)" for Ollama and Custom.
Changing the type clears the key I typed.
"Save provider" is dimmed until there is a name, a key when the type needs one, and an address when the type shows one.
Under the form: "Subscription sign-in is available on desktop. Keys are sent only to HTTPS or a local server."
After saving, the sheet closes. The provider is listed the next time I open the sheet and can be picked for a new agent.
When something goes wrong
If my agent server is a remote address on plain HTTP, a red line reads "This server uses remote HTTP. Use HTTPS before sending an API key." and "Save provider" stays dimmed as soon as a key is typed. I change the agent server to an HTTPS address first.
If the server refuses the save, the sheet stays open with the reason in red. My entries are kept and I can try again.
Not included
A configured provider cannot be edited, renamed or removed on the phone. The rows cannot be tapped.
Signing in with a subscription is only offered on desktop (current limits).
A saved key is never shown again.
Trace
Story US-AGENT-03, status Shipped. These links are kept in step with the traceability matrix and with the "User stories" section of every page listed here.
Design
Page | Part it plays |
|---|---|
The sheet: configured providers above, the add form below | |
Configured provider rows | |
The Model providers row that opens the sheet | |
The second entry, when no provider exists yet | |
A form that adapts to the chosen type; password field | |
This form among all forms | |
Save provider as a row in the list, Done in the bar | |
The type menu, name, address and password fields | |
Why this is a sheet with only Done | |
The key safety rule is said on screen and enforced | |
The footer and warning wording | |
Red for the warning and errors |
Implementation
Page | Part it plays |
|---|---|
Provider metadata: labels, default addresses, which types need a key | |
agentsSaveProvider: SetSecret then SetModelProvider | |
safeAgentSecretTarget: keys only to HTTPS or a local server | |
AgentProvidersScreen | |
Package overview and known limits | |
ListModelProviders, SetSecret and SetModelProvider | |
agentsProviderSaved, agentsProviderError and the providers route | |
The providers route | |
What the app may reach on the network | |
The UI tests of the sheet | |
The mock's provider store and /dev/assert-provider | |
Unit tests of the secret rule and provider submissions | |
Subscription sign-in is desktop only |
Code
File | What |
|---|---|
AgentProvidersScreen | |
agentProviderOption | |
AgentProvider and AgentProviderOption shapes | |
providers route | |
agentsProviderError and the agentsProviderSaved mutation | |
agentsSaveProvider, agentsAfterProvider | |
AgentProvidersScreen wiring | |
agentsSaveProvider | |
emptyOverview: provider options and safeSecrets | |
safeAgentSecretTarget | |
PROVIDERMETADATA, PROVIDERTYPEORDER, providerLabel |
Tests
File | What it checks |
|---|---|
a provider can be configured with a fixture-only API key | |
provider labels and default URLs follow metadata for hosted and local providers | |
agents list, configuration, providers and validated creation | |
agents protocol: keeps provider secrets off remote plain HTTP | |
provider submissions use metadata defaults and validate custom endpoints |
Delivery
Delivered by #1470.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime