对话补全:Gemini 3.5 Flash-Lite(OpenAI 兼容)
curl --request POST \
--url https://api.apiyi.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gemini-3.5-flash-lite",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "gemini-3.5-flash-lite",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gemini-3.5-flash-lite',
messages: [{role: 'user', content: '用一句话介绍你自己'}]
})
};
fetch('https://api.apiyi.com/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gemini-3.5-flash-lite',
'messages' => [
[
'role' => 'user',
'content' => '用一句话介绍你自己'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"gemini-3.5-flash-lite\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gemini-3.5-flash-lite\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gemini-3.5-flash-lite\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"choices": [
{
"message": {
"role": "<string>",
"content": "<string>",
"tool_calls": [
{}
]
},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}Gemini 3.5 Flash-Lite
Gemini 3.5 Flash-Lite Chat API 参考
Gemini 3.5 Flash-Lite Chat Completions API 参考与在线调试:OpenAI 兼容格式,默认零思考极速响应,支持流式、Function Call、视觉。
POST
/
v1
/
chat
/
completions
对话补全:Gemini 3.5 Flash-Lite(OpenAI 兼容)
curl --request POST \
--url https://api.apiyi.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gemini-3.5-flash-lite",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
'import requests
url = "https://api.apiyi.com/v1/chat/completions"
payload = {
"model": "gemini-3.5-flash-lite",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己"
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gemini-3.5-flash-lite',
messages: [{role: 'user', content: '用一句话介绍你自己'}]
})
};
fetch('https://api.apiyi.com/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apiyi.com/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'gemini-3.5-flash-lite',
'messages' => [
[
'role' => 'user',
'content' => '用一句话介绍你自己'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apiyi.com/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"gemini-3.5-flash-lite\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.apiyi.com/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gemini-3.5-flash-lite\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gemini-3.5-flash-lite\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"用一句话介绍你自己\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"model": "<string>",
"choices": [
{
"message": {
"role": "<string>",
"content": "<string>",
"tool_calls": [
{}
]
},
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}右侧 Playground 可直接调试:在 Authorization 填
Bearer sk-your-api-key,点击发送即可看到响应——默认零思考,速度很快。需要深度推理传
reasoning_effort: "high"(注意:本模型该端点不回显 reasoning_tokens,精确观测思考消耗请用 原生在线调试)。搜索 grounding、代码执行等原生工具本端点不支持。概览与实测数据见 Gemini 3.5 Flash-Lite 概览。参数说明速查
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | ✓ | 固定 gemini-3.5-flash-lite |
messages | array | ✓ | OpenAI 标准消息数组;content 可为多模态数组(image_url 支持 data URL) |
max_tokens | int | 输出配额;开 reasoning_effort: "high" 时建议 2000+ | |
reasoning_effort | string | high 可触发思考;usage 不回显思考量 | |
stream | bool | SSE 流式 | |
response_format | object | json_schema 结构化输出,实测可用 | |
tools | array | Function Call 工具列表,实测可用 |
响应要点
- 本模型
usage.completion_tokens_details.reasoning_tokens不回显(3.6 Flash 正常回显)——思考消耗已计入completion_tokens - 思考正文(reasoning_content)本端点不回显
- 模型名注意核对
gemini-3.5-flash-lite(三段小写连字符)
授权
在请求头中添加 Authorization: Bearer YOUR_API_KEY
请求体
application/json
固定 gemini-3.5-flash-lite
OpenAI 标准消息数组
Show child attributes
Show child attributes
输出配额;开思考时建议 2000+(思考计入输出)
SSE 流式输出
思考分档
可用选项:
low, medium, high 结构化输出,支持 json_schema
Function Call 工具列表
此页面对您有帮助吗?
⌘I