Skip to main content
GET
中国本土のユーザー向け: 中国本土のユーザーは https://toapis.cn を API エンドポイント(Base URL)としてご利用ください。本ドキュメント内の例では https://toapis.com を https://toapis.cn に置き換えてください。
  • Query async image generation task execution status and results
  • Real-time status updates and progress tracking
  • Get generated images when task completes
  • Multi-language support (zh/en/ko/ja)
All image generation tasks are executed asynchronously. After submitting a task, you need to query the status and results via the query endpoint.

Authorizations

string
必須
All endpoints require Bearer Token authenticationGet your API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:

Path パラメータ

string
必須
Task ID returned by the image generation API

レスポンス

string
Unique task identifier
string
Object type, always generation.task
string
Task status
  • queued - Queued for processing
  • in_progress - Processing
  • completed - Successfully completed
  • failed - Failed
string
Image generation model used
integer
Task creation time (Unix timestamp)
integer
Task completion time (Unix timestamp, only returned when completed)
string
Generated image URL (only returned on success)
integer
Image URL expiration time (Unix timestamp, only returned on completion)
object
Task result (only returned on success)
object
画像タスクの課金情報です。省略される場合があります。課金状態は生成状態とは独立しており、completed でも精算済みとは限りません。課金情報を確認できない場合、billing 全体が省略され、null は返されません。省略は無料を意味しません。
object
精算済みの画像トークン使用量です。billing.status が settled で、保存された使用量が有効かつ最終請求額と整合する場合のみ、画像トークンのフィールドが返されます。欠損や検証失敗時は省略され、推定値やゼロで補完されません。確定済みの金額と画像結果は引き続き返されます。トークン数はすべて非負のJSON整数です。キャッシュ分は入力トークンの一部なので、再加算しないでください。出力内訳がない場合、output_tokens_details 全体が省略されます。usage.tool_usage.web_search は単独でも、画像トークンと併せても返されます。
object
エラー information (only returned on failure)

課金状態と費用の集計

この課金規則はモデルやチャネルを問わず画像タスク照会に適用されます。GPT-Image-2.5のSunburstとFlareのVIP / Officialモデルはトークン使用量に対応しており、その他のモデルは保存済みの精算データに応じて返されます。例の金額はレスポンス形式を示すもので、固定単価ではありません。
  • 金額はタスクの確定済みの最終請求額です。照会で課金、追加請求、返金、現在のモデル価格による再計算は行いません。集計には返された金額を使い、トークン数と現在の単価から再計算しないでください。
  • タスクの id ごとに金額を更新し、ポーリングのたびに同じ金額を加算しないでください。十進数で計算し、pending やフィールドの欠損をゼロ費用として扱わないでください。
  • 金額は十進数の文字列で、小数点以下の桁数は固定ではありません。
  • 課金記録が欠損または不整合の場合、billing が省略されることがあります。画像がまだ配信できず、一時的に in_progress と表示される場合は、billing と usage の両方が省略されることもあります。
  • 成功 Webhook の data.usage には同じ画像トークンフィールドが含まれる場合があり、data.billing に確定済み請求額が含まれる場合もあります。どちらかがない場合は、このエンドポイントをフォールバックとして照会してください。料金と実際の請求額も参照してください。

Task ステータス Reference

Polling Strategy

Python Polling Example

Resource Expiration

Generated image URLs are valid for 24 hours
  • Please download and save images within the validity period
  • expires_at field indicates image expiration time (Unix timestamp)
  • Expired images cannot be accessed; to regenerate, submit a new task

エラー Codes

ToAPIs の統一 Task Webhook を優先し、照会はフォールバックにします。5~10秒以上と jitter、429 の Retry-After を使用してください。バッチは最大100件です。レート制限。