Skip to main content

Qwen-MT API リファレンス

OpenAI 互換インターフェイスまたは DashScope API を介して Qwen-MT を呼び出すための入出力パラメーターです。

リファレンス: Machine Translation (Qwen-MT)

OpenAI 互換

  • シンガポールリージョン
  • 米国 (バージニア) リージョン
  • 中国 (北京) リージョン
base_url (SDK 用): https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1HTTP エンドポイント: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions
Alibaba Cloud Model Studio は、中国 (北京)、シンガポール、および中国 (香港) リージョン向けにワークスペース固有のドメインをリリースしました。新しい専用ドメインは、推論リクエストに対して優れたパフォーマンスと高い安定性を提供します。新しいドメインへの移行を推奨します:
  • 中国 (北京): https://dashscope.aliyuncs.com から https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com
  • シンガポール: https://dashscope-intl.aliyuncs.com から https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
  • 中国 (香港): https://cn-hongkong.dashscope.aliyuncs.com から https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com
{WorkspaceId} はワークスペース ID であり、Alibaba Cloud Model Studio コンソールの [ワークスペース詳細] ページで確認できます。既存のドメインも引き続き完全に機能します。
まず、API キーを作成し、それを環境変数として設定します。OpenAI SDK を使用する場合は、SDK をインストールします。

リクエストボディ

  • 基本的な使用法
  • 用語介入
  • 翻訳メモリ
  • ドメインプロンプティング
  • Python
  • Node.js
  • curl
import os
from openai import OpenAI

client = OpenAI(
    # 環境変数が設定されていない場合は、Model Studio API キーに置き換えます: api_key="sk-xxx"
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # 次の URL はシンガポールリージョン用です。呼び出す際は、WorkspaceId を実際のワークスペース ID に置き換えてください。URL はリージョンによって異なります。
    base_url="https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
)
messages = [
    {
        "role": "user",
        "content": "No me reí después de ver este video"
    }
]
translation_options = {
    "source_lang": "auto",
    "target_lang": "English"
}

completion = client.chat.completions.create(
    model="qwen-mt-plus",
    messages=messages,
    extra_body={
        "translation_options": translation_options
    }
)
print(completion.choices[0].message.content)
model string (必須)モデル名。サポートされているモデル: qwen-mt-plus、qwen-mt-flash、qwen-mt-lite。
messages array (必須)モデルにコンテキストを提供するメッセージの配列。ユーザーメッセージのみがサポートされています。

メッセージタイプ

ユーザーメッセージ object (必須)翻訳する文を含むユーザーメッセージ。

プロパティ

content string (必須)翻訳する文。role string (必須)ユーザーメッセージのロールです。値は user に設定する必要があります。
ストリーム boolean (任意) デフォルト値は false です。ストリーミング出力モードを有効にします。有効値:
  • false:生成後に完全な応答を返します。
  • true:生成されたチャンクで応答を返します。クライアントはチャンクから完全な応答を再構築します。
qwen-mt-flash と qwen-mt-lite は増分的にデータを返します (各チャンクには新しいコンテンツのみが含まれます)。qwen-mt-plus は非増分的にデータを返します (各チャンクには現在までのシーケンス全体が含まれます)。この動作は変更できません。例:II didnI didn'tI didn't laughI didn't laugh after...
stream_options object (任意)ストリーミング出力の設定項目。このパラメーターは、stream が true に設定されている場合にのみ有効になります。

プロパティ

include_usage boolean (任意、デフォルトは false)。最後のデータチャンクにトークン消費量情報を含めます。有効値:
  • true
  • false
max_tokens integer (任意)生成するトークンの最大数。出力がこの値を超えると、応答は切り捨てられます。デフォルト値と最大値は、モデルの最大出力長です。詳細については、「モデルの選択」をご参照ください。
seed integer (任意)再現性のある結果を得るための乱数シードです。同じ seed とパラメーターを使用すると、一貫した出力が得られます。有効値: [0, 2<sup>31</sup>-1]。
temperature float (任意) デフォルトは 0.65 です。生成されるテキストの多様性をコントロールするサンプリング温度。値が大きいほど多様なテキストが生成され、値が小さいほど決定論的なテキストが生成されます。有効値: [0, 2)temperature と top_p はどちらもテキストの多様性をコントロールします。どちらか一方のみを設定してください。
top_p float (任意) デフォルトは 0.8 です。生成されるテキストの多様性をコントロールする核サンプリングの確率しきい値。値が大きいほど多様なテキストが生成され、値が小さいほど決定論的なテキストが生成されます。有効値: (0, 1.0]temperature と top_p はどちらもテキストの多様性をコントロールします。どちらか一方のみを設定してください。
top_k integer (任意) デフォルトは 1 です。生成中のサンプリングにおける候補セットのサイズ。たとえば、これを 50 に設定すると、スコア上位 50 のトークンのみがサンプリングプールを形成します。値が大きいほどランダム性が増し、小さいほど決定論的になります。値が None または 100 より大きい場合、top_k は無効になり、top_p のみが有効になります。値は 0 以上である必要があります。非標準の OpenAI パラメーターです。Python SDK: extra_body オブジェクトに配置します extra_body={"top_k": xxx}。Node.js SDK または HTTP 呼び出し: トップレベルパラメーターとして渡します。
repetition_penalty float (任意) デフォルトは 1.0 です。連続するシーケンスでの繰り返しに対するペナルティ。値が大きいほど繰り返しが減少します。値 1.0 はペナルティを適用しません。0 より大きい必要があり、厳密な上限はありません。非標準の OpenAI パラメーターです。Python SDK: extra_body オブジェクトに配置します extra_body={"repetition_penalty": xxx}。Node.js SDK または HTTP 呼び出し: トップレベルパラメーターとして渡します。
translation_options object (必須)翻訳パラメーター。

プロパティ

source_lang string (必須)ソース言語の完全な英語名です。詳細については、「サポートされている言語」をご参照ください。これを auto に設定すると、モデルが自動的に入力言語を検出します。target_lang string (必須)ターゲット言語の完全な英語名。詳細については、「サポートされている言語」をご参照ください。terms arrays (任意)用語介入機能を使用する際に設定する用語の配列。
source string (必須)ソース言語の用語。target string (必須)ターゲット言語の用語。
tm_list arrays (任意)翻訳メモリ機能を使用する際に設定する翻訳メモリの配列。
source string (必須)ソース言語の文。target string (必須)ターゲット言語の文。
domains string (任意)ドメインプロンプティング機能を使用する際に設定するドメインプロンプト。
ドメインプロンプトは英語である必要があります。
非標準の OpenAI パラメーターです。Python SDK: extra_body オブジェクトに配置します extra_body={"translation_options": xxx}。Node.js SDK または HTTP 呼び出し: トップレベルパラメーターとして渡します。

チャット応答オブジェクト (非ストリーミング出力)

{
  "id": "chatcmpl-999a5d8a-f646-4039-968a-167743ae0f22",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "logprobs": null,
      "message": {
        "content": "I didn't laugh after watching this video.",
        "refusal": null,
        "role": "assistant",
        "annotations": null,
        "audio": null,
        "function_call": null,
        "tool_calls": null
      }
    }
  ],
  "created": 1762346157,
  "model": "qwen-mt-plus",
  "object": "chat.completion",
  "service_tier": null,
  "system_fingerprint": null,
  "usage": {
    "completion_tokens": 9,
    "prompt_tokens": 53,
    "total_tokens": 62,
    "completion_tokens_details": null,
    "prompt_tokens_details": null
  }
}
id string一意のリクエスト ID。
choices arrayモデルが生成したコンテンツの配列。

プロパティ

finish_reason stringモデルがコンテンツの生成を停止した理由。指定可能な値:
  • stop:出力が完了しました。
  • length:出力長の制限に達しました。
index integerchoices 配列内の現在のオブジェクトのインデックス。message objectモデルの出力メッセージ。

プロパティ

content string翻訳結果。refusal string現在、null に固定されています。role stringメッセージのロール。 assistant に固定されています。audio object現在、null に固定されています。function_call object現在、null に固定されています。tool_calls array現在、null に固定されています。
created integerリクエストが作成されたときの UNIX タイムスタンプ。
model stringリクエストに使用されたモデル。
object string常に chat.completion です。
service_tier string現在は null に固定されています。
system_fingerprint string現在は null に固定されています。
usage objectリクエストのトークン消費量。
completion_tokens integerモデル出力のトークン数。prompt_tokens integer入力のトークン数。total_tokens integer消費されたトークンの合計で、prompt_tokens + completion_tokens と等しくなります。completion_tokens_details object現在、null に固定されています。prompt_tokens_details object現在、null に固定されています。

チャット応答チャンクオブジェクト (ストリーミング出力)

{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": "", "function_call": null, "refusal": null, "role": "assistant", "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": "I", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": " didn", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": "'t", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": " laugh", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": " after", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": " watching", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": " this", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": " video", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": ".", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": null, "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": "", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": "stop", "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [{"delta": {"content": "", "function_call": null, "refusal": null, "role": null, "tool_calls": null}, "finish_reason": "stop", "index": 0, "logprobs": null}], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": null}
{"id": "chatcmpl-d8aa6596-b366-4ed0-9f6d-2e89247f554e", "choices": [], "created": 1762504029, "model": "qwen-mt-flash", "object": "chat.completion.chunk", "service_tier": null, "system_fingerprint": null, "usage": {"completion_tokens": 9, "prompt_tokens": 56, "total_tokens": 65, "completion_tokens_details": null, "prompt_tokens_details": null}}
id string呼び出しの一意の ID。各チャンクオブジェクトは同じ ID を持ちます。
choices arrayモデルによって生成されたコンテンツの配列です。include_usageがtrueに設定されている場合、この配列は最後のチャンクでは空になります。

プロパティ

delta objectストリーミングモードで返される出力コンテンツ。

プロパティ

content string翻訳結果。qwen-mt-flash と qwen-mt-lite は増分更新を提供します。qwen-mt-plus は非増分更新を提供します。function_call object現在は null に固定されています。refusal object現在は null に固定されています。role stringメッセージオブジェクトのロール。これは最初のチャンクにのみ値を持ちます。
finish_reason stringモデルは次の 3 つの理由のいずれかで生成を停止します:
  • 出力が完了すると、値はstopになります。
  • 値は、生成中は null です。
  • length: 出力長の制限に達したため、生成が停止しました。
index integerchoices 配列内の現在の応答のインデックス。
created integerリクエストが作成されたときの UNIX タイムスタンプ。各チャンクは同じタイムスタンプを持ちます。
model stringリクエストに使用されたモデル。
object string常に chat.completion.chunk です。
service_tier string現在、null に固定されています。
system_fingerprint string現在 null に固定されています。
usage objectリクエストで消費されたトークン数。これは、include_usage が true の場合にのみ、最後のチャンクで返されます。
completion_tokens integerモデル出力のトークン数。prompt_tokens integer入力トークンの数。total_tokens integerトークンの総数。prompt_tokens と completion_tokens の合計です。completion_tokens_details object現在、null に固定されています。prompt_tokens_details object現在、null に固定されています。

DashScope

  • シンガポール
  • バージニア
  • 北京
HTTP エンドポイント: POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/text-generation/generationSDK 呼び出しのリージョン設定:
  • Python コード
  • Java コード
import os
import dashscope

# 以下はシンガポールリージョンの設定です。リージョンによって region の値は異なります。呼び出し時は、{WorkspaceId} をお使いのワークスペース ID に置き換えてください。
client = dashscope.Client(
    # 環境変数が設定されていない場合は、Model Studio API キーに置き換えます: api_key="sk-xxx"
    # API キーはリージョン固有です。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    workspace="{WorkspaceId}",
    region="ap-southeast-1",
)
API キーを作成し、その API キーを環境変数としてエクスポートする必要があります。DashScope SDK を使用する場合は、DashScope SDK をインストールします。

リクエストボディ

  • 基本的な使用法
  • 用語介入
  • 翻訳メモリ
  • ドメインプロンプティング
  • Python
  • Java
  • curl
import os
import dashscope

# 以下はシンガポールリージョンの設定です。リージョンによって region の値は異なります。呼び出し時は、{WorkspaceId} をお使いのワークスペース ID に置き換えてください。
client = dashscope.Client(
    # 環境変数が設定されていない場合は、Model Studio API キーに置き換えます: api_key="sk-xxx"
    # API キーはリージョン固有です。API キーを取得するには、https://www.alibabacloud.com/help/model-studio/get-api-key をご参照ください
    api_key=os.getenv('DASHSCOPE_API_KEY'),
    workspace="{WorkspaceId}",
    region="ap-southeast-1",
)

messages = [
    {
        "role": "user",
        "content": "No me reí después de ver este video"
    }
]
translation_options = {
    "source_lang": "auto",
    "target_lang": "English",
}
response = client.chat.completions.create(
    model="qwen-mt-plus",  # この例では qwen-mt-plus を使用しています。必要に応じてモデル名を置き換えることができます。
    messages=messages,
    parameters={"translation_options": translation_options}
)
print(response.choices[0].message.content)
model string (必須)モデル名。サポートされているモデル: qwen-mt-plus、qwen-mt-flash、qwen-mt-lite。
messages array (必須)モデルにコンテキストを提供するメッセージの配列。ユーザーメッセージのみがサポートされています。

メッセージタイプ

ユーザーメッセージ object (必須)翻訳する文を含むユーザーメッセージ。

プロパティ

content string (必須)翻訳する文。role string (必須)ユーザーメッセージのロール。user に設定する必要があります。
max_tokens integer (任意)生成するトークンの最大数。出力がこの値を超えると、応答は切り捨てられます。デフォルト値と最大値は、モデルの最大出力長です。詳細については、「モデルの選択」をご参照ください。
Java SDK では、パラメーターは maxTokens*です。*HTTP 呼び出しの場合、max_tokens を parameters オブジェクトに配置します。
seed integer (任意)再現性のある結果を得るための乱数シードです。同じ seed とパラメーターを使用すると、一貫した出力が生成されます。有効値: [0, 2<sup>31</sup>-1]。
HTTP 呼び出しを行う場合、seed を parameters オブジェクトに配置します。
temperature float (任意) デフォルトは 0.65 です。生成されるテキストの多様性をコントロールするサンプリング温度。値が大きいほど多様なテキストが生成され、値が小さいほど決定論的なテキストが生成されます。有効値: [0, 2)temperature と top_p はどちらもテキストの多様性をコントロールします。どちらか一方のみを設定してください。
HTTP 呼び出しを行う場合、temperature を parameters オブジェクトに配置します。
top_p float (任意) デフォルトは 0.8 です。生成されるテキストの多様性をコントロールする核サンプリングの確率しきい値。値が大きいほど多様なテキストが生成され、値が小さいほど決定論的なテキストが生成されます。有効値: (0, 1.0]temperature と top_p はどちらもテキストの多様性をコントロールします。どちらか一方のみを設定してください。
Java SDK では、パラメーターは topPparameters オブジェクトです。
repetition_penalty float (任意) デフォルトは 1.0 です。連続するシーケンスでの繰り返しに対するペナルティ。値が大きいほど繰り返しが減少します。値 1.0 はペナルティを適用しません。0 より大きい必要があり、厳密な上限はありません。
Java SDK では、パラメーターは repetitionPenalty*です。*HTTP 呼び出しの場合、repetition_penalty を parameters オブジェクトに追加します。
top_k integer (任意) デフォルトは 1 です。生成中のサンプリングにおける候補セットのサイズ。たとえば、これを 50 に設定すると、スコア上位 50 のトークンのみがサンプリングプールを形成します。値が大きいほどランダム性が増し、小さいほど決定論的になります。値が None または 100 より大きい場合、top_k は無効になり、top_p のみが有効になります。値は 0 以上である必要があります。
Java SDK では、パラメーターは topK*です。*HTTP 呼び出しを行う場合、parameters オブジェクトで top_k を設定します。
stream boolean (任意)ストリーミング出力モードを有効にします。有効値:
  • false:生成後に完全な応答を返します。
  • true:生成されたチャンクで応答を返します。クライアントはチャンクから完全な応答を再構築します。
qwen-mt-flash と qwen-mt-lite は増分的にデータを返します (各チャンクには新しいコンテンツのみが含まれます)。qwen-mt-plus は非増分的にデータを返します (各チャンクには現在までのシーケンス全体が含まれます)。この動作は変更できません。例:II didnI didn'tI didn't laughI didn't laugh after...
このパラメーターは Python SDK でのみサポートされています。Java SDK でストリーミング出力を実装するには、streamCall インターフェイスを呼び出します。HTTP 呼び出しでストリーミング出力を実装するには、ヘッダーで X-DashScope-SSE を enable に設定します。
translation_options object (必須)翻訳パラメーター。

プロパティ

source_lang string (必須)ソース言語の正式な英語名です。詳細については、「対応言語」をご参照ください。これを auto に設定した場合、モデルが自動的に入力言語を検出します。target_lang string (必須)ターゲット言語の完全な英語名。詳細については、「サポートされている言語」をご参照ください。terms arrays (任意)用語介入機能を使用する際に設定する用語の配列。
source string (必須)ソース言語の用語。target string (必須)ターゲット言語の用語。
tm_list arrays (任意)翻訳メモリ機能を使用する際に設定する翻訳メモリの配列。
source string (必須)ソース言語の文。target string (必須)ターゲット言語の文。
domains string (任意)ドメインプロンプティング機能を使用する際に設定するドメインプロンプト。
ドメインプロンプトは英語である必要があります。
Java SDK では、パラメーターは translationOptions です。HTTP 呼び出しを行う際、parameters オブジェクトに translation_options を配置します。

チャット応答オブジェクト (ストリーミング出力と非ストリーミング出力で共通)

Python SDK の呼び出しが失敗すると DashScopeError がスローされます。e.code/e.status_code/e.message/e.request_id でエラー情報を取得できます。Java SDK の呼び出しが失敗すると ApiException がスローされ、ApiException.getStatus().getStatusCode() でエラーステータスコードを取得できます。
{
  "request_id": "9b4ec3b2-6d29-40a6-a08b-7e3c9a51c289",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "I didn't laugh after watching this video."
      }
    }
  ],
  "usage": {
    "input_tokens": 53,
    "output_tokens": 9,
    "total_tokens": 62
  }
}
status_code stringリクエストのステータスコード。200 は成功を示し、その他の値は失敗を示します。
Java SDK はこのパラメーターを返しません。呼び出しが失敗した場合、例外がスローされます。例外メッセージには、status_code と message の内容が含まれます。
request_id string一意のリクエスト ID。
Java SDK では、返されるパラメーターは requestId
code stringエラーコード。成功時は空です。
このパラメーターは Python SDK のみが返します。
output object呼び出し結果。
text string現在、null に固定されています。finish_reason stringモデルがコンテンツの生成を停止した理由。有効値:
  • 生成中は、値は null です。
  • stop:モデルは自然にコンテンツの生成を停止しました。
  • length:出力長の制限に達したため、生成が停止しました。
choices arrayモデルの出力。
finish_reason string有効値:
  • 生成中、値は null です。
  • stop:モデルは自然にコンテンツの生成を停止しました。
  • length:出力長の制限に達したため、生成が停止しました。
message objectモデルの出力メッセージ。
role string出力メッセージのロール。assistant に固定されています。content string翻訳結果。
model_name stringこのリクエストに使用されたモデル。
usage objectリクエストのトークン使用量。
input_tokens integer入力トークンの数。output_tokens integer出力トークンの数。total_tokens integer合計トークン数。input_tokens + output_tokens と等しくなります。

エラーコード

モデル呼び出しが失敗した場合、Python SDK は DashScopeError をスローします。e.code/e.message/e.request_id でエラー情報を取得できます。問題解決については「エラーコード」をご参照ください。