curl --request POST \
--url https://gateway.your-domain.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "smart-router",
"messages": [
{
"role": "user",
"content": "What is a REST API? Answer in one sentence."
}
]
}
'{
"id": "chatcmpl-DzMATVxiop5hLr5W1R9Sgggf37Sji",
"model": "smart-router",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "A REST API is a web service interface that lets clients access resources over HTTP using GET, POST, PUT, and DELETE."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 17,
"completion_tokens": 33,
"total_tokens": 50
}
}{
"error": {
"message": "Authentication Error, No api key passed in."
}
}Chat
Chat completion
OpenAI-compatible chat completion. Name a model, or a Smart Router for automatic selection.
POST
/
v1
/
chat
/
completions
curl --request POST \
--url https://gateway.your-domain.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "smart-router",
"messages": [
{
"role": "user",
"content": "What is a REST API? Answer in one sentence."
}
]
}
'{
"id": "chatcmpl-DzMATVxiop5hLr5W1R9Sgggf37Sji",
"model": "smart-router",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "A REST API is a web service interface that lets clients access resources over HTTP using GET, POST, PUT, and DELETE."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 17,
"completion_tokens": 33,
"total_tokens": 50
}
}{
"error": {
"message": "Authentication Error, No api key passed in."
}
}Authorizations
A ForceAI virtual key or the master key, sent as Authorization: Bearer <key>.
Body
application/json