1. Chat
PeakkAI-Doc
English
  • 中文
  • English
  • 首页
  • English
    • Home Page
    • PeakkAI-API
      • Model
        • Native OpenAI Format
        • Native Gemini Format
      • Chat
        • Native OpenAI Format
          POST
        • Native Gemini Format
          POST
        • Native Claude Format
          POST
        • Responses Request (openai)
          POST
      • Audio
        • Native OpenAI Format TTS
        • Native Gemini Format TTS
      • Images
        • Native OpenAI Format Image Editing (JSON)
        • Native OpenAI Format Image Generation
        • Native OpenAI Format Image Editing (Multipart)
        • Native Gemini Format Image Generation
      • Video
        • Seedance2.0 format
          • Create Video Generation Task
          • Query Video Generation Task Status
      • Vector
        • Embeddings
          • Create Embedding
      • Translation
        • Speech Translation
    • AI application
      • PeakkAI API Integration with Claude Code
      • PeakkAI API Integration with Cursor
      • PeakkAI API Integration with Codex-cli
      • PeakkAI API Integration with Codex Desktop
      • PeakkAI API Integration with Hermes Agent
  1. Chat

Native Gemini Format

POST
/v1beta/models/{model}:generateContent

Gemini Native (Text)#

Call the AboAI API using the Google Gemini native format

Introduction#

The Gemini Native API adopts the request and response formats of Google Gemini, making it suitable for official Google clients (such as the google-generativeai SDK) or scenarios that require direct use of Gemini data structures. This interface complies with the Gemini API specifications and fully supports capabilities like Thinking mode, multimodal input, tool calling, Google Search (Grounding), and image generation.

API Endpoints#

FeatureMethodPath
Content Generation (Non-streaming)POST/v1beta/models/{model}:generateContent
Content Generation (Streaming)POST/v1beta/models/{model}:streamGenerateContent?alt=sse

Authentication#

Supports either of the following methods:
Header ParameterTypeDescription
AuthorizationstringBearer Token: Bearer sk-xxxxxxxxxx (Recommended, consistent with other AboAI endpoints)
x-goog-api-keystringGoogle-style API Key: x-goog-api-key: sk-xxxxxxxxxx
Parameters can also be passed via URL: ?key=sk-xxxxxxxxxx.

请求参数

Path 参数

Query 参数

Header 参数

Body 参数application/json

示例
{
    "contents": [
        {
            "role": "user",
            "parts": [
                {
                    "text": "Introduce artificial intelligence in one sentence."
                }
            ]
        }
    ]
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
cURL
curl --location 'https://api.peakkai.ai/v1beta/models/gemini-2.5-pro:generateContent?key=undefined' \
--header 'x-goog-api-key: x-goog-api-key:sk-HusFtHu0hUwQU05an5Jf_YQOjD5norZDt5crVbsMN-o' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data '{
    "contents": [
        {
            "role": "user",
            "parts": [
                {
                    "text": "Introduce artificial intelligence in one sentence."
                }
            ]
        }
    ]
}'

返回响应

🟢200
application/json
Bodyapplication/json

示例
{
    "candidates": [
        {
            "content": {
                "parts": [
                    {
                        "text": "Response text"
                    }
                ],
                "role": "model"
            },
            "finishReason": "STOP",
            "index": 0,
            "safetyRatings": []
        }
    ],
    "usageMetadata": {
        "promptTokenCount": 10,
        "candidatesTokenCount": 20,
        "totalTokenCount": 30,
        "thoughtsTokenCount": 0,
        "cachedContentTokenCount": 0
    },
    "modelVersion": "gemini-2.5-pro",
    "createTime": "2025-01-01T00:00:00Z"
}
修改于 2026-11-02 09:46:28
上一页
Native OpenAI Format
下一页
Native Claude Format
Built with