Skip to main content
Opik Documentation

Search documentation

Type to search this documentation.

Create chat completions

POST/v1/private/chat/completionsCreate chat completions

Create chat completions

Request body

application/json
objectChatCompletionRequest
frequencyPenaltynumber · double
functionCallobject
Show child attributes
argumentsstring
namestring
functionsarray of object
Show child attributes
Show array items
descriptionstring
namestring
parametersobject
strictboolean
logitBiasobject
logprobsboolean
maxCompletionTokensinteger · int32
maxTokensinteger · int32
messagesarray of object
Show child attributes
Show array items
contentobjectrequired
rolestringrequired

minLength 1

metadataobject
modelstring
ninteger · int32
parallelToolCallsboolean
presencePenaltynumber · double
reasoningEffortstring
responseFormatobject
Show child attributes
jsonSchemaobject
Show child attributes
namestring
schemaobject
strictboolean
typestring

one of "text", "json_object", "json_schema"

seedinteger · int32
serviceTierstring
stoparray of string
Show child attributes
storeboolean
streamboolean
streamOptionsobject
Show child attributes
includeUsageboolean
temperaturenumber · double
toolChoiceobject
toolsarray of object
Show child attributes
Show array items
functionobjectFunction ↑
typestring

one of "function"

topLogprobsinteger · int32
topPnumber · double
userstring
Example request
{
  "frequencyPenalty": 0,
  "functionCall": {
    "arguments": "string",
    "name": "string"
  },
  "functions": [
    {
      "description": "string",
      "name": "string",
      "parameters": {
        "additionalProp1": {}
      },
      "strict": true
    }
  ],
  "logitBias": {
    "additionalProp1": 0
  },
  "logprobs": true,
  "maxCompletionTokens": 0,
  "maxTokens": 0,
  "messages": [
    {
      "content": {},
      "role": "string"
    }
  ],
  "metadata": {
    "additionalProp1": "string"
  },
  "model": "string",
  "n": 0,
  "parallelToolCalls": true,
  "presencePenalty": 0,
  "reasoningEffort": "string",
  "responseFormat": {
    "jsonSchema": {
      "name": "string",
      "schema": {
        "additionalProp1": {}
      },
      "strict": true
    },
    "type": "json_object"
  },
  "seed": 0,
  "serviceTier": "string",
  "stop": [
    "string"
  ],
  "store": true,
  "stream": true,
  "streamOptions": {
    "includeUsage": true
  },
  "temperature": 0,
  "toolChoice": {},
  "tools": [
    {
      "function": {
        "description": "string",
        "name": "string",
        "parameters": {
          "additionalProp1": {}
        },
        "strict": true
      },
      "type": "function"
    }
  ],
  "topLogprobs": 0,
  "topP": 0,
  "user": "string"
}

Responses

200Chat completions responseapplication/json
objectChatCompletionResponse
choicesarray of object
Show child attributes
Show array items
deltaobject
Show child attributes
contentstring
functionCallobjectFunctionCall ↑
reasoningContentstring
rolestring
toolCallsarray of object
Show child attributes
Show array items
functionobjectFunctionCall ↑
idstring
indexinteger · int32
typestring

one of "function"

finishReasonstring
indexinteger · int32
logprobsobject
Show child attributes
contentarray of object
Show child attributes
Show array items
bytesarray of integer · int32
Show child attributes
logprobnumber · double
tokenstring
messageobject
Show child attributes
contentstring
functionCallobjectFunctionCall ↑
namestring
reasoningContentstring
refusalstring
rolestring

one of "system", "user", "assistant", "tool", "function"

toolCallsarray of object
Show child attributes
createdinteger · int64
idstring
modelstring
serviceTierstring
systemFingerprintstring
usageobject
Show child attributes
completionTokensinteger · int32
completionTokensDetailsobject
Show child attributes
reasoningTokensinteger · int32
promptTokensinteger · int32
promptTokensDetailsobject
Show child attributes
cachedTokensinteger · int32
totalTokensinteger · int32
array of object
Show array items
anyOf · 2 options
Option 1objectChatCompletionResponse
choicesarray of object
Show child attributes
createdinteger · int64
idstring
modelstring
serviceTierstring
systemFingerprintstring
usageobjectUsage ↑
Option 2objectErrorMessage
codeinteger · int32
detailsstring
messagestring
Example response
{
  "choices": [
    {
      "delta": {
        "content": "string",
        "functionCall": {
          "arguments": "string",
          "name": "string"
        },
        "reasoningContent": "string",
        "role": "string",
        "toolCalls": [
          {
            "function": {
              "arguments": "string",
              "name": "string"
            },
            "id": "string",
            "index": 0,
            "type": "function"
          }
        ]
      },
      "finishReason": "string",
      "index": 0,
      "logprobs": {
        "content": [
          {
            "bytes": [
              0
            ],
            "logprob": 0,
            "token": "string"
          }
        ]
      },
      "message": {
        "content": "string",
        "functionCall": {
          "arguments": "string",
          "name": "string"
        },
        "name": "string",
        "reasoningContent": "string",
        "refusal": "string",
        "role": "assistant",
        "toolCalls": [
          {
            "function": {
              "arguments": "string",
              "name": "string"
            },
            "id": "string",
            "index": 0,
            "type": "function"
          }
        ]
      }
    }
  ],
  "created": 0,
  "id": "string",
  "model": "string",
  "serviceTier": "string",
  "systemFingerprint": "string",
  "usage": {
    "completionTokens": 0,
    "completionTokensDetails": {
      "reasoningTokens": 0
    },
    "promptTokens": 0,
    "promptTokensDetails": {
      "cachedTokens": 0
    },
    "totalTokens": 0
  }
}
Documentation menu