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

# Gemini 3.5 Flash - Native API - 完全なリファレンス

> - Google Native API形式でgemini-3.5-flashモデルを呼び出し
- 同期処理モードを使用可能、会話内容をリアルタイムで返却
- **プレーンテキスト会話**: シングルターンまたはマルチターンのコンテキスト対話、コードサンプルのsimple_textおよびmulti_turnの例を参照
- **マルチモーダル入力**: テキスト+画像/オーディオ/ビデオの混合入力をサポート、コードサンプルのaudio_analysis、image_understanding、multi_fileの例を参照
- **パラメータチューニング**: generationConfigで生成品質を制御
- **ストリーミング**: URL の `generateContent` を `streamGenerateContent` に置き換えてください

<Tip>
  **ストリーミング**：URL の `generateContent` を `streamGenerateContent` に置き換えてください。リクエストボディのパラメータは同一です。レスポンスはストリーミングでチャンクごとに返されます。レスポンス形式は下記の「ストリーミングレスポンス」を参照してください。
</Tip>

<Note>
  **BaseURL**：デフォルトの BaseURL は `https://direct.evolink.ai` で、テキストモデルへの対応が優れており、長時間接続をサポートします。`https://api.evolink.ai` はマルチモーダルの主力エンドポイントで、テキストモデルに対しては代替アドレスとして使用されます。
</Note>


## OpenAPI

````yaml ja/api-manual/language-series/gemini-3.5-flash/native-api/native-api-reference.json POST /v1beta/models/gemini-3.5-flash:generateContent
openapi: 3.1.0
info:
  title: Gemini Native API - 完全なリファレンス
  description: Google Gemini Native APIの完全なリファレンスドキュメント、テキスト、画像、音声、動画を含むマルチモーダル入力に対応
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 本番環境（推奨）
  - url: https://api.evolink.ai
    description: 代替 URL
security:
  - bearerAuth: []
tags:
  - name: コンテンツ生成
    description: Gemini AIコンテンツ生成関連API
paths:
  /v1beta/models/gemini-3.5-flash:generateContent:
    post:
      tags:
        - コンテンツ生成
      summary: Geminiコンテンツ生成
      description: >-
        - Google Native API形式でgemini-3.5-flashモデルを呼び出し

        - 同期処理モードを使用可能、会話内容をリアルタイムで返却

        - **プレーンテキスト会話**:
        シングルターンまたはマルチターンのコンテキスト対話、コードサンプルのsimple_textおよびmulti_turnの例を参照

        - **マルチモーダル入力**:
        テキスト+画像/オーディオ/ビデオの混合入力をサポート、コードサンプルのaudio_analysis、image_understanding、multi_fileの例を参照

        - **パラメータチューニング**: generationConfigで生成品質を制御

        - **ストリーミング**: URL の `generateContent` を `streamGenerateContent`
        に置き換えてください
      operationId: generateContent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateContentRequest'
            examples:
              simple_text:
                summary: シングルターンテキスト会話
                value:
                  contents:
                    - role: user
                      parts:
                        - text: Please introduce yourself
              multi_turn:
                summary: マルチターン会話（コンテキスト理解）
                value:
                  contents:
                    - role: user
                      parts:
                        - text: What is Python?
                    - role: model
                      parts:
                        - text: Python is a high-level programming language...
                    - role: user
                      parts:
                        - text: What are its advantages?
              audio_analysis:
                summary: 音声分析
                value:
                  contents:
                    - role: user
                      parts:
                        - text: >-
                            Please analyze this song audio and answer: 1. Song
                            source and artist 2. Song mood 3. Complete lyrics
                            output
                        - fileData:
                            mimeType: audio/mp3
                            fileUri: https://example.com/audio.mp3
              image_understanding:
                summary: 画像理解
                value:
                  contents:
                    - role: user
                      parts:
                        - text: >-
                            Please describe the scene and main elements in this
                            image in detail
                        - fileData:
                            mimeType: image/jpeg
                            fileUri: https://example.com/image.jpg
              multi_file:
                summary: マルチファイル入力（混合）
                value:
                  contents:
                    - role: user
                      parts:
                        - text: >-
                            Compare the relationship between these two images
                            and this audio
                        - fileData:
                            mimeType: image/jpeg
                            fileUri: https://example.com/image1.jpg
                        - fileData:
                            mimeType: image/png
                            fileUri: https://example.com/image2.png
                        - fileData:
                            mimeType: audio/mp3
                            fileUri: https://example.com/audio.mp3
      responses:
        '200':
          description: >-
            コンテンツが正常に生成されました


            **レスポンス形式の説明**：

            - `generateContent`
            エンドポイント使用時、`GenerateContentResponse`を返却（完全なレスポンスを一度に返却）

            - `streamGenerateContent`
            エンドポイント使用時、`StreamGenerateContentResponse`を返却（ストリーミングレスポンス、コンテンツをチャンクで返却）
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/GenerateContentResponse'
                  - $ref: '#/components/schemas/StreamGenerateContentResponse'
        '400':
          description: 無効なリクエストパラメータ
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: 無効なリクエストパラメータ
                  type: invalid_request_error
        '401':
          description: 未認可、トークンが無効または期限切れです
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: クォータ不足、チャージが必要です
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 402
                  message: クォータ不足
                  type: insufficient_quota_error
                  fallback_suggestion: https://evolink.ai/dashboard/billing
        '403':
          description: アクセス拒否
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 403
                  message: Access denied for this model
                  type: permission_error
        '404':
          description: リソースが見つかりません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: Model not found
                  type: not_found_error
        '413':
          description: リクエストボディが大きすぎます、ファイルが大きすぎます
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 413
                  message: リクエストボディが大きすぎます
                  type: request_too_large_error
                  fallback_suggestion: reduce file size
        '429':
          description: レート制限を超過しました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: レート制限を超過しました
                  type: rate_limit_error
                  fallback_suggestion: retry after 60 seconds
        '500':
          description: 内部サーバーエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message: 内部サーバーエラー
                  type: internal_server_error
                  fallback_suggestion: try again later
        '502':
          description: 上流サービスエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 502
                  message: Upstream AI service unavailable
                  type: upstream_error
                  fallback_suggestion: try again later
        '503':
          description: サービス一時利用不可
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: サービス一時利用不可
                  type: service_unavailable_error
                  fallback_suggestion: retry after 30 seconds
components:
  schemas:
    GenerateContentRequest:
      type: object
      required:
        - contents
      properties:
        contents:
          type: array
          description: >-
            List of conversation contents, supports multi-turn dialogue and
            multimodal input
          items:
            $ref: '#/components/schemas/Content'
          minItems: 1
        generationConfig:
          $ref: '#/components/schemas/GenerationConfig'
          description: Generation configuration parameters (optional)
        systemInstruction:
          $ref: '#/components/schemas/Content'
          description: System instruction (optional), mainly text content
        tools:
          type: array
          items:
            type: object
          description: >-
            List of tools the model can call, such as function calling or code
            execution
        toolConfig:
          type: object
          description: Tool calling configuration (optional)
        safetySettings:
          type: array
          items:
            type: object
          description: Safety settings list (optional)
        cachedContent:
          type: string
          description: Cached content name, in the form cachedContents/{cachedContent}
    GenerateContentResponse:
      title: 同期レスポンス
      type: object
      properties:
        candidates:
          type: array
          description: List of candidate responses
          items:
            $ref: '#/components/schemas/Candidate'
        promptFeedback:
          $ref: '#/components/schemas/PromptFeedback'
        usageMetadata:
          $ref: '#/components/schemas/UsageMetadata'
        modelVersion:
          type: string
          description: Model version
          example: gemini-3.5-flash
        responseId:
          type: string
          description: Response ID
          example: l-LoaPu0BPmo1dkP6ZPHiQc
    StreamGenerateContentResponse:
      title: ストリームレスポンス
      type: object
      description: |-
        ストリームレスポンスチャンク

        **中間チャンク**:
        ```json
        {
          "candidates": [
            {
              "content": {
                "role": "model",
                "parts": [{ "text": "Partial text..." }]
              }
            }
          ],
          "usageMetadata": {
            "trafficType": "ON_DEMAND"
          },
          "modelVersion": "gemini-3.5-flash",
          "createTime": "2025-10-10T10:40:23.072315Z",
          "responseId": "xxx"
        }
        ```

        **最終チャンク**:
        ```json
        {
          "candidates": [
            {
              "content": {
                "role": "model",
                "parts": [{ "text": "Final text fragment" }]
              },
              "finishReason": "STOP"
            }
          ],
          "usageMetadata": {
            "promptTokenCount": 4,
            "candidatesTokenCount": 522,
            "totalTokenCount": 2191,
            "trafficType": "ON_DEMAND"
          },
          "modelVersion": "gemini-3.5-flash",
          "createTime": "2025-10-10T10:40:23.072315Z",
          "responseId": "xxx"
        }
        ```
      properties:
        candidates:
          type: array
          description: 候補応答のリスト（ストリーミングモードにはindexとsafetyRatingsは含まれません）
          items:
            $ref: '#/components/schemas/StreamCandidate'
        usageMetadata:
          type: object
          description: 使用統計（中間チャンクには trafficType のみ、最後のチャンクに完全な統計が含まれます）
          properties:
            promptTokenCount:
              type: integer
              description: 入力コンテンツのトークン数(最後のチャンクのみ)
              example: 4
            candidatesTokenCount:
              type: integer
              description: 出力コンテンツのトークン数(最後のチャンクのみ)
              example: 522
            totalTokenCount:
              type: integer
              description: トークンの合計数（最後のチャンクのみ）
              example: 2191
            trafficType:
              type: string
              description: トラフィックタイプ
              example: ON_DEMAND
            cachedContentTokenCount:
              type: integer
              description: Number of cached content tokens (last chunk only)
              example: 0
        modelVersion:
          type: string
          description: モデルバージョン
          example: gemini-3.5-flash
        createTime:
          type: string
          format: date-time
          description: 作成日時
          example: '2025-10-10T10:40:23.072315Z'
        responseId:
          type: string
          description: レスポンスID
          example: l-LoaPu0BPmo1dkP6ZPHiQc
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP ステータスエラーコード
            message:
              type: string
              description: エラーの説明
            type:
              type: string
              description: エラータイプ
            fallback_suggestion:
              type: string
              description: エラー発生時の提案
    Content:
      type: object
      required:
        - role
        - parts
      properties:
        role:
          type: string
          description: |-
            コンテンツロール

            - `user`：ユーザー入力
            - `model`：AIモデルの応答（マルチターン会話用）
          enum:
            - user
            - model
          example: user
        parts:
          type: array
          description: >-
            Content parts list, supports text, file data, inline data, function
            calls, function responses, and code execution results
          items:
            $ref: '#/components/schemas/Part'
          minItems: 1
    GenerationConfig:
      type: object
      description: Generation configuration parameters
      properties:
        temperature:
          type: number
          description: |-
            サンプリング温度、出力のランダム性を制御

            **説明**:
            - 低い値（例: 0.2）: より決定論的で集中した出力
            - 高い値（例: 1.5）: よりランダムで創造的な出力
          minimum: 0
          maximum: 2
          example: 0.7
        maxOutputTokens:
          type: integer
          description: |-
            生成された応答の最大トークン数

            **説明**:
            - 値が小さすぎると応答が切り捨てられる可能性があります
          minimum: 1
          example: 2000
        topP:
          type: number
          description: |-
            Nucleus Samplingパラメータ

            **説明**:
            - 累積確率を持つトークンからのサンプリングを制御
            - 例えば、0.9は累積確率が90%までのトークンから選択することを意味します
            - デフォルト: 1.0（すべてのトークンを考慮）

            **推奨**: temperatureとtopPを同時に調整しないでください
          minimum: 0
          maximum: 1
          example: 0.9
        topK:
          type: integer
          description: |-
            Top-K サンプリングパラメータ

            **説明**:
            - 例えば、10は確率が最も高い上位10トークンのみをサンプリング対象にすることを意味します
            - 値が小さいほど出力がより集中します
            - デフォルト: 制限なし
          minimum: 1
          example: 40
        candidateCount:
          type: integer
          minimum: 1
          description: Number of candidates to return
          example: 1
        responseMimeType:
          type: string
          description: >-
            MIME type of generated candidate content, for example text/plain or
            application/json
          example: application/json
        responseSchema:
          type: object
          description: >-
            Output schema definition for generated content (JSON mode /
            structured output)
        responseJsonSchema:
          type: object
          description: >-
            JSON Schema for generated content (useful for more complex
            structured output)
        thinkingConfig:
          type: object
          description: Thinking configuration (for models that support thinking)
    Candidate:
      type: object
      properties:
        content:
          $ref: '#/components/schemas/ContentResponse'
        finishReason:
          type: string
          description: Finish reason
          enum:
            - FINISH_REASON_UNSPECIFIED
            - STOP
            - MAX_TOKENS
            - SAFETY
            - RECITATION
            - LANGUAGE
            - OTHER
            - BLOCKLIST
            - PROHIBITED_CONTENT
            - SPII
            - MALFORMED_FUNCTION_CALL
            - IMAGE_SAFETY
            - IMAGE_PROHIBITED_CONTENT
            - IMAGE_OTHER
            - NO_IMAGE
            - IMAGE_RECITATION
            - UNEXPECTED_TOOL_CALL
            - TOO_MANY_TOOL_CALLS
            - MISSING_THOUGHT_SIGNATURE
          example: STOP
        index:
          type: integer
          description: 候補インデックス
          example: 0
        safetyRatings:
          type: array
          nullable: true
          description: 安全性評価
          items:
            type: object
    PromptFeedback:
      type: object
      properties:
        safetyRatings:
          type: array
          nullable: true
          description: プロンプト安全性評価
          items:
            type: object
    UsageMetadata:
      type: object
      description: 使用統計
      properties:
        promptTokenCount:
          type: integer
          description: 入力コンテンツのトークン数
          example: 4
        candidatesTokenCount:
          type: integer
          description: 出力コンテンツのトークン数
          example: 611
        totalTokenCount:
          type: integer
          description: トークンの合計数
          example: 2422
        thoughtsTokenCount:
          type: integer
          description: 推論トークン数
          example: 1807
        promptTokensDetails:
          type: array
          description: 詳細な入力トークン情報（モダリティ別）
          items:
            $ref: '#/components/schemas/TokenDetail'
        cachedContentTokenCount:
          type: integer
          description: Number of cached content tokens
          example: 0
    StreamCandidate:
      type: object
      description: Stream response candidate (more simplified than regular response)
      properties:
        content:
          $ref: '#/components/schemas/ContentResponse'
        finishReason:
          type: string
          description: Finish reason (only included in last chunk)
          enum:
            - FINISH_REASON_UNSPECIFIED
            - STOP
            - MAX_TOKENS
            - SAFETY
            - RECITATION
            - LANGUAGE
            - OTHER
            - BLOCKLIST
            - PROHIBITED_CONTENT
            - SPII
            - MALFORMED_FUNCTION_CALL
            - IMAGE_SAFETY
            - IMAGE_PROHIBITED_CONTENT
            - IMAGE_OTHER
            - NO_IMAGE
            - IMAGE_RECITATION
            - UNEXPECTED_TOOL_CALL
            - TOO_MANY_TOOL_CALLS
            - MISSING_THOUGHT_SIGNATURE
          example: STOP
    Part:
      oneOf:
        - $ref: '#/components/schemas/TextPart'
        - $ref: '#/components/schemas/FilePart'
        - $ref: '#/components/schemas/InlineDataPart'
        - $ref: '#/components/schemas/FunctionCallPart'
        - $ref: '#/components/schemas/FunctionResponsePart'
        - $ref: '#/components/schemas/ExecutableCodePart'
        - $ref: '#/components/schemas/CodeExecutionResultPart'
      description: >-
        Content part union type. The thoughtSignature returned by thinking
        models must be echoed back in the next turn.
    ContentResponse:
      type: object
      properties:
        role:
          type: string
          description: レスポンスロール
          enum:
            - model
          example: model
        parts:
          type: array
          description: >-
            Response content parts, supports text, inline data, function calls,
            function responses, and code execution results
          items:
            $ref: '#/components/schemas/Part'
    TokenDetail:
      type: object
      description: トークン詳細（モダリティ別統計）
      properties:
        modality:
          type: string
          description: Content modality type
          enum:
            - MODALITY_UNSPECIFIED
            - TEXT
            - IMAGE
            - AUDIO
            - VIDEO
            - DOCUMENT
          example: TEXT
        tokenCount:
          type: integer
          description: このモダリティのトークン数
          example: 4
    TextPart:
      title: テキスト入力
      type: object
      required:
        - text
      properties:
        text:
          type: string
          description: テキストコンテンツ
          example: |-
            Hello! I'm pleased to introduce myself.

            I'm a large language model, trained and developed by Google...
        thought:
          type: boolean
          description: Whether this is thought content
        thoughtSignature:
          type: string
          description: Thought signature, must be echoed back in the next turn
          example: <Signature_A>
    FilePart:
      title: マルチモーダル入力
      type: object
      required:
        - fileData
      properties:
        fileData:
          type: object
          required:
            - mimeType
            - fileUri
          properties:
            mimeType:
              type: string
              description: |-
                ファイルMIMEタイプ

                **対応タイプ**：

                **画像**：
                - `image/jpeg`、`image/png`
                - 画像あたりの最大サイズ：10 MB

                **音声**：
                - `audio/mp3`
                - ファイルあたりの最大サイズ：10 MB
                - 推奨長さ：10分以内

                **動画**：
                - `video/mp4`
                - ファイルあたりの最大サイズ：50 MB
                - 推奨長さ：180秒以内

                **ドキュメント**：
                - `application/pdf`
                - ファイルあたりの最大サイズ：20 MB
              example: audio/mp3
            fileUri:
              type: string
              format: uri
              description: |-
                ファイルURIアドレス

                **要件**：
                - 公開アクセス可能なURLである必要があります
                - URLはファイル拡張子（例：.mp3、.jpg）で終わり、mimeTypeパラメータと一致する必要があります
              example: https://example.com/audio.mp3
    InlineDataPart:
      title: Inline Data
      type: object
      required:
        - inlineData
      properties:
        inlineData:
          $ref: '#/components/schemas/BlobData'
        thought:
          type: boolean
          description: Whether this is thought content
        thoughtSignature:
          type: string
          description: Thought signature, must be echoed back in the next turn
          example: <Signature_A>
    FunctionCallPart:
      title: Function Call
      type: object
      required:
        - functionCall
      properties:
        functionCall:
          $ref: '#/components/schemas/FunctionCall'
        thought:
          type: boolean
          description: Whether this is thought content
        thoughtSignature:
          type: string
          description: Thought signature, must be echoed back in the next turn
          example: <Signature_A>
    FunctionResponsePart:
      title: Function Response
      type: object
      required:
        - functionResponse
      properties:
        functionResponse:
          $ref: '#/components/schemas/FunctionResponse'
    ExecutableCodePart:
      title: Generated Code
      type: object
      required:
        - executableCode
      properties:
        executableCode:
          $ref: '#/components/schemas/ExecutableCode'
    CodeExecutionResultPart:
      title: Code Execution Result
      type: object
      required:
        - codeExecutionResult
      properties:
        codeExecutionResult:
          $ref: '#/components/schemas/CodeExecutionResult'
    BlobData:
      type: object
      properties:
        mimeType:
          type: string
          description: IANA MIME type
          example: image/png
        data:
          type: string
          format: byte
          description: Base64-encoded raw media data
      required:
        - mimeType
        - data
    FunctionCall:
      type: object
      required:
        - name
        - args
      properties:
        name:
          type: string
          description: Function name
          example: get_weather
        args:
          type: object
          description: Function arguments
    FunctionResponse:
      type: object
      required:
        - name
        - response
      properties:
        name:
          type: string
          description: Function name
          example: get_weather
        parts:
          type: array
          description: Optional multimodal response parts
          items:
            $ref: '#/components/schemas/FunctionResponseMediaPart'
        response:
          type: object
          description: Function response payload
    ExecutableCode:
      type: object
      required:
        - language
        - code
      properties:
        language:
          type: string
          description: Code language
          example: python
        code:
          type: string
          description: Generated code
    CodeExecutionResult:
      type: object
      required:
        - outcome
      properties:
        outcome:
          type: string
          description: Code execution result
          enum:
            - OUTCOME_UNSPECIFIED
            - OUTCOME_OK
            - OUTCOME_FAILED
            - OUTCOME_DEADLINE_EXCEEDED
          example: OUTCOME_OK
        output:
          type: string
          description: Standard output, error output, or other description
    FunctionResponseMediaPart:
      type: object
      required:
        - inlineData
      properties:
        inlineData:
          $ref: '#/components/schemas/BlobData'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##すべてのAPIにBearer Token認証が必要です##

        **APIキーの取得：**

        [APIキー管理ページ](https://evolink.ai/dashboard/keys)にアクセスしてAPIキーを取得してください

        **リクエストヘッダーに追加：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````