> For the complete documentation index, see [llms.txt](https://docs.kontinent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kontinent.ai/documentation/dokumentation/overview/authentication.md).

# Authentifizierung

Jede Anfrage an die Data Plane authentifiziert sich mit einem Bearer-Token:

```
Authorization: Bearer sk-kt-<43 base62 chars>
```

## Wichtige Fakten

* Schlüssel sind insgesamt **49 Zeichen** lang (`sk-kt-` plus 43 Base62-Zeichen).
* Ein Schlüssel wird bei der Erstellung **genau einmal** angezeigt. Gespeichert wird nur ein SHA-256-Hash. Kontinent kann einen verlorenen Schlüssel nicht wiederherstellen, bewahren Sie ihn also sicher auf.
* Schlüssel **laufen nicht ab**. Widerrufen Sie sie im Dashboard; ein Widerruf wird innerhalb von etwa **30 Sekunden** wirksam (die TTL des Auth-Caches).
* Jede Anfrage ist an die **Organisation** des Schlüssels gebunden, die das Guthaben, das Rate-Limit und die Nutzungszuordnung besitzt.

{% hint style="warning" %}
Behandeln Sie einen `sk-kt-`-Schlüssel wie ein Passwort. Wer ihn besitzt, kann das Guthaben Ihrer Organisation ausgeben. Bevorzugen Sie Umgebungsvariablen oder einen Secrets-Manager, statt Schlüssel in die Versionsverwaltung einzuchecken.
{% endhint %}

## Den Schlüssel verwenden

{% tabs %}
{% tab title="TypeScript" %}

```typescript
const client = new OpenAI({
  baseURL: "https://api.kontinent.ai/v1",
  apiKey: process.env.KONTINENT_API_KEY,
});
```

{% endtab %}

{% tab title="Python" %}

```python
client = OpenAI(
    base_url="https://api.kontinent.ai/v1",
    api_key=os.environ["KONTINENT_API_KEY"],
)
```

{% endtab %}

{% tab title="curl" %}

```bash
curl https://api.kontinent.ai/v1/models \
  -H "Authorization: Bearer $KONTINENT_API_KEY"
```

{% endtab %}
{% endtabs %}

## Wenn die Authentifizierung fehlschlägt

Ein ungültiger oder widerrufener Schlüssel liefert `401` mit dem Code `invalid_api_key`. **Nicht erneut versuchen.** Das Ergebnis ändert sich nicht, bis Sie einen gültigen Schlüssel angeben.

| Status | `code`                 | Bedeutung                                                                      |
| ------ | ---------------------- | ------------------------------------------------------------------------------ |
| `401`  | `invalid_api_key`      | Ungültiger oder widerrufener Schlüssel. Ein erneuter Versuch hilft nicht.      |
| `402`  | `insufficient_credits` | Der Schlüssel ist gültig, aber das Guthaben der Organisation ist erschöpft.    |
| `502`  | `upstream_auth_error`  | Ein Anbieter hat **unsere** Anmeldedaten abgelehnt, nicht Ihre. Unser Problem. |

Siehe [Fehler behandeln](/documentation/dokumentation/features/errors.md) für die vollständige Taxonomie.

## Verwandte Seiten

{% content-ref url="/pages/C60Fkrhcy4lYisPZjqIi" %}
[Rate-Limits & Guthaben](/documentation/dokumentation/features/rate-limits.md)
{% endcontent-ref %}

{% content-ref url="/pages/1U0JLQ6A6ZWMnoz8dGsI" %}
[API-Referenz](/documentation/dokumentation/reference/api-reference.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kontinent.ai/documentation/dokumentation/overview/authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
