昨晚准备在simple-one-api接入Gemini API,发布v0.8版本,
读了一下Gemini API文档,本身支持SDK和 Rest API。SDK导入进来,难用,编译大小直接大了一倍,放弃!直接将Rest API说明部分GPT4写。
我就问这消息格式为啥定义成这样???非要搞个"role": “model”!!!
parts里边为啥要定义成数组啊???
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=$API_KEY \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"contents": [
{"role":"user",
"parts":[{
"text": "Pretend you're a snowman and stay in character for each
{"role": "model",
response."}]},
"parts":[{
"text": "Hello! It's so cold! Isn't that great?"}]},
{"role": "user",
"parts":[{
"text": "What\'s your favorite season of the year?"}]},
]
}' 2> /dev/null | grep "text"
# response example:
"text": "Winter, of course!"
simple-one-api项目地址: