> ## 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.

# Schnellstart

> Erstellen Sie einen API-Schlüssel und führen Sie Ihren ersten Aufruf durch

## Direkter API-Aufruf an AIHubMix

<Note>
  Alle folgenden Beispiele verwenden die primäre Domain `https://aihubmix.com`. Bei Zugriffsproblemen ersetzen Sie die Anfrage-URL durch die Ersatzdomain `https://api.inferera.com` — alle anderen Parameter bleiben unverändert.
</Note>

<Tip>
  Ersetzen Sie `<AIHUBMIX_API_KEY>` durch Ihren [AIHubMix-Schlüssel](https://aihubmix.com/token). Beachten Sie bitte die Gültigkeitsdauer und die Nutzungslimits des Schlüssels.
</Tip>

Verfügbare `model`-Optionen finden Sie in der [Modell-Galerie](https://aihubmix.com/models). Kopieren Sie einfach den Modellnamen und fügen Sie ihn ein, um ihn zu verwenden.

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

  response = requests.post(
    url="https://aihubmix.com/v1/chat/completions",
    headers={
      "Authorization": "Bearer <AIHUBMIX_API_KEY>",
      "Content-Type": "application/json",
    },
    data=json.dumps({
      "model": "gpt-4o-mini", # replace model id
      "messages": [
        {
          "role": "user",
          "content": "What is the meaning of life?"
        }
      ]
    })
  )
  ```

  ```typescript Javascript theme={null}
  // Try this under https://aihubmix.com domain to avoid browser CORS issues
  fetch('https://aihubmix.com/v1/chat/completions', {
    method: 'POST',
    headers: {
      Authorization: 'Bearer <AIHUBMIX_API_KEY>',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: "gpt-4o-mini", // replace model id
      messages: [
        {
           "role": "user",
           "content": "What is the meaning of life?"
        }
      ]
    }),
  })
  ```

  ```Shell Curl theme={null}
  curl 'https://aihubmix.com/v1/chat/completions'
  -H 'Authorization: Bearer <AIHUBMIX_API_KEY>'
  -H 'Content-Type: application/json'
  -d '{
     "model": "gpt-4o-mini",
     "messages": [
        {
           "role": "user",
           "content": "What is the meaning of life?"
        }
     ]
  }'
  ```
</CodeGroup>

Für Streaming-Antworten fügen Sie einfach den Parameter `stream: true` hinzu

## Verwendung des OpenAI SDK

Ersetzen Sie `<AIHUBMIX_API_KEY>` durch Ihren [AIHubMix-Schlüssel](https://aihubmix.com/token). Beachten Sie bitte die Gültigkeitsdauer und die Nutzungslimits des Schlüssels. Verfügbare `model`-Optionen finden Sie in der [Modell-Galerie](https://aihubmix.com/models). Kopieren Sie einfach den Modellnamen und fügen Sie ihn ein, um ihn zu verwenden.

<CodeGroup>
  ```py Python theme={null}
  from openai import OpenAI

  client = OpenAI(
    base_url="https://aihubmix.com/v1",
    api_key="<AIHUBMIX_API_KEY>",
  )

  completion = client.chat.completions.create(
    model="gpt-4o-mini", # replace model id
    messages=[
      {
        "role": "developer",
        "content": "Always reply in Chinese"
      },    
      {
        "role": "user",
        "content": "What is the meaning of life?"
      }
    ],
    temperature=0.8,
    max_tokens=1024,
    top_p=1,
    frequency_penalty=0,
    presence_penalty=0,
    seed=random.randint(1, 1000000000),
  )

  print(completion.choices[0].message.content)
  ```

  ```js Javascript theme={null}
  import OpenAI from 'openai';

  const openai = new OpenAI({
    baseURL: 'https://aihubmix.com/v1',
    apiKey: '<AIHUBMIX_API_KEY>',
  });

  async function main() {
    const completion = await openai.chat.completions.create({
      model: "gpt-4o-mini", // replace model id
      messages: [
        {
           "role": "user",
           "content": "What is the meaning of life?"
        }
      ]
    });

    console.log(completion.choices[0].message);
  }

  main();
  ```
</CodeGroup>

Für Modelle, die Websuche unterstützen, können Sie den folgenden Parameter hinzufügen:

```Python theme={null}
  web_search_options={}, # search parameters
```

Verfügbare Modelle: `gpt-4o-search-preview`, `gpt-4o-mini-search-preview`.

<Info>
  Beachten Sie bitte, dass Suchmodelle derzeit keine Parameter wie `temperature` unterstützen.
</Info>

## Anfragen über Drittanbieter-Clients

## Siehe [Anwendungsfälle](/en/clients/AnythingLLM)

Zuletzt aktualisiert: 2026-06-01
