> ## 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 - OpenAI SDK - 完全なリファレンス

> - OpenAI SDK形式でGemini-3.5-flashモデルを呼び出し
- 同期処理モード、会話内容をリアルタイムで返却
- **プレーンテキスト会話**: シングルターンまたはマルチターンのコンテキスト対話、コードサンプルのsimple_textおよびmulti_turnの例を参照
- **システムプロンプト**: AIのロールと動作をカスタマイズ、コードサンプルのsystem_promptの例を参照
- **マルチモーダル入力**: テキスト+画像の混合入力をサポート、コードサンプルのvisionおよびmulti_imageの例を参照

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


## OpenAPI

````yaml ja/api-manual/language-series/gemini-3.5-flash/openai-sdk/openai-sdk-reference.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: Gemini-3.5-flash完全なリファレンス
  description: Gemini-3.5-flash チャットインターフェースの完全な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: AIチャット補完関連API
paths:
  /v1/chat/completions:
    post:
      tags:
        - チャット補完
      summary: Gemini-3.5-flash チャットAPI
      description: >-
        - OpenAI SDK形式でGemini-3.5-flashモデルを呼び出し

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

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

        - **システムプロンプト**: AIのロールと動作をカスタマイズ、コードサンプルのsystem_promptの例を参照

        - **マルチモーダル入力**: テキスト+画像の混合入力をサポート、コードサンプルのvisionおよびmulti_imageの例を参照
      operationId: createChatCompletion
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              simple_text:
                summary: シングルターンテキスト会話
                value:
                  model: gemini-3.5-flash
                  messages:
                    - role: user
                      content: Please introduce yourself
              multi_turn:
                summary: マルチターン会話（コンテキスト理解）
                value:
                  model: gemini-3.5-flash
                  messages:
                    - role: user
                      content: What is Python?
                    - role: assistant
                      content: Python is a high-level programming language...
                    - role: user
                      content: What are its advantages?
              system_prompt:
                summary: システムプロンプトの使用
                value:
                  model: gemini-3.5-flash
                  messages:
                    - role: system
                      content: >-
                        You are a professional Python programming assistant,
                        answering questions concisely.
                    - role: user
                      content: How to read a file?
              vision:
                summary: マルチモーダル入力（テキスト+画像）
                value:
                  model: gemini-3.5-flash
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: >-
                            Please describe the scene and main elements in this
                            image in detail.
                        - type: image_url
                          image_url:
                            url: https://example.com/image.png
              multi_image:
                summary: 複数画像入力
                value:
                  model: gemini-3.5-flash
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: Compare the differences between these two images
                        - type: image_url
                          image_url:
                            url: https://example.com/image1.png
                        - type: image_url
                          image_url:
                            url: https://example.com/image2.png
      responses:
        '200':
          description: チャット補完が正常に生成されました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '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
                  param: model
        '404':
          description: リソースが見つかりません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: Specified model not found
                  type: not_found_error
                  param: model
                  fallback_suggestion: gemini-3.5-flash
        '413':
          description: リクエストボディが大きすぎます
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 413
                  message: Image file too large
                  type: request_too_large_error
                  param: content
                  fallback_suggestion: compress image to under 10MB
        '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 different model
        '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:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: チャットモデル名
          enum:
            - gemini-3.5-flash
          default: gemini-3.5-flash
          example: gemini-3.5-flash
        messages:
          type: array
          description: チャットメッセージのリスト、マルチターン対話とマルチモーダル入力をサポート
          items:
            $ref: '#/components/schemas/Message'
          minItems: 1
        stream:
          type: boolean
          description: |-
            ストリーミングモードでレスポンスを返すかどうか

            - `true`: ストリーミング返却、リアルタイムでチャンク単位にコンテンツを受信
            - `false`: 完全なレスポンスを一括で返却
          example: false
          default: false
        max_completion_tokens:
          type: integer
          nullable: true
          description: >-
            Maximum number of completion tokens for the generated response,
            corresponding to Gemini's maxOutputTokens.
          minimum: 1
          example: 2000
          maximum: 65536
        max_tokens:
          type: integer
          description: >-
            Maximum number of tokens for the generated response, compatible with
            the legacy OpenAI parameter.
          minimum: 1
          example: 2000
          maximum: 65536
        temperature:
          type: number
          description: |-
            サンプリング温度、出力のランダム性を制御

            **説明**:
            - 低い値（例: 0.2）: より決定論的で集中した出力
            - 高い値（例: 1.5）: よりランダムで創造的な出力
          minimum: 0
          maximum: 2
          example: 0.7
          default: 1
        top_p:
          type: number
          description: |-
            Nucleus Samplingパラメータ

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

            **推奨**: temperatureとtop_pを同時に調整しないでください
          minimum: 0
          maximum: 1
          example: 0.9
          default: 1
        frequency_penalty:
          type: number
          nullable: true
          description: >-
            Frequency penalty coefficient. Range: -2.0 to 2.0. Corresponds to
            Gemini's frequencyPenalty.
          minimum: -2
          maximum: 2
          default: 0
          example: 0
        presence_penalty:
          type: number
          nullable: true
          description: >-
            Presence penalty coefficient. Range: -2.0 to 2.0. Corresponds to
            Gemini's presencePenalty.
          minimum: -2
          maximum: 2
          default: 0
          example: 0
        stop:
          nullable: true
          description: >-
            Stop sequences. Supports a string or string array, corresponding to
            Gemini's stopSequences.
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        'n':
          type: integer
          nullable: true
          description: Number of generated candidates.
          minimum: 1
          default: 1
          example: 1
        reasoning_effort:
          type: string
          nullable: true
          description: >-
            推論の負荷を制御します。Gemini 3 は low/high の思考レベルをサポートし、medium
            は高いレベルに割り当てられ、none は未サポートです。
          enum:
            - low
            - medium
            - high
          default: medium
          example: medium
        seed:
          type: integer
          nullable: true
          description: >-
            Random seed used to make output as reproducible as possible,
            corresponding to Gemini's seed.
          example: 12345
        logprobs:
          type: boolean
          nullable: true
          description: >-
            Whether to return token logprob information, corresponding to
            Gemini's responseLogprobs.
          example: true
          default: false
        top_logprobs:
          type: integer
          nullable: true
          description: >-
            Number of top logprob values returned for each token, corresponding
            to Gemini's logprobs.
          minimum: 0
          maximum: 20
          example: 5
        response_format:
          description: >-
            Response format settings, supporting JSON mode and JSON Schema,
            corresponding to Gemini's responseMimeType, responseSchema and
            responseJsonSchema.
          oneOf:
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - json_object
                  example: json_object
                  description: Response format type.
            - type: object
              required:
                - type
              properties:
                type:
                  type: string
                  enum:
                    - json_schema
                  example: json_schema
                  description: Response format type.
                json_schema:
                  type: object
                  nullable: true
                  description: JSON Schema definition.
        stream_options:
          type: object
          nullable: true
          description: Streaming response options. Can be set when stream is true.
          properties:
            include_usage:
              type: boolean
              nullable: true
              description: >-
                Whether to include token usage for this request before streaming
                finishes.
              default: false
              example: true
        tools:
          type: array
          nullable: true
          description: List of tool definitions for Function Calling.
          items:
            $ref: '#/components/schemas/Tool'
        tool_choice:
          description: Controls tool-calling behavior.
          oneOf:
            - type: string
              enum:
                - none
                - auto
                - required
            - $ref: '#/components/schemas/ToolChoiceObject'
        extra_body:
          type: object
          nullable: true
          description: Gemini extension parameters.
          properties:
            google:
              type: object
              nullable: true
              description: Gemini-specific extension parameters.
              properties:
                cached_content:
                  type: string
                  nullable: true
                  description: Gemini content cache.
                thinking_config:
                  type: object
                  nullable: true
                  description: Gemini ThinkingConfig.
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: チャット補完の一意の識別子
          example: chatcmpl-20251010015944503180122WJNB8Eid
        model:
          type: string
          description: 実際に使用されたモデル名
          example: gemini-3.5-flash
        object:
          type: string
          enum:
            - chat.completion
          description: レスポンスタイプ
          example: chat.completion
        created:
          type: integer
          description: 作成タイムスタンプ
          example: 1760032810
        choices:
          type: array
          description: チャット補完選択肢のリスト
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP ステータスエラーコード
            message:
              type: string
              description: エラーの説明
            type:
              type: string
              description: エラータイプ
            param:
              type: string
              description: 関連パラメータ名
            fallback_suggestion:
              type: string
              description: エラー発生時の提案
    Message:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          description: |-
            メッセージのロール

            - `user`: ユーザーメッセージ
            - `assistant`: AIアシスタントメッセージ（マルチターン会話用）
            - `system`: システムプロンプト（AIのロールと動作を設定）
          enum:
            - user
            - assistant
            - system
            - tool
          example: user
        content:
          description: >-
            Message content. Supports two formats:


            **1. Plain text string**: You can pass a string directly, e.g.
            `"content":"Please introduce yourself"`


            **2. Object array** (supports text and multimodal input): see the
            example structure below
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ContentPart'
        tool_call_id:
          type: string
          nullable: true
          description: Tool call ID, used only when role=tool.
    Tool:
      type: object
      required:
        - type
        - function
      description: Tool definition for Function Calling.
      properties:
        type:
          type: string
          enum:
            - function
          description: Tool type. Currently only function is supported.
        function:
          type: object
          required:
            - name
          description: Function definition.
          properties:
            name:
              type: string
              description: Name of the function to call.
            description:
              type: string
              description: >-
                Function description used by the model to decide whether to call
                the tool.
            parameters:
              type: object
              description: Function request parameters described in JSON Schema format.
    ToolChoiceObject:
      type: object
      required:
        - type
        - function
      description: Scope of the tool to call.
      properties:
        type:
          type: string
          enum:
            - function
          description: Call type.
        function:
          type: object
          required:
            - name
          properties:
            name:
              type: string
              description: Name of the tool to call.
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: 選択インデックス
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        logprobs:
          type: object
          nullable: true
          description: Token logprob information for this choice.
          properties:
            content:
              type: array
              nullable: true
              description: Logprob details for each output token.
              items:
                $ref: '#/components/schemas/LogProbToken'
        finish_reason:
          type: string
          description: 終了理由
          enum:
            - stop
            - length
            - content_filter
            - tool_calls
          example: stop
    Usage:
      type: object
      description: トークン使用統計
      properties:
        prompt_tokens:
          type: integer
          description: 入力コンテンツのトークン数
          example: 13
        completion_tokens:
          type: integer
          description: 出力コンテンツのトークン数
          example: 1891
        total_tokens:
          type: integer
          description: トークンの合計数
          example: 1904
        prompt_tokens_details:
          type: object
          description: 入力トークンの詳細情報
          properties:
            cached_tokens:
              type: integer
              description: キャッシュヒットしたトークン数
              example: 0
            text_tokens:
              type: integer
              description: テキストトークン数
              example: 13
            audio_tokens:
              type: integer
              description: オーディオトークン数
              example: 0
            image_tokens:
              type: integer
              description: 画像トークン数
              example: 0
        completion_tokens_details:
          type: object
          description: Detailed completion token information.
          properties:
            text_tokens:
              type: integer
              description: Number of text tokens.
              example: 0
            audio_tokens:
              type: integer
              description: Number of audio tokens.
              example: 0
            reasoning_tokens:
              type: integer
              description: Number of reasoning tokens.
              example: 1480
        input_tokens:
          type: integer
          description: Input token count (compatibility field).
          example: 0
        output_tokens:
          type: integer
          description: Output token count (compatibility field).
          example: 0
        input_tokens_details:
          type: object
          nullable: true
          description: Detailed input token information (compatibility field).
          example: null
    ContentPart:
      oneOf:
        - $ref: '#/components/schemas/TextContent'
        - $ref: '#/components/schemas/ImageContent'
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          description: メッセージ送信者のロール
          enum:
            - assistant
          example: assistant
        content:
          type: string
          description: AIレスポンスメッセージの内容
          example: >-
            Hello! I'm pleased to introduce myself.


            I'm a Large Language Model, trained and developed by Google.


            Simply put, you can think of me as a "smart brain" that has been
            trained on massive amounts of text data and is able to understand
            and generate human language. My core capability is processing and
            generating text. Specifically, I can do the following:


            **1. Information Query & Knowledge Answering**

            I can act like a "talking encyclopedia," answering various
            questions, whether they're about scientific knowledge, historical
            events, or everyday facts.


            **2. Creative Writing & Text Generation**

            I can create various types of text based on your requirements, such
            as:

            *   **Writing**: Poetry, stories, scripts, emails, speeches,
            advertising copy, etc.

            *   **Planning**: Travel plans, study outlines, event proposals,
            etc.

            *   **Brainstorming**: Working with you to generate new ideas and
            spark creativity.


            **3. Translation & Language Processing**

            I'm proficient in multiple languages and can provide fast, fluent
            translation services. I can also help you polish, proofread,
            summarize, or rewrite text to make your expression clearer and more
            professional.


            **4. Programming & Code Assistance**

            I can write code snippets, explain code logic, debug errors, or
            "translate" code from one programming language to another, making me
            a helpful companion for programmers.


            **5. Logical Analysis & Reasoning**

            I can help you analyze complex problems, organize logical chains,
            and make inferences and summaries based on the information you
            provide.


            ---


            **In summary**, my goal is to be a powerful and useful tool that
            helps you obtain information more efficiently, complete tasks, and
            spark creativity through natural language communication.


            **Remember:** I'm an artificial intelligence, my knowledge comes
            from the data I've learned, and it may not be the most up-to-date.
            Sometimes I may also make mistakes, so for very important
            information, I recommend you verify it again.
          nullable: true
        tool_calls:
          type: array
          nullable: true
          description: List of tool calls.
          items:
            $ref: '#/components/schemas/ToolCall'
    LogProbToken:
      type: object
      description: Logprob details for a single token.
      properties:
        token:
          type: string
          description: Token text.
        logprob:
          type: number
          description: Logprob value of the token.
        bytes:
          type: array
          nullable: true
          description: UTF-8 byte sequence of the token.
          items:
            type: integer
        top_logprobs:
          type: array
          nullable: true
          description: Candidate tokens at the same position and their logprobs.
          items:
            $ref: '#/components/schemas/TopLogProb'
    TextContent:
      title: テキストコンテンツ
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
          description: コンテンツタイプ
        text:
          type: string
          description: テキストコンテンツ
          example: Please describe this image in detail
    ImageContent:
      title: 画像コンテンツ
      type: object
      required:
        - type
        - image_url
      properties:
        type:
          type: string
          enum:
            - image_url
          description: コンテンツタイプ
        image_url:
          type: object
          required:
            - url
          properties:
            url:
              type: string
              format: uri
              description: |-
                画像URLアドレス

                **制限**:
                - 画像1枚あたりの最大サイズ: `10MB`
                - サポート形式: `.jpeg`, `.jpg`, `.png`, `.webp`
                - URL要件: 公開アクセス可能であること、通常は画像拡張子で終わること
              example: https://example.com/image.png
    ToolCall:
      type: object
      required:
        - id
        - type
        - function
      properties:
        id:
          type: string
          description: Tool call ID.
        type:
          type: string
          enum:
            - function
          description: Tool call type.
        function:
          type: object
          required:
            - name
            - arguments
          properties:
            name:
              type: string
              description: Function name.
            arguments:
              type: string
              description: Function arguments as a JSON string.
    TopLogProb:
      type: object
      description: Logprob details for a candidate token.
      properties:
        token:
          type: string
          description: Candidate token text.
        logprob:
          type: number
          description: Logprob value of the candidate token.
        bytes:
          type: array
          nullable: true
          description: UTF-8 byte sequence of the candidate token.
          items:
            type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##すべてのAPIにBearer Token認証が必要です##

        **APIキーの取得：**

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

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

````