BoyueRichData
  1. 聊天(Chat)
BoyueRichData
  • 开始使用
    • 注册指南
  • 中转介绍
    • 中转公告
    • 分组介绍
    • 常见问题QA
    • 接口文档及示例代码
  • 使用文档(新版 开发中)
    • 应用接入
      • Claude Code
      • Codex Cli
    • 示例代码(HTTP)
      • 聊天(Chat)
        • 原生OpenAI格式
          • ChatCompletions格式
          • Responses格式
        • 原生Gemini格式
          POST
        • 原生Claude格式
          POST
      • 图像(Images)
        • 原生OpenAI格式
          • 生成图像
          • 编辑图像
        • 原生Gemini格式
          • Nano Banana
        • 通义千问OpenAI格式
          • 生成图像
          • 编辑图像
      • 视频(Videos)
        • Sora格式
          • 创建视频
          • 获取视频任务状态
          • 获取视频内容
        • 可灵格式
          • Kling 文生视频
          • 获取 Kling 文生视频任务状态
          • Kling 图生视频
          • 获取 Kling 图生视频任务状态
        • 即梦格式
          • 即梦视频生成
        • 创建视频生成任务
        • 获取视频生成任务状态
      • 嵌入(Embeddings)
        • 原生OpenAI格式
        • 原生Gemini格式
      • 补全(Completions)
        • 原生OpenAI格式
      • 音频(Audio)
        • 原生OpenAI格式
          • 音频转录
          • 音频翻译
          • 文本转语音
        • 原生Gemini格式
      • 实时语音(Realtime)
        • 原生OpenAI格式
      • 重排序(Rerank)
        • 文档重排序
      • 审查(Moderations)
        • 原生OpenAI格式
      • 未实现(Unimplemented)
        • 微调(Fine-tuning)
          • 列出微调任务 (未实现)
          • 创建微调任务 (未实现)
          • 获取微调任务详情 (未实现)
          • 取消微调任务 (未实现)
          • 获取微调任务事件 (未实现)
        • 文件(Files)
          • 列出文件 (未实现)
          • 上传文件 (未实现)
          • 获取文件信息 (未实现)
          • 删除文件 (未实现)
          • 获取文件内容 (未实现)
    • 示例代码(OpenAI SDK)
      • [SDK]OpenAI聊天补全(Chat Completions)
  • 数据模型
    • Schemas
      • ModelsResponse
      • ErrorResponse
      • GeminiModelsResponse
      • ChatCompletionResponse
      • ChatCompletionRequest
      • CompletionRequest
      • CompletionResponse
      • ResponsesRequest
      • ResponsesResponse
      • ClaudeRequest
      • ClaudeResponse
      • EmbeddingRequest
      • EmbeddingResponse
      • ImageResponse
      • AudioTranscriptionResponse
      • SpeechRequest
      • RerankRequest
      • RerankResponse
      • VideoRequest
      • ModerationRequest
      • VideoResponse
      • ModerationResponse
      • VideoTaskResponse
      • GeminiRequest
      • GeminiResponse
      • OpenAIVideoError
      • Model
      • Message
      • MessageContent
      • ToolCall
      • Usage
      • Tool
      • ResponseFormat
      • ClaudeMessage
      • VideoTaskMetadata
      • VideoTaskError
  1. 聊天(Chat)

原生Gemini格式

POST
/v1beta/models/{model_name}:generateContent
代理 Gemini API 请求。
路径格式: /v1beta/models/{model_name}:{action}
例如:
/v1beta/models/gemini-2.5-pro:generateContent
/v1beta/models/gemini-2.5-pro:streamGenerateContent?alt=sse
仅支持通过inline_data以 base64 方式上传音频、视频、PDF,不支持 file_data.file_uri 或 File API。

请求参数

Authorization
Bearer Token
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
or
Path 参数

Body 参数application/json

示例
{
    "contents": [
        {
            "parts": [
                {
                    "text": "Write a story about a magic backpack."
                }
            ]
        }
    ]
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST '/v1beta/models/:generateContent' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "contents": [
        {
            "parts": [
                {
                    "text": "Write a story about a magic backpack."
                }
            ]
        }
    ]
}'

返回响应

🟢200成功
application/json
成功
Body

示例
{
    "candidates": [
        {
            "content": {
                "role": "model",
                "parts": [
                    {
                        "text": "Leo wasn't looking for magic when he stumbled upon the old backpack. He was looking for his grandmother’s missing gardening gloves, a task that had led him deep into the dusty labyrinth of her attic. Cobweb-draped trunks loomed like sleeping giants, and the air smelled of forgotten things and faint lavender.\n\nTucked away behind a stack of moth-eaten blankets was a rucksack. It wasn’t flashy. Made of thick, worn leather, its brass buckles were tarnished green, and its canvas flaps were faded to a nameless beige. It looked ancient, humble, and utterly uninteresting. Yet, something about its unassuming presence caught Leo’s eye. He pulled it out, brushing away a layer of dust. The leather felt surprisingly supple, and the canvas, though faded, was incredibly sturdy.\n\nHe unfastened the buckles and peered inside. It was dark, a deep, endless-looking pocket. He decided to test its capacity. First, his grandmother’s gardening gloves – surprisingly, they weren't in there, but he tossed in a hefty old dictionary he’d found nearby. The backpack didn’t feel any heavier. Curious, he added a terracotta pot, a rolled-up tapestry, and even a heavy brass telescope. Still, the rucksack felt empty, light as a feather.\n\nA thrill of pure wonder, sharp and sweet, coursed through Leo. This wasn’t just a backpack; it was *more*.\n\nHe carried it down from the attic, a secret treasure nestled against his back. Over the next few days, he experimented. He could fit his entire schoolbag inside, textbooks, lunchbox, art supplies, and all, and it would still feel no heavier than a feather. He could reach in and, with a vague thought of what he needed, often pull out something remarkably close.\n\nOne afternoon, during a particularly boring history lesson, Leo’s pencil snapped. Annoyed, he mumbled, “Wish I had a new pencil.” He instinctively reached into the backpack. His fingers closed around something smooth and hexagonal. He pulled out a brand-new, perfectly sharpened pencil. His eyes widened. It wasn't just storing things; it was *providing* them.\n\nThe magic wasn’t always exact. When he wished for \"something delicious,\" he once pulled out a jar of pickled gherkins (which he hated) and another time, a warm, still-steaming apple turnover. It seemed to have a quirky, unpredictable personality, a sense of humor perhaps.\n\nLeo, a quiet and imaginative boy, found himself utterly enchanted. He started using the backpack for small acts of kindness. His friend, Maya, always forgetting her lunch money, found a crisp five-dollar bill waiting for her when she checked her pocket after Leo had casually brushed past her. A stray kitten, mewling sadly, was found by Leo with a small bowl of milk and a tin of tuna mysteriously appearing at his feet, courtesy of the backpack’s depths.\n\nThe real test came during the annual school fair. The class was running a \"guess the number of jellybeans\" jar, but the main prize, a shiny new scooter, had gone missing from the supply room just an hour before the fair opened. Panic ensued.\n\n\"We can't have a fair without a prize!\" exclaimed Mrs. Henderson, wringing her hands.\n\nLeo felt a familiar tug of responsibility. He pictured the scooter – gleaming chrome, red highlights, air-filled tires. He slipped away from the commotion, found a quiet corner behind the gym, and opened the backpack. He focused, not just on the scooter itself, but on the *need* – the disappointment of the kids, the ruined fair.\n\nHe reached in. His hand brushed against something cold and metallic, then smooth rubber. He pulled. It was heavy, much heavier than anything he’d ever pulled from the backpack before, yet it slid out with surprising ease. A brand-new scooter, identical to the missing one, stood before him, still wrapped in plastic.\n\nHe quickly wheeled it back, pretending he'd \"found it\" tucked away in a neglected corner. Mrs. Henderson was overjoyed, and the fair went on without a hitch.\n\nThat night, Leo sat on his bed, the magic backpack resting beside him. He understood then that it wasn't just a toy, or a convenient trick. It was a tool, imbued with a quiet power that seemed to respond to intention, particularly good intention. It didn't grant every selfish whim, but when there was a genuine need, a problem to solve, it rose to the occasion.\n\nHe thought about all the forgotten corners of the world, all the small needs and large ones. He knew his secret had to stay a secret, but he also knew the backpack had chosen him for a reason. As he drifted off to sleep, a small, worn map of his town subtly unfolded from the backpack’s main compartment, waiting for his next adventure, his next quiet act of magic. Leo knew his days of being just a quiet boy were over. He was now the keeper of wonders, and his journey had just begun."
                    }
                ]
            },
            "finishReason": "STOP",
            "avgLogprobs": -1.2748369489397322
        }
    ],
    "usageMetadata": {
        "promptTokenCount": 8,
        "candidatesTokenCount": 1064,
        "totalTokenCount": 2545,
        "trafficType": "ON_DEMAND",
        "promptTokensDetails": [
            {
                "modality": "TEXT",
                "tokenCount": 8
            }
        ],
        "candidatesTokensDetails": [
            {
                "modality": "TEXT",
                "tokenCount": 1064
            }
        ],
        "thoughtsTokenCount": 1473
    },
    "modelVersion": "gemini-2.5-flash",
    "createTime": "2025-12-10T02:57:01.117202Z",
    "responseId": "feE4adKTB_6V4_UPhfnL6QY"
}
修改于 2025-12-10 03:54:56
上一页
Responses格式
下一页
原生Claude格式
Built with