Everstack
API ReferenceGatewayChat Completion

Chat Completion

POST/v1/chat/completions
POST/v1/chat/completions

Your instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.

Request Body

PropertyTypeRequiredDescription
modelstringNo
messagesobject[]No
samplingobjectNo
responseFormatobjectNo
streambooleanNoStreaming hint; use ChatStream for true streaming. Optional to allow presence detection.
metadataobjectNo
toolsobject[]No
toolChoiceobjectNo
parallelToolCallsbooleanNo

Responses

200 The chat completion

PropertyTypeDescription
resultobject
errorobject

default An unexpected error response.

PropertyTypeDescription
codeinteger
messagestring
detailsobject[]

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"
    }
  ]
}