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

# Modellverwaltungs-API

> Diese API-Dokumentation beschreibt die Modellverwaltungs-Schnittstelle detailliert, einschließlich Funktionen, Request-Beispielen, Parametern und Antwortformaten der neuen und der alten API-Version.

## Neue API-Version

### Modellinformationen abrufen

**Endpoint**: `GET https://aihubmix.com/api/v1/models`

**Beschreibung**: Liefert detaillierte Informationen zu allen verfügbaren Modellen.

### Beschreibung der Felder im Modell-Objekt

<ResponseField name="data" type="array">
  Ein Array von Modellinformationsobjekten.
</ResponseField>

<ResponseField name="model_id" type="string">
  Eindeutige Kennung des Modells.
</ResponseField>

<ResponseField name="desc" type="string">
  Beschreibung der Modellfunktionalität (in Englisch).
</ResponseField>

<ResponseField name="types" type="string">
  Modelltyp. Unterstützte Werte: `llm` (Large Language Model), `image_generation`, `video`, `tts` (Text-to-Speech), `stt` (Speech-to-Text), `embedding`, `rerank`.
</ResponseField>

<ResponseField name="features" type="string">
  Unterstützte Funktionen. Mögliche Werte: `thinking` (Reasoning), `tools` (Tool-Nutzung), `function_calling`, `web` (Websuche), `deepsearch`, `long_context`, `structured_outputs`.
</ResponseField>

<ResponseField name="input_modalities" type="string">
  Unterstützte Eingabemodalitäten. Mögliche Werte: `text`, `image`, `audio`, `video`, `pdf`.
</ResponseField>

<ResponseField name="max_output" type="string">
  Maximale Anzahl an Ausgabe-Token.
</ResponseField>

<ResponseField name="context_length" type="string">
  Größe des Kontextfensters (maximale Anzahl an Eingabe-Token).
</ResponseField>

<ResponseField name="pricing" type="object">
  Objekt mit Preisinformationen.
</ResponseField>

<ResponseField name="pricing.input" type="number">
  Preis für Eingabe-Token (pro 1K Token, in USD).
</ResponseField>

<ResponseField name="pricing.output" type="number">
  Preis für Ausgabe-Token (pro 1K Token, in USD).
</ResponseField>

<ResponseField name="pricing.cache_read" type="number">
  Preis für Cache-Lesezugriffe (pro 1K Token, in USD, optionales Feld).
</ResponseField>

<ResponseField name="pricing.cache_write" type="number">
  Preis für Cache-Schreibzugriffe (pro 1K Token, in USD, optionales Feld).
</ResponseField>

### Request-Beispiele

<CodeGroup>
  ```python Python theme={null}
  import requests

  # API Endpoint
  url = "https://aihubmix.com/api/v1/models"

  response = requests.get(url)
  print(response.json())

  # Example with parameters
  params = {
      "type": "llm",                   
  	"modalities": "text",
  	"model": "gpt-5",
  	"features": "thinking",
      "sort_by": "context_length",
      "sort_order": "desc"    
  }
  response = requests.get(url, params=params)
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  fetch('https://aihubmix.com/api/v1/models')
    .then(response => response.json())
    .then(data => console.log(data));

  // Example with parameters
  const params = new URLSearchParams({
    type: 'llm',
    modalities: 'text',
    model: 'gpt-5',
    features: 'thinking',
    sort_by: 'context_length',
    sort_order: 'desc' 
  });

  fetch(`https://aihubmix.com/api/v1/models?${params}`)
    .then(response => response.json())
    .then(data => console.log(data));
  ```

  ```bash cURL theme={null}
  # Get all models
  curl -X GET "https://aihubmix.com/api/v1/models"

  # Get models with specific filters
  curl -X GET "https://aihubmix.com/api/v1/models?type=llm&modalities=text&model=gpt-5&features=thinking&sort_by=context_length&sort_order=desc"
  ```
</CodeGroup>

### Request-Parameter (zur Filterung)

<ParamField query="type" path="string" type="string">
  Modelltyp. Mögliche Werte: `llm` (Large Language Model), `image_generation`, `video`, `tts` (Text-to-Speech), `stt` (Speech-to-Text), `embedding`, `rerank`.
</ParamField>

<ParamField query="modalities" path="param" type="string">
  Eingabemodalitäten. Mögliche Werte: `text`, `image`, `audio`, `video`, `pdf`. Mehrere Modalitäten werden durch Komma getrennt.
</ParamField>

<ParamField query="model" path="param" type="string">
  Unscharfe Suche nach Modellname (unterstützt Teilübereinstimmung).
</ParamField>

<ParamField query="features" path="param" type="string">
  Modell-Features. Mögliche Werte: `thinking` (Reasoning), `tools` (Tool-Nutzung), `function_calling`, `web` (Websuche), `deepsearch`, `long_context`, `structured_outputs`. Mehrere Features werden durch Komma getrennt.
</ParamField>

<ParamField query="sort_by" path="string" type="string">
  Sortierfeld. Mögliche Werte:

  * `model_ratio`: nach Kosteneffizienz sortieren.
  * `context_length`: nach Kontextlänge sortieren.
  * `coding`: Coding-Modelle priorisieren.
  * `order`: Standardreihenfolge.
</ParamField>

<ParamField query="sort_order" path="string" type="string">
  Sortierreihenfolge. Mögliche Werte:

  * `asc` (aufsteigend)
  * `desc` (absteigend)
</ParamField>

### Beispiel einer erfolgreichen Antwort

```json theme={null}
{
    "data": [
        {
            "model_id": "gpt-5",
            "desc": "GPT-5 is OpenAI's flagship model for coding, reasoning, and agentic tasks across domains.",
            "pricing": {
                "cache_read": 0.125,
                "input": 1.25,
                "output": 10
            },
            "types": "llm",
            "features": "thinking,tools,function_calling,structured_outputs",
            "input_modalities": "text,image",
            "max_output": 128000,
            "context_length": 400000
        },
        {
            "model_id": "gpt-5-codex",
            "desc": "GPT-5-Codex is a version of GPT-5 optimized for autonomous coding tasks in Codex or similar environments. It is only available in the Responses API, and the underlying model snapshots will be updated regularly. https://docs.aihubmix.com/en/api/Responses-API You can also use it in codex-cll; see https://docs.aihubmix.com/en/api/Codex-CLI for using codex-cll through Aihubmix.",
            "pricing": {
                "cache_read": 0.125,
                "input": 1.25,
                "output": 10
            },
            "types": "llm",
            "features": "thinking,tools,function_calling,structured_outputs",
            "input_modalities": "text,image",
            "max_output": 128000,
            "context_length": 400000
        }
    ],
    "message": "",
    "success": true
}
```

### Anwendungsbeispiele

<CodeGroup>
  ```bash Alle LLMs abrufen theme={null}
  GET https://aihubmix.com/api/v1/models?type=llm
  ```

  ```bash Modelle für Coding, sortiert nach Kontextlänge theme={null}
  GET https://aihubmix.com/api/v1/models?tag=coding&sort_by=context_length&sort_order=desc
  ```

  ```bash Suche nach einem bestimmten Modell theme={null}
  GET https://aihubmix.com/api/v1/models?model=gpt-5
  ```

  ```bash Zusammengesetzte Abfrage theme={null}
  GET https://aihubmix.com/api/v1/models?type=llm&modalities=text,image&features=function_calling&sort_by=model_ratio&sort_order=asc
  ```

  ```bash Smart-Sort für Coding-Modelle theme={null}
  GET https://aihubmix.com/api/v1/models?sort_by=coding
  ```
</CodeGroup>

> **Hinweis**: Beim Smart-Sort für Coding-Modelle werden Modelle mit dem Tag `coding` priorisiert; die übrigen Modelle erscheinen in der Standardreihenfolge.

### Performance-Optimierung

#### Caching-Mechanismus

* **Cache-Policy**: HTTP-Caching, Cache-Dauer 300 Sekunden (5 Minuten).
* **Cache-Steuerung**: `Cache-Control: public, max-age=300, stale-while-revalidate=300`
* **Inhaltsvalidierung**: Unterstützt ETag-Validierung des Inhaltshashes.

#### Beispiel zur Cache-Nutzung

```bash theme={null}
# Conditional request using ETag
curl -H "If-None-Match: \"abc123...\"" \
     https://aihubmix.com/api/v1/models
```

> Wurde der Inhalt nicht aktualisiert, gibt der Server den Statuscode `304 Not Modified` zurück.

### Fehlerbehandlung

<CodeGroup>
  ```json 400 Bad Request (Invalid Parameters) theme={null}
  {
    "success": false,
    "message": "Invalid request parameter format"
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "success": false,
    "message": "Internal server error, please try again later"
  }
  ```
</CodeGroup>

### Wichtige Hinweise

1. **Datenintegrität**: Dieser Endpoint gibt alle passenden Modelle zurück, ohne Pagination.
2. **Typ-Kompatibilität**: Unterstützt automatisches Mapping zwischen neuen und alten Typkennungen:
   * `t2t` ↔ `llm`
   * `t2i` ↔ `image_generation`
   * `t2v` ↔ `video`
   * `reranking` ↔ `rerank`
3. **Filter-Logik**: Mehrere Filterbedingungen werden mit logischem UND kombiniert.
4. **Sortierregel**: Ist keine Sortierung angegeben, werden die Modelle in der Standardreihenfolge des Systems geliefert.

***

## Legacy-API-Version

> ⚠️ **Hinweis**: Im Folgenden handelt es sich um Legacy-API-Endpoints. Wir empfehlen die Nutzung der neuen API-Version für bessere Leistung und Funktionen.

### Modellliste abrufen

**Endpoint**: `GET /v1/models`

* Ist ein Benutzer angemeldet, wird die Liste der für die Gruppe des Benutzers verfügbaren Modelle abgerufen. Andernfalls wird die Liste der Gruppe `default` abgerufen.
* Enthält der Header das Feld `Authorization`, wird die Modellliste des zugehörigen Tokens abgefragt.

**Antwortbeispiel:**

```json theme={null}
{
  "data": [
    {
      "id": "gpt-4o-mini",
      "object": "model",
      "created": 1626777600,
      "owned_by": "OpenAI",
      "permission": [
        {
          "id": "modelperm-LwHkVFn8AcMItP432fKKDIKJ",
          "object": "model_permission",
          "created": 1626777600,
          "allow_create_engine": true,
          "allow_sampling": true,
          "allow_logprobs": true,
          "allow_search_indices": false,
          "allow_view": true,
          "allow_fine_tuning": false,
          "organization": "*",
          "group": null,
          "is_blocking": false
        }
      ],
      "root": "gpt-4o-mini",
      "parent": null
    }
  ]
}
```

### Antwort

| Statuscode | Bedeutung | Beschreibung | Datenmodell |
| ---------- | --------- | ------------ | ----------- |
| 200        | OK        | keine        | Inline      |

### Antwort-Datenstruktur

**Statuscode 200**

| Name                       | Typ            | Pflicht | Beschreibung          |
| -------------------------- | -------------- | ------- | --------------------- |
| » data                     | \[object]      | true    | keine                 |
| »» id                      | string         | true    | Modell-ID             |
| »» object                  | string         | true    | `model`               |
| »» created                 | integer        | true    | Erstellungs-Timestamp |
| »» owned\_by               | string         | true    | Entwickler            |
| »» permission              | \[object]¦null | true    | keine                 |
| »»» id                     | string         | true    | keine                 |
| »»» object                 | string         | true    | keine                 |
| »»» created                | integer        | true    | keine                 |
| »»» allow\_create\_engine  | boolean        | true    | keine                 |
| »»» allow\_sampling        | boolean        | true    | keine                 |
| »»» allow\_logprobs        | boolean        | true    | keine                 |
| »»» allow\_search\_indices | boolean        | true    | keine                 |
| »»» allow\_view            | boolean        | true    | keine                 |
| »»» allow\_fine\_tuning    | boolean        | true    | keine                 |
| »»» organization           | string         | true    | keine                 |
| »»» group                  | null           | true    | keine                 |
| »»» is\_blocking           | boolean        | true    | keine                 |
| »» root                    | string         | true    | Root-Modellname       |
| »» parent                  | null           | true    | Übergeordnetes Modell |

### Modellinformationen abrufen

**Endpoint**: `GET /v1/models/:model`

### Request-Parameter

| Name  | In   | Typ    | Pflicht | Beschreibung |
| ----- | ---- | ------ | ------- | ------------ |
| model | path | string | true    | Modell-ID    |

**Antwortbeispiel:**

```json theme={null}
200 Response
```

```json theme={null}
{
  "id": "string",
  "object": "string",
  "created": 0,
  "owned_by": "string",
  "permission": [
    {
      "id": "string",
      "object": "string",
      "created": 0,
      "allow_create_engine": true,
      "allow_sampling": true,
      "allow_logprobs": true,
      "allow_search_indices": true,
      "allow_view": true,
      "allow_fine_tuning": true,
      "organization": "string",
      "group": null,
      "is_blocking": true
    }
  ],
  "root": "string",
  "parent": null
}
```

### Antwort

| Statuscode | Bedeutung | Beschreibung | Datenmodell |
| ---------- | --------- | ------------ | ----------- |
| 200        | OK        | keine        | Inline      |

### Antwort-Datenstruktur

**Statuscode 200**

| Name                     | Typ       | Pflicht | Beschreibung          |
| ------------------------ | --------- | ------- | --------------------- |
| id                       | string    | true    | Modell-ID             |
| object                   | string    | true    | `model`               |
| created                  | integer   | true    | Erstellungs-Timestamp |
| owned\_by                | string    | true    | Entwickler            |
| permission               | \[object] | true    | keine                 |
| » id                     | string    | false   | keine                 |
| » object                 | string    | false   | keine                 |
| » created                | integer   | false   | keine                 |
| » allow\_create\_engine  | boolean   | false   | keine                 |
| » allow\_sampling        | boolean   | false   | keine                 |
| » allow\_logprobs        | boolean   | false   | keine                 |
| » allow\_search\_indices | boolean   | false   | keine                 |
| » allow\_view            | boolean   | false   | keine                 |
| » allow\_fine\_tuning    | boolean   | false   | keine                 |
| » organization           | string    | false   | keine                 |
| » group                  | null      | false   | keine                 |
| » is\_blocking           | boolean   | false   | keine                 |
| root                     | string    | true    | Root-Modellname       |
| parent                   | null      | true    | Übergeordnetes Modell |

***

Zuletzt aktualisiert: 2026-06-01
