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

# API Keys

> Connect VARIOS AI to your applications via API key

<Tip>Home > "Admin Menu" > "API Keys"</Tip>

## API Keys

API keys enable direct access to **assistants** and **pre-configured chat models** through the API, so you can integrate VARIOS AI into third-party applications such as chatbots, helpdesk systems, or web portals. Assistants and chat models configured in VARIOS AI can be wired into existing workflows behind a single OpenAI-compatible endpoint.

<Info>**Info:** The VARIOS AI API is OpenAI compatible.</Info>

<Note>
  **Note:** Each API key requires its own license. Make sure
  that sufficient licenses are available for the planned integrations.
</Note>

***

## Features at a glance

* **List view**: Displays all existing API keys with names. Each key can be edited or deleted.
* **Search**: Enables quick retrieval of individual keys.
* **New API Key**: Use the *“New API Key”* button to create an additional key.

***

## Create API key

When creating a new API key, the following options are available:

1. **Name**\
   Freely chosen label to identify the API key, e.g., *Shopware Integration*.
2. **Maximum costs per month (\$)**
   * Limit the monthly costs for this key.
   * Value `0` means that no costs are allowed.
   * Value `-1` means no limit.

<Note>
  **Note** Projection based on tokens and may differ from actual
  billing costs.
</Note>

3. **Assistants of the API key**\
   Select which assistants can be used with this key. Only shared assistants can be accessed by the connected application.
4. **Models of the API key**\
   Select which chat models can be used with this key. Only models that support the Chat Completions API are compatible with the API.
5. **Tools of the API key**\
   Select which tools (connectors, knowledge bases) may be used with this key when using **chat models** (not assistants). In the expandable tool options you can enable DLP to protect sensitive data, block client-defined tools from being used, or expose all selected application tools to the model by default.

***

## Typical use cases

* **Web chatbots** with access to internal knowledge bases
* **Integration into CRM or ERP systems** for automated processing of customer inquiries
* **Customer support portals** that provide assistants for FAQs or self-service
* **Integration into automation tools** for the intelligent control of automated workflows
* **Integration into IDEs** for AI-supported assistance during development

***

## Calling the Chat Completions API

Use the OpenAI-compatible endpoint `/api/v1/chat/completions`. Replace the base URL with your VARIOS AI instance address (e.g. `https://varios-ai.example.com`).

**Authentication:** Pass the API key in the `Authorization` header as a Bearer token.

**Model parameter:** Set `model` to either an **assistant ID** or a **chat model ID** (a pre-configured model that supports Chat Completions). Only assistants and chat models assigned to the API key can be used.

* The **chat model ID** can be found in the URL of the respective model settings page. (e.g. `varios-ai.example.com/admin/models/**782d877e-b54f-4598-a32e-4a7d16e221e3**`)
* The **assistant ID** can be found in the URL of the respective assistant settings page. (e.g. `varios-ai.example.com/admin/assistants/**584ab525-7988-4e5d-8140-b03e4c9ee66c**`)

**Optional parameters:**

* `stream`: `true` for streaming responses, `false` for a complete response in a single reply.
* `dlp_active`: `true` enables Data Loss Prevention checks for the request, `false` disables them.

**Tools:** Unlike assistant-only flows, requests against a **chat model** may include a `tools` array in the JSON body with your own function definitions and references to **application tools**. To attach an application tool, add a tool whose `name` is **only** the reserved name; VARIOS AI resolves it to the full schema. Name formats:

* **Knowledge base:** `kb_<knowledge-base-id>`
* **MCP tool:** `mcp_<mcp-tool-id>`
* **OpenAPI endpoint:** `openapi_<openapi-endpoint-id>`
* **Code connector** (e.g. FLUX connector): `pf_<connector-id>`

Custom tools are passed in the same way as with OpenAI, including `parameters` (JSON Schema). The ID can be taken from the URL of the respective tool, analogous to the chat model ID and assistant ID.

<Note>
  **Note** Settings on the **chat model** and **API key** override conflicting values from the incoming request. For example, if DLP is enabled on the API key, every request authenticated with that key is subject to VARIOS AI data-protection guardrails regardless of `dlp_active` in the payload.
</Note>

### Example: assistant

Set `model` to the assistant ID. Tooling follows the assistant configuration; a `tools` array in the request is not used for assistant calls in the same way as for chat models.

### Example: chat model

Set `model` to the chat model ID. You may send `tools` with application tool names and your own function definitions as described above.

<Note>
  **Note** Chat completions using chat models do **not** remove unused fields from the request. This means that any provider‑specific parameters, such as `response_format`, `safety_identifier`, or similar, are forwarded exactly as provided. VARIOS AI acts solely as a middleware layer between the client and the model provider and only processes a limited set of predefined fields.
</Note>

<RequestExample>
  ```bash Assistant theme={null}
  curl -X POST 'https://example.com/api/v1/chat/completions' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer YOUR_API_KEY' \
    -d '{
      "model": "ASSISTANT_ID",
      "stream": false,
      "dlp_active": false,
      "messages": [
        {
          "content": "Why is the sky blue?",
          "role": "user"
        }
      ]
    }'
  ```

  ```bash Chat Model theme={null}
  curl -X POST 'https://example.com/api/v1/chat/completions' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer YOUR_API_KEY' \
    -d '{
      "model": "CHAT_MODEL_ID",
      "stream": false,
      "dlp_active": false,
      "messages": [
        {
          "content": "Why is the sky blue?",
          "role": "user"
        }
      ],
      "response_format": "your-response-format",
      "tools": [
        {"type": "function", "function": {"name": "mcp_<mcp-tool-id>"}},
        {"type": "function", "function": {"name": "openapi_<openapi-endpoint-id>"}},
        {"type": "function", "function": {"name": "pf_<connector-id>"}},
        {"type": "function", "function": {"name": "kb_<kb-id>"}},
        {
          "type": "function",
          "function": {
            "name": "your_own_tool",
            "description": "Example client-defined tool",
            "parameters": {
              "type": "object",
              "properties": {"query": {"type": "string"}},
              "required": ["query"]
            }
          }
        }
      ]
    }'
  ```
</RequestExample>

***

## Management

* **Edit**: Adjust name, cost limit, assigned assistants, chat models, and tools.
* **Delete**: Permanently removes the API key (access is immediately revoked).
