> ## 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.

# Gemini 互換コンテンツを生成

> Gemini 互換の generateContent エンドポイント。パス中の model は APIAny.AI の公開モデル ID です。



## OpenAPI

````yaml /ja/openapi.json post /v1beta/models/{model}:generateContent
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:
  /v1beta/models/{model}:generateContent:
    post:
      tags:
        - Chat
      summary: Gemini 互換コンテンツを生成
      description: Gemini 互換の generateContent エンドポイント。パス中の model は APIAny.AI の公開モデル ID です。
      operationId: generateGeminiContent
      parameters:
        - name: model
          in: path
          required: true
          schema:
            type: string
          example: gemini-3.5-flash
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GeminiGenerateContentRequest'
      responses:
        '200':
          description: Gemini 互換レスポンス。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeminiGenerateContentResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    GeminiGenerateContentRequest:
      type: object
      properties:
        contents:
          type: array
          items:
            type: object
            properties:
              role:
                type: string
              parts:
                type: array
                items:
                  type: object
                  additionalProperties: true
            required:
              - parts
        generationConfig:
          type: object
          description: >-
            生成設定。なお、:generateContent ではなく :streamGenerateContent を呼び出すと Gemini
            SSE ストリームを取得できます。
          properties:
            temperature:
              type: number
              minimum: 0
              maximum: 2
            topP:
              type: number
            topK:
              type: integer
            maxOutputTokens:
              type: integer
            stopSequences:
              type: array
              items:
                type: string
            responseMimeType:
              type: string
              description: '構造化出力に使用します（例: ''application/json''）。'
            responseSchema:
              type: object
              additionalProperties: true
              description: 構造化出力用の JSON Schema（responseMimeType application/json と併用）。
            responseModalities:
              type: array
              items:
                type: string
              description: '''IMAGE'' を含めると画像生成結果を返します。'
          additionalProperties: true
        tools:
          type: array
          description: functionDeclarations を含むツール宣言。
          items:
            type: object
            additionalProperties: true
        systemInstruction:
          type: object
          additionalProperties: true
          description: 'システム指示。Gemini Content オブジェクト（{ parts: [{ text }] }）として指定します。'
      required:
        - contents
    GeminiGenerateContentResponse:
      type: object
      properties:
        candidates:
          type: array
          items:
            type: object
            additionalProperties: true
        usageMetadata:
          type: object
          additionalProperties: true
      required:
        - candidates
    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'
    Unauthorized:
      description: API Key が指定されていないか、API Key が無効です。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````