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

# Aihubmix 완전 통합 가이드

> Aihubmix의 범용 모델 호출 방식을 원스톱으로 이해

Aihubmix는 OpenAI 모델 호출 인터페이스를 표준으로 하여, OpenAI, Google Gemini, Anthropic Claude 등 여러 모델을 통합했습니다. 모든 모델 호출은 동일한 방식을 사용하며, 해당하는 `모델 ID`만 수정하면 됩니다.

<Tip>
  핵심 포인트: 클라이언트 내부에 전달용 `base_url`과 AiHubMix 플랫폼의 [API 키](https://aihubmix.com/token)만 추가하면 됩니다.
  모델 ID는 [모델 광장의 카드](https://aihubmix.com/models)에서 「복사 버튼」을 클릭하여 얻을 수 있습니다.
</Tip>

## 기본 통합: OpenAI 공식 라이브러리 사용

### Python 예제

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

client = OpenAI(
    api_key="sk-***", # AiHubMix에서 생성한 API 키로 교체
    base_url="https://aihubmix.com/v1"
)

chat_completion = client.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": "Say this is a test",
        }
    ],
    model="gpt-4o-mini",  # 지원되는 임의의 모델 ID로 교체
)

print(chat_completion)
```

<Info>
  OpenAI 공식 현재 서비스 상태 [확인](https://status.openai.com/)
</Info>

## 범용 모델 전달 API

엔드포인트: `POST` /v1/chat/completions

**Body 요청 매개변수:**

```json theme={null}
{
  "model": "gpt-4o-mini",
  "messages": [
    {
      "role": "user",
      "content": "What is the meaning of life?"
    }
  ]
}
```

### 요청 매개변수

| 이름            | 위치     | 타입     | 필수  | 설명                        |
| ------------- | ------ | ------ | --- | ------------------------- |
| Authorization | header | string | 아니오 | Bearer AIHUBMIX\_API\_KEY |
| Content-Type  | header | string | 아니오 | none                      |
| body          | body   | object | 아니오 | none                      |

**응답 예제:**

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

```json theme={null}
{
  "id": "chatcmpl-AzJqsyf2h02BKjrqHMA1HVUQpiDfL",
  "model": "gpt-4o-mini",
  "object": "chat.completion",
  "created": 1739177682,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The meaning of life is a philosophical question that has been debated for centuries. Different people and cultures may have different beliefs about the purpose and significance of life. Some believe that the meaning of life is to seek happiness and fulfillment, while others believe in spiritual or religious meanings such as serving a higher power or fulfilling a destiny. Ultimately, the meaning of life may be a deeply personal and individual question that each person must answer for themselves."
      },
      "finish_reason": "stop"
    }
  ],
  "system_fingerprint": "fp_0165350fbb",
  "usage": {
    "prompt_tokens": 14,
    "completion_tokens": 86,
    "total_tokens": 100
  }
}
```

### 응답 결과

| 상태 코드 | 상태 코드 의미 | 설명   | 데이터 모델 |
| ----- | -------- | ---- | ------ |
| 200   | OK       | none | Inline |

***

마지막 업데이트: 2026-06-01
