Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.crazyrouter.com/llms.txt

Use this file to discover all available pages before exploring further.

チャット画像認識

POST /v1/chat/completions
Crazyrouter 本番環境では、OpenAI 形式の image_url 入力をサポートする主要な視覚モデルを検証済みです:
  • gpt-4ogpt-4o-minigpt-4.1gpt-5.4 などの OpenAI 視覚モデル
  • data:image/...;base64,... data URL と公開 https:// URL の両方が利用可能
  • message.content は現在プレーン文字列で返却されます
推奨手順:ローカル画像はまず 画像アップロード APImedia.crazyrouter.com の一時 URL に変換してから image_url に渡す、あるいは base64 data URL を直接送る。リモート公開 URL も使えますが、後述の「リモート URL の制約」を満たす必要があります。

base64 data URL を使う(最も確実)

curl https://crazyrouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {
        "role": "user",
        "content": [
          {"type": "text", "text": "What color is this image?"},
          {
            "type": "image_url",
            "image_url": {
              "url": "data:image/png;base64,iVBORw0KGgoAAA..."
            }
          }
        ]
      }
    ],
    "max_tokens": 100
  }'
レスポンス例:
{
  "model": "gpt-4o-mini",
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Red."
      }
    }
  ]
}

リモート https URL を使う

curl https://crazyrouter.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {
        "role": "user",
        "content": [
          {"type": "text", "text": "Describe in 5 words."},
          {
            "type": "image_url",
            "image_url": {
              "url": "https://www.gstatic.com/webp/gallery/1.jpg"
            }
          }
        ]
      }
    ],
    "max_tokens": 40
  }'

リモート URL の制約

URL は Crazyrouter サーバーから到達可能 である必要があります。「ブラウザで開ける」だけでは不十分です。よくある失敗パターン:
失敗原因対処
ドメインが解決できないプライベートアドレス、誤入力公開 https URL に変更
403 Forbidden一部 CDN(wikimedia、プライベート S3 など)がサーバー UA / Referer を拒否アップロード API または base64 を使用
Content-Type が image/* ではないURL が HTML やログインページにリダイレクトしている画像直リンクであることを確認
ファイル 20MB 超単一ファイルサイズ上限圧縮・トリミング
エラー Unable to process the image you provided. Please verify the image URL is publicly accessible, or upload it as base64. が表示された場合、URL がサーバーから到達不能ということなので、上表に沿って切り分けてください。

推奨運用

  • 社内素材、プライベート画像、到達性が不確かな画像:先に POST /v1/files/uploads で 72 時間有効な media.crazyrouter.com/... URL を取得し、それを image_url に渡す
  • 小さい(< 1MB)画像、使い捨ての画像:base64 data URL を直接送り、追加リクエストを省く
  • 複数画像入力、detail パラメータなどの高度な使い方:OpenAI 上流で対応済みなので、OpenAI 公式仕様どおりに送れば動作します