Aihubmix는 OpenAI 모델 호출 인터페이스를 표준으로 하여, OpenAI, Google Gemini, Anthropic Claude 등 여러 모델을 통합했습니다. 모든 모델 호출은 동일한 방식을 사용하며, 해당하는 모델 ID만 수정하면 됩니다.
핵심 포인트: 클라이언트 내부에 전달용 base_url과 AiHubMix 플랫폼의 API 키만 추가하면 됩니다. 모델 ID는 모델 광장의 카드에서 「복사 버튼」을 클릭하여 얻을 수 있습니다.

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

Python 예제

Python
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)
OpenAI 공식 현재 서비스 상태 확인

범용 모델 전달 API

엔드포인트: POST /v1/chat/completions Body 요청 매개변수:
{
  "model": "gpt-4o-mini",
  "messages": [
    {
      "role": "user",
      "content": "What is the meaning of life?"
    }
  ]
}

요청 매개변수

이름위치타입필수설명
Authorizationheaderstring아니오Bearer AIHUBMIX_API_KEY
Content-Typeheaderstring아니오none
bodybodyobject아니오none
응답 예제:
200 Response
{
  "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
  }
}

응답 결과

상태 코드상태 코드 의미설명데이터 모델
200OKnoneInline