> ## 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 2.5 Pro - Native API - API Reference

> - Call Gemini-2.5-pro model using Google Native API format
- Can use synchronous processing mode, returns conversation content in real-time
- **Plain text conversation**: Single-turn or multi-turn contextual dialogue, see simple_text and multi_turn examples in code samples
- **Multimodal input**: Supports text + image/audio/video mixed input, see audio_analysis, image_understanding, and multi_file examples in code samples
- **Parameter tuning**: Control generation quality via generationConfig
- **Streaming**: Replace `generateContent` with `streamGenerateContent` in the URL

<Tip>
  **Streaming**: Replace `generateContent` with `streamGenerateContent` in the URL. The request body parameters are identical. Responses will be returned in streaming chunks. See the "Streaming Response" section below for the response format.
</Tip>

<Note>
  **BaseURL**: The default BaseURL is `https://direct.evolink.ai`, which has better support for text models and long-lived connections. `https://api.evolink.ai` is the primary endpoint for multimodal services and serves as a fallback address for text models.
</Note>


## OpenAPI

````yaml /en/api-manual/language-series/gemini-2.5-pro/native-api/native-api-reference.json POST /v1beta/models/gemini-2.5-pro:generateContent
openapi: 3.1.0
info:
  title: Gemini Native API - Full Reference
  description: >-
    Complete reference documentation for Google Gemini Native API, supporting
    multimodal inputs including text, images, audio, and video
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: Production (recommended)
  - url: https://api.evolink.ai
    description: Alternative URL
security:
  - bearerAuth: []
tags:
  - name: Content Generation
    description: Gemini AI content generation related APIs
paths:
  /v1beta/models/gemini-2.5-pro:generateContent:
    post:
      tags:
        - Content Generation
      summary: Gemini Content Generation
      description: >-
        - Call Gemini-2.5-pro model using Google Native API format

        - Can use synchronous processing mode, returns conversation content in
        real-time

        - **Plain text conversation**: Single-turn or multi-turn contextual
        dialogue, see simple_text and multi_turn examples in code samples

        - **Multimodal input**: Supports text + image/audio/video mixed input,
        see audio_analysis, image_understanding, and multi_file examples in code
        samples

        - **Parameter tuning**: Control generation quality via generationConfig

        - **Streaming**: Replace `generateContent` with `streamGenerateContent`
        in the URL
      operationId: generateContent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateContentRequest'
            examples:
              simple_text:
                summary: Single-turn text conversation
                value:
                  contents:
                    - role: user
                      parts:
                        - text: Please introduce yourself
              multi_turn:
                summary: Multi-turn conversation (context understanding)
                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: Audio analysis
                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: Image understanding
                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: Multi-file input (mixed)
                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: >-
            Content generated successfully


            **Response format description**:

            - When using the `generateContent` endpoint, returns
            `GenerateContentResponse` (returns complete response at once)

            - When using the `streamGenerateContent` endpoint, returns
            `StreamGenerateContentResponse` (streaming response, returns content
            in chunks)
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/GenerateContentResponse'
                  - $ref: '#/components/schemas/StreamGenerateContentResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: Unauthorized, invalid or expired token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: Insufficient quota, recharge required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 402
                  message: Insufficient quota
                  type: insufficient_quota_error
                  fallback_suggestion: https://evolink.ai/dashboard/billing
        '403':
          description: Access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 403
                  message: Access denied for this model
                  type: permission_error
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: Model not found
                  type: not_found_error
        '413':
          description: Request body too large, file too large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 413
                  message: Request body too large
                  type: request_too_large_error
                  fallback_suggestion: reduce file size
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: Rate limit exceeded
                  type: rate_limit_error
                  fallback_suggestion: retry after 60 seconds
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message: Internal server error
                  type: internal_server_error
                  fallback_suggestion: try again later
        '502':
          description: Upstream service error
          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: Service temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: Service temporarily unavailable
                  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: Sync Response
      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.1-pro-preview
        responseId:
          type: string
          description: Response ID
          example: l-LoaPu0BPmo1dkP6ZPHiQc
    StreamGenerateContentResponse:
      title: Stream Response
      type: object
      description: |-
        Stream response chunk

        **Intermediate chunk**:
        ```json
        {
          "candidates": [
            {
              "content": {
                "role": "model",
                "parts": [{ "text": "Partial text..." }]
              }
            }
          ],
          "usageMetadata": {
            "trafficType": "ON_DEMAND"
          },
          "modelVersion": "gemini-2.5-pro",
          "createTime": "2025-10-10T10:40:23.072315Z",
          "responseId": "xxx"
        }
        ```

        **Last chunk**:
        ```json
        {
          "candidates": [
            {
              "content": {
                "role": "model",
                "parts": [{ "text": "Final text fragment" }]
              },
              "finishReason": "STOP"
            }
          ],
          "usageMetadata": {
            "promptTokenCount": 4,
            "candidatesTokenCount": 522,
            "totalTokenCount": 2191,
            "trafficType": "ON_DEMAND"
          },
          "modelVersion": "gemini-2.5-pro",
          "createTime": "2025-10-10T10:40:23.072315Z",
          "responseId": "xxx"
        }
        ```
      properties:
        candidates:
          type: array
          description: >-
            List of candidate responses (streaming mode does not include index
            and safetyRatings)
          items:
            $ref: '#/components/schemas/StreamCandidate'
        usageMetadata:
          type: object
          description: >-
            Usage statistics (intermediate chunks only have trafficType, last
            chunk contains complete statistics)
          properties:
            promptTokenCount:
              type: integer
              description: Number of tokens in input content (last chunk only)
              example: 4
            candidatesTokenCount:
              type: integer
              description: Number of tokens in output content (last chunk only)
              example: 522
            totalTokenCount:
              type: integer
              description: Total number of tokens (last chunk only)
              example: 2191
            trafficType:
              type: string
              description: Traffic type
              example: ON_DEMAND
            cachedContentTokenCount:
              type: integer
              description: Number of cached content tokens (last chunk only)
              example: 0
        modelVersion:
          type: string
          description: Model version
          example: gemini-2.5-pro
        createTime:
          type: string
          format: date-time
          description: Creation time
          example: '2025-10-10T10:40:23.072315Z'
        responseId:
          type: string
          description: Response ID
          example: l-LoaPu0BPmo1dkP6ZPHiQc
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP status error code
            message:
              type: string
              description: Error description
            type:
              type: string
              description: Error type
            fallback_suggestion:
              type: string
              description: Suggestion when error occurs
    Content:
      type: object
      required:
        - role
        - parts
      properties:
        role:
          type: string
          description: |-
            Content role

            - `user`: User input
            - `model`: AI model's reply (for multi-turn conversation)
          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: |-
            Sampling temperature, controls output randomness

            **Description**:
            - Lower values (e.g., 0.2): More deterministic, focused output
            - Higher values (e.g., 1.5): More random, creative output
          minimum: 0
          maximum: 2
          example: 0.7
        maxOutputTokens:
          type: integer
          description: |-
            Maximum number of tokens for generated response

            **Description**:
            - Too small value may cause response truncation
          minimum: 1
          example: 2000
        topP:
          type: number
          description: >-
            Nucleus Sampling parameter


            **Description**:

            - Controls sampling from tokens with cumulative probability

            - For example, 0.9 means selecting from tokens with cumulative
            probability up to 90%

            - Default: 1.0 (considers all tokens)


            **Recommendation**: Do not adjust temperature and topP
            simultaneously
          minimum: 0
          maximum: 1
          example: 0.9
        topK:
          type: integer
          description: >-
            Top-K sampling parameter


            **Description**:

            - For example, 10 means limiting sampling to consider only the top
            10 most probable tokens

            - Smaller values make output more focused

            - Default: no limit
          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: Candidate index
          example: 0
        safetyRatings:
          type: array
          nullable: true
          description: Safety ratings
          items:
            type: object
    PromptFeedback:
      type: object
      properties:
        safetyRatings:
          type: array
          nullable: true
          description: Prompt safety ratings
          items:
            type: object
    UsageMetadata:
      type: object
      description: Usage statistics
      properties:
        promptTokenCount:
          type: integer
          description: Number of tokens in input content
          example: 4
        candidatesTokenCount:
          type: integer
          description: Number of tokens in output content
          example: 611
        totalTokenCount:
          type: integer
          description: Total number of tokens
          example: 2422
        thoughtsTokenCount:
          type: integer
          description: Number of reasoning tokens
          example: 1807
        promptTokensDetails:
          type: array
          description: Detailed input token information (by modality)
          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: Response role
          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: Token details (statistics by modality)
      properties:
        modality:
          type: string
          description: Content modality type
          enum:
            - MODALITY_UNSPECIFIED
            - TEXT
            - IMAGE
            - AUDIO
            - VIDEO
            - DOCUMENT
          example: TEXT
        tokenCount:
          type: integer
          description: Number of tokens for this modality
          example: 4
    TextPart:
      title: Text Input
      type: object
      required:
        - text
      properties:
        text:
          type: string
          description: Text content
          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: Multimodal Input
      type: object
      required:
        - fileData
      properties:
        fileData:
          type: object
          required:
            - mimeType
            - fileUri
          properties:
            mimeType:
              type: string
              description: |-
                File MIME type

                **Supported types**:

                **Image**:
                - `image/jpeg`, `image/png`
                - Maximum size per image: 10 MB

                **Audio**:
                - `audio/mp3`
                - Maximum size per file: 10 MB
                - Recommended duration: no more than 10 minutes

                **Video**:
                - `video/mp4`
                - Maximum size per file: 50 MB
                - Recommended duration: no more than 180 seconds

                **Document**:
                - `application/pdf`
                - Maximum size per file: 20 MB
              example: audio/mp3
            fileUri:
              type: string
              format: uri
              description: >-
                File URI address


                **Requirements**:

                - Must be a publicly accessible URL

                - URL should end with file extension (e.g., .mp3, .jpg) and
                should match the mimeType parameter
              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: >-
        ##All APIs require Bearer Token authentication##


        **Get API Key:**


        Visit [API Key Management Page](https://evolink.ai/dashboard/keys) to
        get your API Key


        **Add to request header:**

        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````