curl --request POST \
--url https://api.tokenops.ai/v1beta/models/{model}:streamGenerateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"parts": [
{
"text": "请详细介绍人工智能的未来发展趋势"
}
]
}
]
}
'
{
"candidates": [
{
"content": {
"parts": [
{
"text": "你好,请介绍一下你自己"
}
],
"role": "user"
},
"finishReason": "FINISH_REASON_UNSPECIFIED",
"index": 123,
"safetyRatings": [
{
"category": "<string>",
"probability": "HARM_PROBABILITY_UNSPECIFIED",
"blocked": true
}
],
"citationMetadata": {
"citationSources": [
{
"startIndex": 123,
"endIndex": 123,
"uri": "<string>",
"license": "<string>"
}
]
},
"tokenCount": 123
}
],
"promptFeedback": {
"blockReason": "BLOCK_REASON_UNSPECIFIED",
"safetyRatings": [
{
"category": "<string>",
"probability": "HARM_PROBABILITY_UNSPECIFIED",
"blocked": true
}
]
},
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"totalTokenCount": 123,
"cachedContentTokenCount": 123
},
"modelVersion": "gemini-2.5-flash"
}Gemini接口
streamGenerateContent
使用指定模型流式生成内容
POST
/
v1beta
/
models
/
{model}
:streamGenerateContent
curl --request POST \
--url https://api.tokenops.ai/v1beta/models/{model}:streamGenerateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"parts": [
{
"text": "请详细介绍人工智能的未来发展趋势"
}
]
}
]
}
'
{
"candidates": [
{
"content": {
"parts": [
{
"text": "你好,请介绍一下你自己"
}
],
"role": "user"
},
"finishReason": "FINISH_REASON_UNSPECIFIED",
"index": 123,
"safetyRatings": [
{
"category": "<string>",
"probability": "HARM_PROBABILITY_UNSPECIFIED",
"blocked": true
}
],
"citationMetadata": {
"citationSources": [
{
"startIndex": 123,
"endIndex": 123,
"uri": "<string>",
"license": "<string>"
}
]
},
"tokenCount": 123
}
],
"promptFeedback": {
"blockReason": "BLOCK_REASON_UNSPECIFIED",
"safetyRatings": [
{
"category": "<string>",
"probability": "HARM_PROBABILITY_UNSPECIFIED",
"blocked": true
}
]
},
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"totalTokenCount": 123,
"cachedContentTokenCount": 123
},
"modelVersion": "gemini-2.5-flash"
}model 接受完整 TokenOps 模型名称,包括 google/gemini-3.1-pro-preview 这类带 /
的名称。官方 Google GenAI SDK 可直接使用该名称,无需 URL 或响应适配。Authorizations
TokenOPS.AI API密钥认证。在 Authorization HTTP Header 中包含您的 API-Key,格式为 Bearer {API_KEY}
Path Parameters
完整 TokenOps 模型名称,如 gemini-2.5-flash 或 google/gemini-3.1-pro-preview。斜杠是模型标识的一部分,客户端无需删除、替换或编码。
Example:
"gemini-2.5-flash"
Body
application/json
输入内容列表,表示对话历史
Show child attributes
Show child attributes
Example:
[{ "parts": [{ "text": "你好,请介绍一下你自己" }] }]
可用的工具列表
Show child attributes
Show child attributes
工具配置选项
Show child attributes
Show child attributes
安全设置
Show child attributes
Show child attributes
系统指令
Show child attributes
Show child attributes
生成配置参数
Show child attributes
Show child attributes