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

# DeepMask API

> Call DeepMask models from your own apps and scripts with an OpenAI-compatible API, billed pay as you go.

The DeepMask API lets you call DeepMask models from your own apps, scripts, and services. It is OpenAI-compatible, so you can use the official OpenAI SDKs by changing the base URL and API key. Organization admins create keys, choose which models each key can use, and manage billing on the **API** settings page.

## Who can use the API

| Who | What they need |
| - | - |
| **Organizations** | An active paid Chat plan: Pro, Power, or Enterprise. The Free plan, free trials, and plans with an overdue payment don't include API access. |
| **Organization admins** | The admin role. Admins manage keys, models, usage, and billing on the **API** settings page. See [Team management](https://documentation.deepmask.io/enterprise/team-management.md). |
| **Developers** | An API key from an admin. Requests authenticate with the key alone, so developers don't need admin access. Call the API from a server or script. Browsers block calls from web pages, and a key must never go in client-side code. |

To open the API page, click your name at the bottom of the chat sidebar, choose **User Settings**, and click **API** in the settings sidebar. Only organization admins see **API**.

> [!NOTE]
>
> Keys work only while your organization has an active paid Chat plan and API billing is active. If an API invoice payment fails, requests stop until you pay it. See [Billing](https://documentation.deepmask.io/api/billing.md).

## What you can do

| Endpoint | What it does |
| - | - |
| `POST /v1/chat/completions` | Generate a response from a list of messages. Supports streaming, function tool calling, and image input on selected models. |
| `GET /v1/models` | List the models your key can use. |

* Messages can use the `system`, `user`, `assistant`, and `tool` roles. Use `system` instead of `developer`.
* In `system` and `user` messages, `content` can be a string or an array of content parts. In `assistant` and `tool` messages, `content` must be a string. An assistant message with tool calls can have `null` as its `content`. The API refuses file, audio, and document parts. See [Messages](https://documentation.deepmask.io/api/chat-completions.md#messages) for the rules for each role.
* On seven models, including `gpt-4o`, you can send images in `user` messages as base64 data URLs. The API refuses image links and never fetches them. See [Image input](https://documentation.deepmask.io/api/chat-completions.md#image-input) for the models, formats, and limits.
* The API accepts a fixed set of request fields. These include the sampling options `temperature`, `top_p`, `presence_penalty`, `frequency_penalty`, `seed`, `stop`, and `n` (only as 1). Some models ignore some of these options without an error. See [Options that some models ignore](https://documentation.deepmask.io/api/chat-completions.md#options-that-some-models-ignore).
* The API refuses other fields, such as `response_format`, `logprobs`, and `reasoning_effort`, with a `400` error. A value outside a field's range, such as `n` above 1, gets the same error. See [Request body](https://documentation.deepmask.io/api/chat-completions.md#request-body) for the supported fields and their ranges.
* Your organization's **Requests per minute**, **Tokens per minute**, and **Concurrent requests** limits apply to all keys together. Admins see the current values under **API limits** on the **Usage** tab. Each key also has its own limits on requests per minute and requests in flight. Requests above a limit are refused with `429`. See [Limits and fair use](https://documentation.deepmask.io/api/limits.md) for every limit and how fair use works.

> [!NOTE]
>
> Only these two endpoints are available. Embeddings, image generation, legacy completions, the Responses API, and retrieving a single model with `client.models.retrieve()` don't work.

## Base URL and authentication

Send every request to `https://api.deepmask.io/v1`. You can copy it from **Base URL** at the top of the **API** settings page.

Send your key in the `Authorization` header as `Bearer <key>`. Keys start with `sk-` followed by 64 hexadecimal characters. DeepMask shows the full key only once, when you create it.

In the OpenAI SDKs, set `base_url` (Python) or `baseURL` (Node.js) to `https://api.deepmask.io/v1`. Pass your key as `api_key` or `apiKey`, and the SDK sends the header for you.

## Get started

An admin opens the **API** settings page, clicks **Enable API billing** on the page's **Billing** tab, and completes checkout. Checkout asks for a payment method and a billing address. The admin then clicks **Create key** on the **Keys** tab. **Create key** stays unavailable until API billing is active.

The [Quickstart](https://documentation.deepmask.io/api/quickstart.md) walks you through setup and your first request with cURL, Python, and Node.js.

## Models and hosting

The API offers chat models from Anthropic, OpenAI, Mistral AI, and other makers. Every API model is hosted in the EU. The **Models** tab shows the current catalog.

Each key can use only the models an admin grants to it. Use the **API model ID** from the **Models** tab as the `model` value, for example `gpt-4o`. See [Models](https://documentation.deepmask.io/api/models.md) for capabilities and pricing.

## Billing at a glance

* **Separate from Chat.** API billing is its own pay-as-you-go subscription, and turning it on doesn't change your Chat plan. See [Billing](https://documentation.deepmask.io/api/billing.md).
* **Pay per token.** You pay for the tokens each request uses, at the rates per 1M tokens shown on the **Models** tab, which include the 3% fee but not VAT. See [How pricing works](https://documentation.deepmask.io/api/models.md#how-pricing-works).
* **Monthly invoice.** Your monthly invoice includes model costs plus a 3% fee, plus VAT where applicable. See [What you pay](https://documentation.deepmask.io/api/billing.md#what-you-pay).
* **Failed requests.** Requests that DeepMask or the model provider refuses aren't billed. A request with an unclear outcome, such as a provider timeout, isn't billed unless usage for it still arrives later. See [Are failed requests billed?](https://documentation.deepmask.io/api/errors.md#are-failed-requests-billed).
* **Spending caps.** The **Gateway spending cap** is the organization-wide monthly cap shared by all keys, and each key can also have its own optional cap. See [Spending caps](https://documentation.deepmask.io/api/spending-caps.md).

## Explore the API docs

> [card] [Quickstart](https://documentation.deepmask.io/api/quickstart.md)
>
> Enable billing, create a key, and send your first request.

> [card] [API keys](https://documentation.deepmask.io/api/keys.md)
>
> Create, review, and revoke keys and choose their models.

> [card] [Spending caps](https://documentation.deepmask.io/api/spending-caps.md)
>
> Limit monthly spend for your organization and for each key.

> [card] [Usage and logs](https://documentation.deepmask.io/api/usage-and-logs.md)
>
> Track monthly charges, review requests, and export a CSV.

> [card] [Billing](https://documentation.deepmask.io/api/billing.md)
>
> Manage API billing, invoices, and cancellation.

> [card] [Models](https://documentation.deepmask.io/api/models.md)
>
> Browse API models, model IDs, and how pricing works.

> [card] [Chat completions](https://documentation.deepmask.io/api/chat-completions.md)
>
> Request format, image input, streaming, and tool calling.

> [card] [Limits and fair use](https://documentation.deepmask.io/api/limits.md)
>
> Rate, token, and budget limits, and how fair use works.

> [card] [Errors and retries](https://documentation.deepmask.io/api/errors.md)
>
> Error codes, retries, and whether failed requests are billed.


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