---
title: "Add an AI key"
method: POST
path: "/ai/keys"
tags: ["ai"]
---

# Add an AI key

`POST /ai/keys`

## Request

- Base URL: `https://localhost:4410/api/v1`
- URL: `https://localhost:4410/api/v1/ai/keys`
- Auth: HTTP bearer

An owner adds a key, with a passkey: a decision model's (TypeSafe's, or any endpoint that speaks its System One API), which then answers before the instance's model, or a language model's (Anthropic's, or any OpenAI-compatible endpoint), which reads pasted text into fields when a person asks. Binderwork checks it with one small call, keeps it encrypted and shows only its last four characters. A new key replaces the one before for the same purpose. Refused while an owner has AI features off.

## Request body

- object
  - `key` string, required
  - `purpose` 'decision' | 'language'
  - `provider` 'systemone' | 'anthropic' | 'openai_compatible'
  - `base_url` string, uri
  - `model` string

## Response `200`

The result.

- object
  - `items` object[], required
    - `id` string, required
    - `purpose` 'decision' | 'language', required
    - `provider` 'systemone' | 'anthropic' | 'openai_compatible', required
    - `label` string, required
    - `base_url` string, required
    - `model` string, required
    - `last4` string, required
    - `checked_at` string, date-time, required
    - `added_by` string, required
    - `added_at` string, date-time, required

## Other responses

- `202`: Called by an agent or an API key, so the call did not run. A person approves it at approval_url; then GET the Location.
- `default`: An RFC 9457 problem.

---

[API](https://skmtc.dev/binderwork/apis/binderwork-api.md) · [All operations](https://skmtc.dev/binderwork/apis/binderwork-api/llms.txt) · [OpenAPI document](https://skmtc.dev/binderwork/apis/binderwork-api/revisions/f8fab0ebee53?raw)
