OpenClaw で Qwen 2 Image を使う。
Qwen 2 Image は Alibaba の画像生成・編集モデルです。OpenClaw エージェントはチャットで使用している RunAPI エンドポイントを通じて呼び出します。プロンプトを送るだけで画像 URL が返ってきます。テキストから画像、画像編集、画像リミックスの 3 つのモデルバリアントをサポートしています。
Use RunAPI to generate an image with Qwen 2 Image.
Requirements:
- Call the RunAPI text_to_image endpoint at https://runapi.ai/api/v1/task/text_to_image.
- Set the model to "qwen-2-text-to-image".
- Read the API key from the RUNAPI_API_KEY environment variable.
- The response returns a task_id. Poll the task status endpoint until the task completes, then retrieve the image URL from the output.
- For image editing, use model "qwen-2-edit-image" and include an image_url field.
- For remixing, use model "qwen-2-remix-image" and include an image_url field.
curl -X POST https://runapi.ai/api/v1/task/text_to_image \
-H "Authorization: Bearer $RUNAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen-2-text-to-image",
"prompt": "A traditional Chinese ink painting of misty mountains at dawn, elegant brushwork"
}'
{
"task_id": "tsk_abc123",
"status": "pending",
"model": "qwen-2-text-to-image"
}
3 ステップで OpenClaw で Qwen 2 Image を使う
RunAPI を設定する
RunAPI API キーを環境変数として設定します。まだ OpenClaw プロバイダーとして RunAPI を追加していない場合は、OpenClaw セットアップガイドに従って最初に設定します。
export RUNAPI_API_KEY=runapi_xxx
Qwen 2 Image を呼び出す
プロンプトを OpenClaw に貼り付けるか、text_to_image エンドポイントを直接呼び出します。生成には qwen-2-text-to-image、編集には qwen-2-edit-image、リミックスには qwen-2-remix-image を model フィールドに設定します。
text_to_image
結果を取得する
エンドポイントはタスク ID を返します。ステータスが completed に変わるまでタスクステータスエンドポイントをポーリングし、出力から画像 URL を読み取ります。RunAPI SDK は自動的にポーリングを処理します。
task_id: tsk_abc123
Qwen 2 Image API パラメーター
| パラメータ | 型 | 説明 |
|---|---|---|
model |
string |
必須。qwen-2-text-to-image、qwen-2-edit-image、または qwen-2-remix-image。 |
prompt |
string |
テキスト説明または編集指示。 |
image_url |
string |
編集またはリミックスモード用のソース画像。 |
size |
string |
省略可。出力サイズ。 |
OpenClaw上のQwen 2 Imageとは?
Qwen 2 ImageはAlibaba製の画像モデルで、1つのAPIで生成・編集・リミックスの3つのモードをカバーします。多言語プロンプト理解(特に中英)に優れ、複雑なマルチオブジェクトシーンを処理し、自然言語で変更内容を説明する指示ベースの編集をサポートします。
Qwen 2 Imageの活用例
多言語マーケティングキャンペーン
中国語・英語・混合言語テキストで書かれたプロンプトから画像を生成し、事前翻訳なしにバイリンガルマーケティング素材を制作します。
指示ベースの画像編集
既存画像を日常言語で変更内容を説明して修正します——背景の差し替え・オブジェクトの追加・ライティングの調整・要素の削除をエディター不要で行えます。
特定ドメイン向けオープンウェイトモデルのファインチューニング
Qwen 2 Imageの出力を、商品カタログやブランドコンテンツなどのドメイン特化型画像タスク向けにオープンウェイトQwenモデルをファインチューニングする際のトレーニングデータやベースラインとして活用します。
Qwen 2 Image + OpenClaw よくある質問
はい。OpenClaw はカスタム OpenAI 互換プロバイダーをサポートしています。RunAPI を baseUrl https://runapi.ai/v1 と RUNAPI_API_KEY で追加し、model を qwen-2-text-to-image に設定して text_to_image エンドポイントを呼び出します。同じプロバイダーでチャットと画像生成の両方が処理できます。
いいえ。チャットモデルに使用している RUNAPI_API_KEY が Qwen 2 Image や RunAPI カタログの他のすべてのモデルにも使えます。1 つのキー、1 つの残高、1 つのダッシュボードです。
非同期です。エンドポイントは即座にタスク ID を返します。タスクステータスエンドポイントをポーリングするか、webhook コールバックを使って画像の準備ができたことを確認します。RunAPI SDK と CLI は自動的にポーリングを処理します。
Qwen 2 Image はタスクごとの課金です。現在の料金は RunAPI 料金ページで確認してください。月額サブスクリプションや最低支払い額はなく、完了した生成分のみ支払います。