cURL
curl --request POST \ --url https://api.ttapi.io/gemini/chat/completions \ --header 'Content-Type: application/json' \ --header 'TT-API-KEY: <api-key>' \ --data ' { "messages": [ { "role": "user", "content": "Hello!" } ], "model": "<string>", "stream": "false" } '
{ "choices": [ { "finish_reason": "stop", "index": 0, "message": { "content": "你好!很高兴和你聊天。\n\n有什么可以帮你的吗?或者想聊点什么? 😊", "role": "assistant" } } ], "created": 1757472417, "id": "oebAaMTvMfCUjMcP_prYwAs", "model": "gemini-2.5-pro", "object": "chat.completion", "usage": { "completion_tokens": 21, "prompt_tokens": 3, "total_tokens": 1466 } }
Documentation IndexFetch the complete documentation index at: https://docs.ttapi.io/llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: https://docs.ttapi.io/llms.txt
Use this file to discover all available pages before exploring further.
请前往 TTAPI 控制台 获取 API 密钥。
Show child attributes
[{ "role": "user", "content": "Hello!" }]
TTAPI 支持使用的模型,详见Gemini支持模型
是否使用服务器发送的事件逐步传输响应
成功响应(stream=false 返回JSON,stream=true 返回Gemini流式)
响应结果列表
响应创建时间戳(秒)
1757472417
请求唯一标识
"oebAaMTvMfCUjMcP_prYwAs"
使用的 Gemini 模型版本
"gemini-2.5-pro"
响应对象类型
"chat.completion"
token 使用统计