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.
これは最新のOpenAIパッケージの使用ガイドです。中国本土のユーザーは直接接続して使用でき、ビジネス構築がより簡単になります。
ポイント:client内に転送用のbase_urlとAiHubMixプラットフォームのキーを追加するだけです。
AiHubMixプラットフォームのすべてのモデルに適用されます。
from openai import OpenAI
client = OpenAI(
api_key="sk-***", # AiHubMixで生成したキーに置き換えてください
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",
)
print(chat_completion)