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

# API keys: Model Gateway keys and Platform API keys

> Which Langdock API key you need, what each kind can call, which host it uses, and how it is limited and billed.

Every Langdock API key answers two questions:

1. **What does it call?** A **Model Gateway key** calls AI models: chat completions, responses, messages, embeddings and, optionally, agent runs. A **Platform API key** works with Langdock itself: agents, workflows, knowledge folders, skills, prompts, integrations and the admin APIs.
2. **Who does it act as?** A **personal key** acts as the member who created it, with that member's access and spend limit. A **workspace key** belongs to the workspace, acts as its own service account and is created by an admin for shared apps and automations.

> [!NOTE]
>
> The split into Model Gateway keys and Platform API keys is rolling out together with the [Model Gateway](https://docs.langdock.com/en/admin/manage-usage/model-gateway.md). If your account settings show **Type** and the **Create key** menu offers **Model Gateway key** and **Platform API key**, your workspace has it. Until then, a personal key can hold model access and platform scopes at the same time and uses the [classic endpoints](#hosts). Dedicated deployments use the classic endpoints for now.

## Which key do I need?

| You want to | Use | Endpoint |
| - | - | - |
| Use Claude Code, Codex, Cursor, GitHub Copilot or OpenCode with workspace models | Personal Model Gateway key | `https://gateway.langdock.com` |
| Call models from your own script or app under your name | Personal Model Gateway key | `https://gateway.langdock.com/v1` |
| Run a Langdock agent from your own code or an MCP client | Personal Model Gateway key with **Run agents**, or a Platform API key with an Agent scope | `https://api.langdock.com/agent/v1/...` |
| Create embeddings | Model Gateway key with **Embedding**, or a workspace key with the Embedding API scope | `https://api.langdock.com/openai/{region}/v1/embeddings` |
| Manage agents, workflows, knowledge folders, skills, prompts or integrations as yourself | Personal Platform API key | `https://api.langdock.com` |
| Run a shared backend, chatbot or automation that must keep working when someone leaves | Workspace key, created by an admin | `https://api.langdock.com` |
| Manage users, export usage, read audit logs or call the Billing, Governance or Compliance API | Workspace key with that scope | `https://api.langdock.com` |

If you are not sure, start with a personal Model Gateway key for anything that calls a model, and a Platform API key for everything else.

## The two kinds side by side

| | Model Gateway key | Platform API key |
| - | - | - |
| **Calls** | Models through the OpenAI, Anthropic, Google and Mistral compatible APIs. Optional: embeddings, agent runs | The Langdock APIs for agents, workflows, knowledge folders, skills, prompts, integrations, meetings, scheduled tasks and, on workspace keys, the admin APIs |
| **Scopes** | Completion API (always), Embedding API and Run agents when your admin allows them | Every other scope your admin allows |
| **Endpoint for model calls** | `https://gateway.langdock.com` for personal keys, classic endpoint for workspace keys | Not used for model calls |
| **Costs** | Every call costs money. Spend counts toward the owner's [spend limit](https://docs.langdock.com/en/developer/model-gateway/limits-and-usage.md) | Most calls are free. Agent runs and workflow runs cost the same as in the app |
| **Who governs it** | Spend: access list, spend limits, per model quotas on the **Model Gateway** page | Data access: scopes, resource sharing and expiry on the **Platform API** page |
| **Typical use** | Coding tools, your own AI features, scripts | Automating Langdock, syncing knowledge, managing agents |

## Personal keys and workspace keys

| | Personal key | Workspace key |
| - | - | - |
| **Acts as** | You, with your permissions. It reaches only the agents, folders and models you can use in Langdock | Its own service account. It reaches what is shared with the key |
| **Created by** | You, in [Settings > Account > API keys](https://docs.langdock.com/en/using-langdock/account/personal-api-keys.md), once an admin gives you access | A workspace admin |
| **Spend counts toward** | Your spend limit and the workspace's total spend limit, shared with your chat usage. On Langdock Cloud this is extra usage, on BYOK and dedicated deployments your usage limit | The workspace's monthly spend limit for workspace API keys |
| **Can hold** | Scopes your admin allows for personal keys. Never User Management, Usage Export, Audit Log, Compliance, Governance, Billing, Manage Agents or Workflow Deletion | Any scope |
| **Stops working when** | It expires or is revoked, you leave the workspace or are deactivated, or your admin removes your access | It expires or is revoked. It does not depend on any person |

Never share a personal key. Anyone who has it works as you and spends your budget. For anything shared, ask an admin for a workspace key. See [API key best practices](https://docs.langdock.com/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices.md).

## Hosts

Langdock serves the API on two hosts:

| Host | What it serves | Keys |
| - | - | - |
| `https://gateway.langdock.com` | Model calls only: `/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/models`. EU by default, `/us/v1/...` and `/global/v1/...` for other regions. Any enabled model works with any of these formats | Personal keys with model access |
| `https://api.langdock.com` | Everything else: agent runs, embeddings, the Platform APIs, and the classic model endpoints `/openai/{region}/v1/...`, `/anthropic/{region}/v1/...`, `/google/{region}/...`, `/mistral/{region}/...` | All keys |

So a Model Gateway key with **Run agents** calls models on `gateway.langdock.com` and agents on `api.langdock.com`. The same key works on both hosts.

On the classic endpoints each model is reachable only in its provider's own format, for example Claude through `/anthropic/{region}/v1/messages`. On dedicated deployments, replace `https://api.langdock.com` with `https://<your-domain>/api/public`.

> [!NOTE]
>
> `gateway.langdock.com` does not serve workspace keys or embeddings yet. Those requests get `403 model_gateway_unsupported`. Send them to `api.langdock.com` instead.

## Keys created before the split

A key created before the split can hold model access and platform scopes at the same time. It shows the **Gateway + Platform** badge. It keeps working on both hosts, and its scopes can only be reduced, not extended. Replace it with one Model Gateway key and one Platform API key when you can. See [Move from a combined key](https://docs.langdock.com/en/developer/overview/migrate-combined-keys.md).

## Frequently asked questions

> [accordion] Can I tell the kind from the key itself?
>
> No. Both kinds look like `sk-...`. The kind comes from the key's scopes and is shown in the **Type** column of your keys.

> [accordion] Why are agent runs on a Model Gateway key?
>
> An agent run costs money like a model call, so it sits with the key that is governed by spend limits. Managing agents (create, update, publish) stays on Platform API keys.

> [accordion] Do agent runs have rate limits?
>
> Yes. Agent runs through the API count toward the model's requests per minute and tokens per minute and toward the same spend limits as model calls. See [Limits and usage](https://docs.langdock.com/en/developer/model-gateway/limits-and-usage.md).

> [accordion] Do I need a new key for gateway.langdock.com?
>
> No. Any personal key with model access works there, including keys created before the split, as long as the Model Gateway is enabled for you.


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