Skip to main content
POST
生成内容
The Gemini GenerateContent API generates model responses and supports multi-turn conversations, multimodal content, and tool calls; the specific features available depend on the model and proxy route. To call the API, use the mainland China endpoint https://geekai.co/api/v1beta/models/{model}:generateContent and provide your GeekAI API KEY in the x-goog-api-key header. Replace {model} with the model ID; this compatibility API currently supports only Gemini models. The request and response formats follow the official Gemini API documentation. For SDK configuration and usage examples, see Gemini compatibility. Support for particular features and parameters depends on the selected model and route. To receive generated results incrementally, use the streaming content generation API.

Authorizations

Authorization
string
header
required

极客智坊 API KEY

Path Parameters

model
string
required

Gemini 模型 ID,不包含 models/ 前缀。

Example:

"gemini-3-flash-preview"

Body

application/json
contents
object[]
required

当前请求的对话内容;多轮对话需包含历史消息和最新消息。

systemInstruction
object

开发者提供的系统指令,目前仅支持文本。

tools
object[]

模型可使用的工具;可用工具取决于模型和渠道。

toolConfig
object
safetySettings
object[]

按类别覆盖默认安全设置;同一类别不能重复。

generationConfig
object

生成参数。默认值和可用范围可能因模型而异。

cachedContent
string

缓存内容资源名称,格式为 cachedContents/{cachedContent}。

serviceTier
enum<string>

请求的服务等级,是否可用取决于模型和渠道。

Available options:
unspecified,
standard,
flex,
priority
store
boolean

此请求的日志记录配置,设置时覆盖项目级配置。

continuationToken
string

用于继续 finishReason 为 CONTINUATION 的响应;contents 必须与原请求一致。

labels
object

用户定义的请求标签。

Response

生成结果。请求被安全策略拦截时,可能没有 candidates,请查看 promptFeedback。

candidates
object[]

模型生成的候选结果;输入被拦截时可能为空。

promptFeedback
object

输入内容的安全反馈。

usageMetadata
object

请求的 token 使用量。

modelVersion
string

实际使用的模型版本。

responseId
string

响应标识。

modelStatus
object

模型状态信息。