Chat
Chat Completions
Query LLM using text and, for vision-capable models, image data. This endpoint supports multiple models (up to 5, comma-separated) in the model field. Specify the appropriate request format depending on whether the model is text-based or vision-capable.
An array of responses: will be returned for multi-model queries.
Please refer to the ChatCompletionRequest for text-based models and VisionChatCompletionRequest for vision-capable models for detailed request formats.
post/v1/chat/completions
Request
- Base URL: https://apipie.ai
- URL: https://apipie.ai/v1/chat/completions
- Auth: one of:
- HTTP bearer
- API key in header x-api-key
Request body
Example request
{
"messages": [
{
"role": "system",
"content": "Respond in Swedish."
},
{
"role": "assistant",
"content": "additional data to help the system answer the users prompt"
},
{
"role": "user",
"content": "Why the sky is blue?"
}
],
"user": "12345",
"inline_cli": "all",
"model": "gpt-3.5-turbo",
"provider": "openai",
"memory": true,
"mem_session": "test3746",
"mem_expire": 60,
"mem_clear": 1,
"mem_msgs": 10,
"mem_length": 20,
"shortMem": 3,
"longMem": 2,
"rag_tune": "my-files",
"routing": "perf",
"temperature": 1,
"top_p": 1,
"repetition_penalty": 1,
"n": 1,
"beam_size": 1,
"search_whitelist": [
"apnews.com",
"bbc.com",
"reuters.com"
],
"search_blacklist": [
"cnn.com",
"foxnews.com"
],
"web_search_options": {
"search_context_size": "medium"
},
"search_provider": "valyu",
"search_lang": "en",
"search_geo": "US",
"max_tokens": 300,
"stream_errors": true,
"tools": [
{
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g., San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location"
]
}
}
}
],
"tool_choice": "auto",
"tools_model": "claude-3-5-sonnet",
"integrity": 12,
"integrity_model": "gpt-3.5-turbo"
}Response
Result of the Query
Changes
No recorded changes to this operation across all 1 revision of this API.