---
title: "Store a model provider credential"
method: POST
path: "/v1/ai/credentials"
tags: ["AI"]
---

# Store a model provider credential

`POST /v1/ai/credentials`

## Request

- Base URL: `https://www.chatrail.dev`
- URL: `https://www.chatrail.dev/v1/ai/credentials`
- Auth: HTTP bearer

Encrypted at rest and never returned. AI is off by default and enabled per connection.

## Request body

- object
  - `provider` 'openai_compatible' | 'anthropic', required
  - `label` string, required
  - `api_key` string, required
  - `base_url` string, uri

## Response `201`

Stored.

## Other responses

- `402`: AI is not on this plan.

---

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