> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://mammoth.io/docs/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# mammoth external-key

> All 4 mammoth external-key commands with examples, arguments and confirmation flags: Manage LLM provider keys (OpenAI, Anthropic, etc.) used by AI features.

> Generated from mammoth-cli 2.4.2, released 2026-11-02: `mammoth schema list`, `mammoth capability list` and the CLI's own `--help`. Do not edit by hand; run `npm run docs:capabilities`.

Manage LLM provider keys (OpenAI, Anthropic, etc.) used by AI features. 4 commands.

Every command also takes the [global flags](https://mammoth.io/docs/build/cli/global-flags/) (`--output`, `--yes`, `--confirm`, `--dry-run`, `--input`, `--profile`, ...), which are not repeated below. `--input` takes a JSON or YAML document of the input fields; `mammoth schema get COMMAND_ID` prints a command's full input schema.

**Confirmation.** Commands marked `--yes --confirm TARGET` or `--yes` always need those flags, even at a terminal: they never prompt. Commands marked "`--yes` or prompt" ask at an interactive terminal (table output, no `--no-input`) and otherwise need `--yes`. `--dry-run` skips confirmation and sends nothing.

## Summary

| Command | What it does | Effect | Confirmation |
|---|---|---|---|
| [`external-key create`](#mammoth-external-key-create) | Create an external (LLM provider) API key. | High impact | `--yes --confirm TARGET` |
| [`external-key delete`](#mammoth-external-key-delete) | Permanently delete one LLM provider key by id. Prompt or '--yes' required. | Destructive | `--yes` or prompt |
| [`external-key get`](#mammoth-external-key-get) | Get one LLM provider key by id. | Read | — |
| [`external-key list`](#mammoth-external-key-list) | List the workspace's LLM provider keys (OpenAI, Anthropic, etc.). | Read | — |

## external-key commands

### mammoth external-key create

Create an external (LLM provider) API key.

```bash
mammoth external-key create --input /private/path/request.json --yes
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `key_type` | `--input` field | yes | — | `ExternalKeyType` | One of `open_ai`, `anthropic`, `gemini`, `grok`. |
| `key_name` | `--input` field | yes | — | `str` |  |
| `secure_key` | `--input` field | yes | — | `str` |  |
| `description` | `--input` field | no | — | `str` |  |
| `model_id` | `--input` field | no | — | `str` |  |
| `model_settings` | `--input` field | no | — | `ModelConfigSpec` |  |

- **Effect:** High impact, scope `workspace` · **Confirmation:** always `--yes --confirm TARGET`, even at a terminal (TARGET is the exact id or name acted on; the `confirmation_required` error's hint names it)
- **Preconditions:** secure_key is a secret_fields entry: --input FILE, mode 0600 (shell) or the --input JSON's secure_key field (embedded), behind the confirmation card; never in a reply, note, checkpoint or run log. Response is recursively redacted.
- **Id:** `external-key.create` · **Result:** `ExternalKeyCreateResult` · **Backed by:** SDK `mammoth.api.external_keys.ExternalKeysAPI.create`, API `POST /workspaces/{workspace_id}/external_keys` (AddExternalKey)

### mammoth external-key delete

Permanently delete one LLM provider key by id. Prompt or '--yes' required.

```bash
mammoth external-key delete 123 --yes
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `KEY_ID` | positional | yes | — | `int` | ID of the key. |

- **Effect:** Destructive, scope `workspace` · **Confirmation:** `--yes`, or answer the prompt at an interactive terminal
- **Preconditions:** Immutable ID confirmation.
- **Id:** `external-key.delete` · **Result:** `ExternalKeyDeleteResult` · **Backed by:** SDK `mammoth.api.external_keys.ExternalKeysAPI.delete`, API `DELETE /workspaces/{workspace_id}/external_keys/{key_id}` (DeleteExternalKey)

### mammoth external-key get

Get one LLM provider key by id.

```bash
mammoth external-key get 123
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `KEY_ID` | positional | yes | — | `int` | ID of the key. |

- **Effect:** Read, scope `workspace` · **Confirmation:** none
- **Preconditions:** Required inputs: KEY_ID.
- **Id:** `external-key.get` · **Result:** `ExternalKeyGetResult` · **Backed by:** SDK `mammoth.api.external_keys.ExternalKeysAPI.get`, API `GET /workspaces/{workspace_id}/external_keys/{key_id}` (GetExternalKey)

### mammoth external-key list

List the workspace's LLM provider keys (OpenAI, Anthropic, etc.).

```bash
mammoth external-key list
```

- **Effect:** Read, scope `workspace` · **Confirmation:** none · **Pages:** `single_page`
- **Id:** `external-key.list` · **Result:** `ExternalKeyListResult` · **Backed by:** SDK `mammoth.api.external_keys.ExternalKeysAPI.list`, API `GET /workspaces/{workspace_id}/external_keys` (GetKeysByWorkspaceId)

---
Source: https://mammoth.io/docs/build/cli/external-key.md · Updated: 2026-11-02
