Set up a model provider
An agent user wants to give their agent server a model provider and its key, safely, so that agents have a model to run on.

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

Providers sheet

The sheet: configured providers above, the add form below

Provider and model rows

Configured provider rows

Agents list

The Model providers row that opens the sheet

New agent sheet

The second entry, when no provider exists yet

Forms and inputs

A form that adapts to the chosen type; password field

Every form

This form among all forms

Buttons and actions

Save provider as a row in the list, Done in the bar

input, textarea, select and label

The type menu, name, address and password fields

Stacks, pushes and sheets

Why this is a sheet with only Done

Honest state: loading, failure and empty

The key safety rule is said on screen and enforced

Representative strings

The footer and warning wording

Platform colour roles in use

Red for the warning and errors

Implementation

Page

Part it plays

Agents: providers, models and tool summaries

Provider metadata: labels, default addresses, which types need a key

Agents: reads, commands and the clock

agentsSaveProvider: SetSecret then SetModelProvider

Agents: signed action envelope and endpoints

safeAgentSecretTarget: keys only to HTTPS or a local server

Agents: screens and components

AgentProvidersScreen

Agents: chat with Seed agents

Package overview and known limits

Agents server

ListModelProviders, SetSecret and SetModelProvider

Root declarations: Activity and Agents

agentsProviderSaved, agentsProviderError and the providers route

Navigation and routes

The providers route

Grants and capabilities

What the app may reach on the network

Contract UI tests

The UI tests of the sheet

Mock agents server

The mock's provider store and /dev/assert-provider

Bun unit tests

Unit tests of the secret rule and provider submissions

Current limits and known gaps

Subscription sign-in is desktop only

Code

File

What

agents.contract L721-818

AgentProvidersScreen

agents.contract L719-719

agentProviderOption

agents.contract L13-23

AgentProvider and AgentProviderOption shapes

app.contract L49-49

providers route

app.contract L186-190

agentsProviderError and the agentsProviderSaved mutation

app.contract L541-549

agentsSaveProvider, agentsAfterProvider

app.contract L840-850

AgentProvidersScreen wiring

src/agents/sources.ts L497-544

agentsSaveProvider

src/agents/sources.ts L94-117

emptyOverview: provider options and safeSecrets

src/agents/envelope.ts L86-92

safeAgentSecretTarget

src/agents/provider-registry.ts L52-159

PROVIDERMETADATA, PROVIDERTYPEORDER, providerLabel

Tests

File

What it checks

agents.test.contract

a provider can be configured with a fixture-only API key

agents.test.contract

provider labels and default URLs follow metadata for hosted and local providers

agents.test.contract

agents list, configuration, providers and validated creation

src/agents/__tests__/agents.test.ts

agents protocol: keeps provider secrets off remote plain HTTP

src/agents/__tests__/parity.test.ts

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

Comments