Skip to main content

MiniMax

Alibaba Cloud Model Studio で MiniMax モデルを呼び出します。

このドキュメントは中国本土リージョンにのみ適用されます。モデルを使用するには、中国本土リージョンからAPI キーを取得してください。

クイックスタート

前提条件:API キーを作成し、環境変数として設定します。SDK を使用してモデルを呼び出す場合は、OpenAI または DashScope SDK をインストールします。
  • OpenAI 互換
  • DashScope
  • Python
  • Node.js
  • HTTP

サンプルコード

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 中国 (北京) リージョン。{WorkspaceId} をお使いの Bailian ワークスペース ID に置き換えてください。URL はリージョンによって異なります。
    base_url="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
)

completion = client.chat.completions.create(
    model="MiniMax-M2.5",
    messages=[{"role": "user", "content": "Who are you?"}],
    stream=True,
)

reasoning_content = ""  # 完全な Chain-of-Thought
answer_content = ""     # 完全な応答
is_answering = False    # 応答が開始されたかどうか

print("\n" + "=" * 20 + "Chain of thought" + "=" * 20 + "\n")

for chunk in completion:
    if chunk.choices:
        delta = chunk.choices[0].delta
        # Chain-of-Thought コンテンツのみを収集
        if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
            if not is_answering:
                print(delta.reasoning_content, end="", flush=True)
            reasoning_content += delta.reasoning_content
        # コンテンツが到着したら応答を開始
        if hasattr(delta, "content") and delta.content:
            if not is_answering:
                print("\n" + "=" * 20 + "Full response" + "=" * 20 + "\n")
                is_answering = True
            print(delta.content, end="", flush=True)
            answer_content += delta.content

応答

====================Chain of thought====================

The user asked "Who are you?".

I should reply and introduce myself as an AI assistant.
====================Full response====================

Hello! I am MiniMax-M2.5, an AI assistant. I can help you answer questions, provide information, hold conversations, and more. How can I help you?

その他の機能

モデルマルチターン会話ディープシンキングFunction Calling構造化出力Web 検索部分モードコンテキストキャッシュ
MiniMax-M2.5サポート済みサポート済みサポート済み非サポートサポート済み非サポートサポート済み
暗黙的キャッシュのみ。

デフォルトのパラメーター値

モデル

temperature

top_p

presence_penalty

MiniMax-M2.5

1.0

0.95

0.0

モデルと課金

MiniMax-M2.5 は、コーディング、オフィスワーク、テキスト要約などのタスクに優れており、出力速度も高速です。このモデルの使用を推奨します。 モデルのコンテキストウィンドウと料金情報については、「推奨モデル」をご参照ください。 課金は、入力トークンと出力トークンの数に基づきます。

エラーコード

モデルの呼び出しが失敗し、エラーメッセージが返された場合は、「エラーメッセージ」を参照してトラブルシューティングを行ってください。