Chat Completion
POST
/v1/chat/completions
Supports all OpenAI Chat models, including the latest versions
For detailed parameters about this API, you can refer to OpenAI's official documentation: https://platform.openai.com/docs/api-reference/chat/create
You can also use this API to call many non-OpenAI models in the format of OpenAI's ChatCompletion API, such as Anthropic's Claude series models, TA, ChatGLM, Cohere, etc. For the specific list of supported models, please refer to the model list on the website settings page, as the content in the documentation may not be maintained in a timely manner
Gemini Pro Vision Usage Example
Example input:
{
"model": "gemini-pro-vision",
"messages": [
{
"role": "user",
"content": [
{
"type": "text", "text": "Describe this image"
},
{
"type": "image_url",
"image_url": "https://pbs.twimg.com/media/GBEB1CbbIAAC28o?format=jpg&name=small"
}
]
}
],
"stream": false
}
Response result:
{
"id": "chatcmpl-gPyHaMj77C8Uca3UudUL5zxvAvI3N",
"object": "chat.completion",
"created": 1702560711,
"model": "gemini-pro-vision",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": " These are emoticons of five different characters. They are:\n- Hu Tao\n- Yao Yao\n- Sayu\n- Keqing\n- Sangonomiya Kokomi"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 8,
"completion_tokens": 48,
"total_tokens": 56
}
}
"stream": true
) response result:data: {"id":"chatcmpl-6tzfeCctklU06xs8BmDo3b1YcCold","object":"chat.completion.chunk","created":1702562069,"model":"gemini-pro-vision","choices":[{"index":0,"delta":{"role":"assistant","content":" These are emoticons of five different characters. They are:\n- Hu Tao\n- Yao Yao\n- Sayu\n- Keqing\n- Sangonomiya"},"finish_reason":null}]}
data: {"id":"chatcmpl-6tzfeCctklU06xs8BmDo3b1YcCold","object":"chat.completion.chunk","created":1702562069,"model":"gemini-pro-vision","choices":[{"index":0,"delta":{"role":"assistant","content":" Kokomi"},"finish_reason":null}]}
data: [DONE]
Request
Body Params application/json