すべてのサーバーツール
あらゆるテキストモデルで画像を生成できます。モデルが画像用のプロンプトを作成し、OpenRouter が設定された画像モデル(デフォルトは openai/gpt-image-2.6-flare)で画像を生成し、レスポンスとともに画像を返します。
仕組み
テキスト専用モデルを含む、あらゆるモデルのレスポンスに画像を追加するためのものです。
- 1
使用するモデル 画像が役立つと判断し、その画像用のプロンプトを作成します。
- 2
OpenRouter 設定された画像モデルで生成し、URL を返します。
- 3
使用するモデル 応答に画像を含め、複数の画像を作成できます。
プロバイダーと料金
OpenRouter
画像モデルの料金
料金はツールが呼び出す画像モデルに応じて決まり、画像出力に対応する任意のモデルを選択できます。
すべてのリクエストに通常のモデルトークン料金が適用されます。
このツールの使用方法
OpenRouter がリクエスト中にツールを実行して結果をモデルに返すため、クライアント側のツールループは不要です。
対応 API:Chat Completions, Responses, and Anthropic Messages。
Shell
curl https://dynamicsinfo.com/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.2",
"tools": [
{
"type": "openrouter:image_generation"
}
],
"messages": [
{
"role": "user",
"content": "Draw a watercolor painting of a lighthouse at dusk."
}
]
}'セットアップ、パラメーター、使用例はドキュメントをご覧ください。
連携ガイドを読むよくある質問
Yes. Add the openrouter:image_generation tool to the request’s tools array. The model writes an image prompt when the conversation calls for one, OpenRouter generates the image with an image model, and the image comes back with the response. A model with text-only output, such as openai/gpt-5.2, can answer with images this way.
The tool uses openai/gpt-image-2.6-flare unless you set parameters.model on the tool entry. Any model with image output on OpenRouter can be selected, so switching image models changes one field and keeps the same API key and request shape. Other parameters such as quality, size and aspect_ratio pass through to that model.
Each image is billed at the selected image model’s price, on top of the token cost of the model that calls the tool. Each image model’s price is on its model page and in the image models collection.
With the Images API (POST /api/v1/images), your code writes the prompt and calls the image model directly. With the tool, the model decides when an image helps, writes the prompt itself and can create several images in one Chat Completions, Responses or Anthropic Messages request.