Chat Completion
POST
/v1/chat/completionsPOST
/v1/chat/completionsYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Request Body
| Property | Type | Required | Description |
|---|---|---|---|
model | string | No | |
messages | object[] | No | |
sampling | object | No | |
responseFormat | object | No | |
stream | boolean | No | Streaming hint; use ChatStream for true streaming. Optional to allow presence detection. |
metadata | object | No | |
tools | object[] | No | |
toolChoice | object | No | |
parallelToolCalls | boolean | No |
Responses
200 The chat completion
| Property | Type | Description |
|---|---|---|
result | object | |
error | object |
default An unexpected error response.
| Property | Type | Description |
|---|---|---|
code | integer | |
message | string | |
details | object[] |
Request
curl -X POST "http://localhost:8089/openai/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"string","messages":[{"role":"ROLE_UNSPECIFIED","content":[],"toolCalls":[],"toolCallId":"string","name":"string"}],"sampling":{"temperature":0,"topP":0,"maxTokens":0,"stop":["string"],"maxCompletionTokens":0},"stream":true,"tools":[{"type":"string","function":{"name":"string","description":"string"}}],"toolChoice":{"mode":"string","specificTool":{"type":"string","function":{"name":"string","description":"string"}}},"parallelToolCalls":true}'const response = await fetch("http://localhost:8089/openai/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "string",
"messages": [
{
"role": "ROLE_UNSPECIFIED",
"content": [],
"toolCalls": [],
"toolCallId": "string",
"name": "string"
}
],
"sampling": {
"temperature": 0,
"topP": 0,
"maxTokens": 0,
"stop": [
"string"
],
"maxCompletionTokens": 0
},
"stream": true,
"tools": [
{
"type": "string",
"function": {
"name": "string",
"description": "string"
}
}
],
"toolChoice": {
"mode": "string",
"specificTool": {
"type": "string",
"function": {
"name": "string",
"description": "string"
}
}
},
"parallelToolCalls": true
}),
});
const data = await response.json();import requests
response = requests.post(
"http://localhost:8089/openai/v1/chat/completions",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "string",
"messages": [
{
"role": "ROLE_UNSPECIFIED",
"content": [],
"toolCalls": [],
"toolCallId": "string",
"name": "string"
}
],
"sampling": {
"temperature": 0,
"topP": 0,
"maxTokens": 0,
"stop": [
"string"
],
"maxCompletionTokens": 0
},
"stream": true,
"tools": [
{
"type": "string",
"function": {
"name": "string",
"description": "string"
}
}
],
"toolChoice": {
"mode": "string",
"specificTool": {
"type": "string",
"function": {
"name": "string",
"description": "string"
}
}
},
"parallelToolCalls": true
},
)
data = response.json()Response
{
"result": {
"id": "string",
"created": "string",
"model": "string",
"choices": [
{
"index": 0,
"finishReason": "string"
}
],
"usage": {
"promptTokens": 0,
"completionTokens": 0,
"totalTokens": 0
},
"fallbackInfo": {
"fallbackUsed": true,
"requestedModel": "string",
"actualModel": "string",
"fallbackReason": "string",
"fallbackAttempts": 0
}
},
"error": {
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}
}{
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}
