# Add your own model key

> Bring your own Anthropic, OpenAI or OpenRouter API key, or connect an OpenAI-compatible server. Choose personal or Team access for hosted Agents.

To run hosted AI Agents with your own API key, add it under **Model keys** in
your Team. Bring your own key (BYOK) uses a model account you pay for directly.
Fungi records BYOK usage at zero charge and does not deduct model use from Team
credit; your provider may charge you. Hosted Computer time and other
Fungi-funded work still need [Team credit](/account/billing/).

Supported key types are **Anthropic**, **OpenAI**, **OpenRouter**, and an
**OpenAI-compatible server**. For the compatible option, provide the server's
HTTPS API base URL.

Already have an OpenAI client and want to call Fungi's models instead? Use a
[Fungi Team key](/guides/team-keys/). That key authenticates your client to
Fungi. A provider key saved here lets Fungi call your provider.

## Add a key

1. Open your Team and choose **Model keys**.
2. Choose a provider, then choose **Just me** or **The whole Team**. A personal
   key is for you and your own Agents; a Team-shared provider key can be used by
   the Team and its Agents. Only a Team owner can add a Team-shared provider
   key; other members can add their own personal keys.
3. Give the key a name. For an OpenAI-compatible server, enter its HTTPS base
   URL.
4. Paste your provider API key and choose **Check and save key**. Fungi makes an
   authenticated check, puts the key in its credential custodian and never
   displays it again. If the check fails, confirm the provider, key and, for a
   compatible server, its public HTTPS base URL before retrying.
5. Ask a Team owner to select **Use our own keys** in **Team default for
   Agents**. The owner must set a valid `@byok/<provider>/<model>` default
   backed by a usable key for Agents without an explicit model. An Agent that
   already selects its own BYOK model does not need a Team default; without
   either model, its request is refused.

Only a Team owner can change the Team default, including switching back to **Use
Fungi models**. Remove an unused or exposed key from **Model keys**; removing a
member also removes that member's personal keys. Never share a key in a
conversation or support email. A Team-shared provider key can be used by other
Team members and Team-key clients, so choose **Just me** unless sharing is
intentional.

An App's model-generation request does **not** spend a viewer's personal or Team
BYOK key. It uses Fungi-funded inference, with the Team's normal credit
requirements, or is refused. This prevents an App from silently spending your
provider account.

## Local terminal sign-in is separate

The `fungi` terminal can use your own provider key or a personal ChatGPT plan
through its provider login. On your own machine, run `fungi login`, choose the
provider and a supported login method, then complete the interactive sign-in. A
local subscription never becomes a hosted Team or App key. Hosted Agents and
Computers use Fungi-funded models or provider API keys, not subscriptions. An
installed extension can add another subscription sign-in on your machine; see
[Add a model sign-in with an extension](/extensions/model-logins/).
