# Model keys

> Bring your own Gemini, Anthropic or OpenAI key for tasks. How to send it, where it lives, which models are used and how to keep it safe.

Source: https://akaphone-docs.pages.dev/guides/model-keys/

ARTEMIS, the agent that carries out [tasks](https://akaphone-docs.pages.dev/concepts/tasks/), calls a large language model on every step. AkaPhone does not resell model access. You bring your own key, your provider bills you for tokens, and AkaPhone bills only device minutes.

## Supported providers

| `X-Model-Provider` | Key from | Looks like |
|---|---|---|
| `gemini` (default) | [Google AI Studio](https://aistudio.google.com/apikey) | `AIza…` |
| `anthropic` | [Anthropic Console](https://console.anthropic.com/) | `sk-ant-…` |
| `openai` | [OpenAI Platform](https://platform.openai.com/api-keys) | `sk-…` |

Any other provider value is rejected with `400 invalid_request`.

## Sending the key

Send it with each task request, in headers:

```bash title="curl"
curl -X POST https://akaphone.abhgnx-417.workers.dev/v1/devices/dev_s6zr7mr4f2f1/tasks \
  -H "Authorization: Bearer $AKAPHONE_API_KEY" \
  -H "X-Model-Key: $ANTHROPIC_API_KEY" \
  -H "X-Model-Provider: anthropic" \
  -H "Content-Type: application/json" \
  -d '{"instruction": "Open the Clock app and set an alarm for 7:30", "profile": "flash"}'
```
```typescript title="TypeScript"
await fetch("https://akaphone.abhgnx-417.workers.dev/v1/devices/dev_s6zr7mr4f2f1/tasks", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.AKAPHONE_API_KEY}`,
    "X-Model-Key": process.env.ANTHROPIC_API_KEY!,
    "X-Model-Provider": "anthropic",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ instruction: "Open the Clock app and set an alarm for 7:30", profile: "flash" }),
});
```
```python title="Python"
import os, requests

requests.post(
    "https://akaphone.abhgnx-417.workers.dev/v1/devices/dev_s6zr7mr4f2f1/tasks",
    headers={
        "Authorization": f"Bearer {os.environ['AKAPHONE_API_KEY']}",
        "X-Model-Key": os.environ["ANTHROPIC_API_KEY"],
        "X-Model-Provider": "anthropic",
    },
    json={"instruction": "Open the Clock app and set an alarm for 7:30", "profile": "flash"},
)
```

- **MCP server:** set `MODEL_API_KEY` (and `MODEL_PROVIDER` for Anthropic or OpenAI) in the server's environment. It adds the headers to every `device_run_task` call.
- **Dashboard:** paste the key in **Run a task**. It is saved in your browser's local storage on that computer only, so you do not have to paste it each time, and sent with each task. **Forget key** deletes it from the browser.

If you send no key at all, the task is still accepted, but ARTEMIS will have no model to call unless the host has an operator default configured, and on AkaPhone's hosted service you should assume it does not. The task then fails.

## Where the key goes

1. Your request arrives at the API over HTTPS.
2. The API passes the key, in memory, in the `task.run` message to the device's host. It is not written to the database, to any log, or to the audit trail, and it is never returned in a response. The API's own tests check the database, audit log and KV storage for it.
3. On the host, the key exists only in the memory of the agent and in the environment of the ARTEMIS process for that one task. It is never on the command line or on disk. Every log line, the task log artifact and the task `result` pass through a redactor that removes it.
4. When the task ends the process exits and the key is gone.

So you have to send the key with every task. That is deliberate: there is nothing stored to leak, rotate or delete.

## Models

The host chooses the model from the provider and the task profile:

| Provider | `flash` | `pro` |
|---|---|---|
| `gemini` | `gemini-2.5-flash` | `gemini-2.5-pro` |
| `anthropic` | `claude-sonnet-4-5` | `claude-sonnet-4-5` |
| `openai` | `gpt-4.1` | `gpt-4.1` |

You cannot pick a specific model per task today.

## Keeping it safe

- **Use a dedicated key** for AkaPhone with a spending limit set at your provider.
- **The device can see what you type into it, not your model key.** The key never reaches the Android system; it stays with ARTEMIS on the host.
- **Rotate at your provider** whenever you like. There is nothing to update on AkaPhone's side.
- See [Security](https://akaphone-docs.pages.dev/security/) for how devices on a shared host are isolated, and what that means for credentials you type into a device.
