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.
Qwen 3 시리즈
Qwen3는 동적 사고 모드로 오픈 LLM을 재정의하며, 코드, 수학, 다국어 추론에서 탁월합니다. 희소한 22B 활성 매개변수로 구동되어 번개같은 속도와 깊은 지능의 균형을 맞춥니다 — 경량에서 235B 거대 모델까지 완전 오픈소스입니다.
1. 기본 사용: OpenAI 호환 형식으로 전달합니다.
2. 도구 호출: 일반 도구는 OpenAI 호환 형식을 지원하며, MCP 도구는 qwen-agent에 의존하고 먼저 다음 명령을 사용하여 종속성을 설치해야 합니다:
pip install -U qwen-agent mcp.
자세한 내용은 Ali 공식 문서를 참조하세요
from openai import OpenAI
client = OpenAI(
api_key="sk-***", # 🔑 AiHubMix 키로 교체하세요
base_url="https://aihubmix.com/v1",
)
completion = client.chat.completions.create(
model="Qwen/Qwen3-30B-A3B",
messages=[
{
"role": "user",
"content": "오컴의 면도날 개념을 설명하고 일상생활에서의 예시를 제공해주세요"
}
],
stream=True
)
for chunk in completion:
if hasattr(chunk.choices, '__len__') and len(chunk.choices) > 0:
if hasattr(chunk.choices[0].delta, 'content') and chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
Qwen 2.5 및 QwQ/QvQ 시리즈
OpenAI 호환 형식을 사용하여 전달하며, 차이점은 스트리밍 호출에서 chunk.choices[0].delta.content를 추출해야 한다는 것입니다. 다음을 참조하세요.
1. QvQ,Qwen 2.5 VL: 이미지 인식.
2. QwQ: 텍스트 작업.
from openai import OpenAI
import base64
import os
client = OpenAI(
api_key="sk-***", # 🔑 AiHubMix 키로 교체하세요
base_url="https://aihubmix.com/v1",
)
image_path = "yourpath/file.png"
def encode_image(image_path):
if not os.path.exists(image_path):
raise FileNotFoundError(f"이미지 파일이 존재하지 않습니다: {image_path}")
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
# 이미지의 base64 인코딩 가져오기
base64_image = encode_image(image_path)
completion = client.chat.completions.create(
model="qwen2.5-vl-72b-instruct", #qwen2.5-vl-72b-instruct OR Qwen/QVQ-72B-Preview
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "이 이미지를 자세히 설명해주세요"},
{
"type": "image_url",
"image_url": {
"url": f"data:image/png;base64,{base64_image}"
}
}
]
}
],
stream=True
)
for chunk in completion:
if hasattr(chunk.choices, '__len__') and len(chunk.choices) > 0:
if hasattr(chunk.choices[0].delta, 'content') and chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")