> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobilerun.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Bring your own model key

> Use your OpenAI, Anthropic, or Google key for models in Mobilerun Cloud.

Bring your own key (BYOK) connects Mobilerun to your model-provider account. You keep using
Mobilerun's tasks, agent, and routines while your provider bills you directly for model usage
routed through that key.

BYOK is available on all plans, including Free. Keys belong to the selected workspace, not just
the person who adds them. Organization owners and admins can manage them; members have read-only
access. You can also use Mobilerun without adding a model key.

## Supported providers

| Provider | Where to create a key |
| - | - |
| OpenAI | [OpenAI Platform → API keys](https://platform.openai.com/api-keys) |
| Anthropic | [Anthropic Console → API Keys](https://console.anthropic.com/settings/keys) |
| Google | [Google AI Studio → Get API key](https://aistudio.google.com/apikey) |

Adding a provider key makes its supported model set available in Mobilerun. It does not add every
model the provider offers. Use the model list shown in Cloud.

## Add a key in Cloud

Open LLM keys

**1. Open LLM keys**

Select the workspace that should use the key. In **Billing & plans**, open **LLM keys**.

**2. Add a credential**

Choose **New credential**. Select **Provider**, optionally enter a **Label**, and paste the
provider's **API key**. Choose **Save**. Cloud checks the key's format and sets up its models.
Saving is not a live connection test.

**3. Test the key**

In **Test a credential**, select the saved **Credential** and choose **Test connection**.
This sends a short message through that key. **Connection succeeded** confirms a response
from the provider. The test uses the provider and normal usage billing applies.

**4. Check routing**

The **Routing** card lists **Available models**. Your key is used for the models it covers;
other models use Mobilerun's model service.

## Use it for tasks, the agent, and routines

Choose a model as usual. Tasks use `llmModel` in the API/SDK or the model picker in Cloud;
see [Model selection](https://docs.mobilerun.ai/tasks.md#model-selection). The agent and routine task steps use their model
pickers too. You do not pass the provider key in task prompts, routine inputs, or each API call.

For a model covered by an active workspace key, Mobilerun routes the request through it
automatically. You still use your [Mobilerun API key](https://docs.mobilerun.ai/api-keys.md) to authenticate Cloud API requests;
it serves a different purpose from your model-provider key.

## What you pay

| Usage | How it is paid |
| - | - |
| Model requests routed through your key | Your provider bills the model usage directly; Mobilerun's BYOK platform fee uses AI credits. |
| Models using Mobilerun's service | Normal model usage uses AI credits. |
| Agent compute | Still uses AI credits, even with your own model key. |
| Phone time, functions, proxy traffic, and storage | Keep their own units; BYOK does not replace those balances. |

Check LLM keys for routing, provider spend, and the monthly
LLM limit. This limit applies to requests through the workspace's own keys. See
[Credits and units](https://docs.mobilerun.ai/credits.md) for metering and [Pricing](https://mobilerun.ai/pricing/) for rates.

If an authentication failure or certain connection failures cause a request to retry through
Mobilerun's service, that retry uses normal AI-credit billing. Provider rate limits do not trigger
this fallback.

## Keep your key safe

Cloud stores keys encrypted and does not show the saved key again. Keep provider keys out of
client-side code, prompts, screenshots, and logs.

Use the key's action menu to manage it:

* **Rotate key** replaces it with a new provider key. A rejected key may show **Replace key** instead.
* **Pause key** temporarily routes matching requests through Mobilerun; **Resume key** uses your key again.
* **Revoke key** stops routing through it and cannot be undone. To cancel the credential at its source,
  also revoke it in the provider's dashboard.

## Troubleshooting

| Problem | What to check |
| - | - |
| Key rejected while saving | Choose the matching provider and paste the key without a `Bearer` prefix or extra spaces. |
| Connection test rejects the key | Check that the provider key is valid and has access to the model. Use **Rotate key** or **Replace key**, then test again. |
| Google key fails | Enable the Generative Language API and allow it in the key's API restrictions. If an `AQ.` key gets a 401, try an `AIza` key from Google Cloud Console. |
| Provider rate limit | Wait and retry, or check your provider account's quota. A provider 429 does not switch the request to Mobilerun's key. |
| Monthly LLM limit reached | Check and adjust the limit in **LLM keys**; it is separate from the other usage meters. |
| No models after saving | Use **Retry provisioning** in the credential's action menu, then check **Routing**. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.