> For the complete documentation index, see [llms.txt](https://docs.blockbrain.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blockbrain.ai/de/for-admins/llm-api.md).

# LLM-API

Rufen Sie die KI-Modelle Ihrer Organisation direkt auf, aus Ihrem eigenen Code oder aus Tools wie Coding-Assistenten. Die LLM API unterstützt die Formate von OpenAI, Anthropic und Google Gemini, sodass die meisten bestehenden SDKs und Tools funktionieren, indem Sie die Basis-URL und den Schlüssel ändern.

{% hint style="info" %}
Die LLM API muss für Ihre Organisation aktiviert sein. Wenn das nicht der Fall ist, antworten Anfragen `403` mit `llm_api_not_enabled`. Kontaktieren Sie Blockbrain, um sie zu aktivieren.
{% endhint %}

#### Basis-URL

| Hosting      | Basis-URL                                    |
| ------------ | -------------------------------------------- |
| Blockbrain   | `https://api.theblockbrain.ai/genai/v1`      |
| STACKIT (EU) | `https://api.eu-1.theblockbrain.ai/genai/v1` |

#### Authentifizierung

Verwenden Sie einen persönlichen Zugriffstoken von [API-Zugriff](https://docs.blockbrain.ai/de/for-users/api-zugriff.md). Senden Sie ihn in einem dieser Header:

* `Authorization: Bearer <token>`, wie im OpenAI-Format
* `x-api-key: <token>`, wie im Anthropic-Format
* `x-goog-api-key: <token>`, wie im Gemini-Format

#### Endpunkte

| Format    | Endpunkt                                                                             |
| --------- | ------------------------------------------------------------------------------------ |
| OpenAI    | `POST /chat/completions`, `POST /completions`, `POST /responses`, `POST /embeddings` |
| Anthropic | `POST /messages`, `POST /messages/count_tokens`                                      |
| Gemini    | `POST /v1beta/models/{model}:generateContent` und `:streamGenerateContent`           |
| Alle      | `GET /models` listet die Modelle auf, die Ihr Token aufrufen kann                    |

Verwenden Sie für die Gemini-Endpunkte `https://api.theblockbrain.ai/genai` als Basis und fügen Sie den obigen Pfad hinzu.

#### Welche Modelle Sie aufrufen können

Sie können die Modelle aufrufen, die in Ihrer Organisation in [KI-Modelle](https://docs.blockbrain.ai/de/for-admins/ki-modelle.md)aktiviert sind, sowie die Auto-Router Ihrer Organisation. `GET /models` liefert die genaue Liste für Ihr Token zurück. Ein Modell, das nicht auf der Liste steht, antwortet `403`.

#### Beispiel

```bash
curl https://api.theblockbrain.ai/genai/v1/chat/completions \\
  -H \"Authorization: Bearer $BLOCKBRAIN_TOKEN\" \\
  -H \"Content-Type: application/json\" \\
  -d '{
    \"model\": \"google-gemini-3.8-flash\",
    \"messages\": [{ \"role\": \"user\", \"content\": \"Hello\" }]
  }'
```

#### Kosten und Limits

Jeder Aufruf verbraucht Compute Blocks, bepreist nach dem Modell, das ihn beantwortet hat. Die Nutzung wird auf Ihr eigenes Limit angerechnet und, falls eines festgelegt ist, auf das Limit des Tokens. Wenn ein Limit erreicht ist, antworten Anfragen `429`. Siehe [Limit festlegen](https://docs.blockbrain.ai/de/for-admins/cost-control/limit-festlegen.md).

#### Fehler

| Status | Bedeutung                                                                                                |
| ------ | -------------------------------------------------------------------------------------------------------- |
| `401`  | Das Token fehlt, ist ungültig oder abgelaufen                                                            |
| `403`  | Die LLM API ist für Ihre Organisation nicht aktiviert, oder das Modell ist für Ihr Token nicht verfügbar |
| `429`  | Ein Compute-Block-Limit ist erreicht                                                                     |
| `503`  | Die LLM API ist vorübergehend nicht verfügbar, versuchen Sie es in Kürze erneut                          |

{% hint style="info" %}
Um über eine API mit Knowledge Bots, Wissensdatenbanken und Workflows zu arbeiten, siehe die [Knowledge Bots API](https://api.docs.blockbrain.ai).
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.blockbrain.ai/de/for-admins/llm-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
