> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiany.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 画像生成を作成して結果を待機

> 画像タスクを作成し、設定された最大待機時間までタスクの完了を待ちます。



## OpenAPI

````yaml /ja/openapi.json post /v1/images/generations/sync
openapi: 3.1.0
info:
  title: APIAny.AI 公開 API
  version: 1.0.0
  description: APIAny.AI のモデル統合、非同期メディアタスク、チャット生成、クレジット照会、タスク照会のための公開 API。
servers:
  - url: https://apiany.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Models
    description: 公開モデルカタログ。
  - name: Chat
    description: テキスト生成およびチャット互換エンドポイント。
  - name: Images
    description: 画像生成および画像編集エンドポイント。
  - name: Videos
    description: 動画生成エンドポイント。
  - name: Moderation
    description: Image safety and moderation endpoints.
  - name: Tasks
    description: 非同期タスク照会。
  - name: Account
    description: アカウントおよびクレジットの照会。
  - name: Free APIs
    description: Free utility APIs protected by API key rate limits.
paths:
  /v1/images/generations/sync:
    post:
      tags:
        - Images
      summary: 画像生成を作成して結果を待機
      description: 画像タスクを作成し、設定された最大待機時間までタスクの完了を待ちます。
      operationId: createImageGenerationSync
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageGenerationRequest'
      responses:
        '200':
          description: OpenAI 互換の画像生成結果。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIImageResponse'
        '202':
          description: 最大待機時間に達してもタスクがまだ処理中です。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncTaskCreateResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  schemas:
    ImageGenerationRequest:
      type: object
      properties:
        model:
          type: string
          example: nano-banana
        prompt:
          type: string
        size:
          type: string
          example: 1k
        input_images:
          type: array
          items:
            type: string
            format: uri
        callback_url:
          type: string
          format: uri
      required:
        - model
        - prompt
    OpenAIImageResponse:
      type: object
      properties:
        created:
          type: integer
        data:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
                format: uri
              b64_json:
                type: string
              revised_prompt:
                type: string
        usage:
          $ref: '#/components/schemas/TokenUsage'
      required:
        - created
        - data
    AsyncTaskCreateResponse:
      type: object
      properties:
        task_id:
          type: string
          example: task_123
        status:
          type: string
          enum:
            - pending
            - processing
        model:
          type: string
        poll_url:
          type: string
          example: /v1/tasks/task_123
      required:
        - task_id
        - status
        - poll_url
    TokenUsage:
      type: object
      properties:
        prompt_tokens:
          type: integer
        completion_tokens:
          type: integer
        total_tokens:
          type: integer
        input_tokens:
          type: integer
        output_tokens:
          type: integer
        cached_input_tokens:
          type: integer
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
              enum:
                - invalid_request
                - auth_error
                - rate_limit
                - insufficient_quota
                - content_policy
                - timeout
                - network_error
                - service_error
                - billable_error
                - unknown
            message:
              type: string
            param:
              type:
                - string
                - 'null'
            code:
              type:
                - string
                - 'null'
          required:
            - type
            - message
      required:
        - error
  responses:
    BadRequest:
      description: リクエストパラメータが無効です。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````