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

# Quick Start

> Generate an API key and make your first call

## Direct API Call to AIHubMix

<Note>
  All examples below use the primary domain `https://aihubmix.com`. If you run into access issues, replace the request URL with the backup domain `https://api.inferera.com` — all other parameters stay the same.
</Note>

<Tip>
  Replace `<AIHUBMIX_API_KEY>` with your [AIHubMix Key](https://aihubmix.com/token). Please note the key's validity period and usage limits.
</Tip>

For available `model` options, please check the [Model Gallery](https://aihubmix.com/models). Simply copy and paste the model name to use it.

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

For streaming responses, simply add the parameter `stream: true`

## Using OpenAI SDK

Replace `<AIHUBMIX_API_KEY>` with your [AIHubMix Key](https://aihubmix.com/token). Please note the key's validity period and usage limits. For available `model` options, please check the [Model Gallery](https://aihubmix.com/models). Simply copy and paste the model name to use it.

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

For models that support web search, you can add the following parameter:

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

Available models: `gpt-4o-search-preview`, `gpt-4o-mini-search-preview`.

<Info>
  Please note that search models currently do not support parameters like `temperature`.
</Info>

## Making Requests via Third-party Clients

## Refer to [Use Cases](/en/clients/AnythingLLM)

Last updated: 2026-06-01
