Create Chat Completion

Create Chat Completion

This method creates a model response for the given chat conversation, and it is compatible with the OpenAI endpoint for creating a chat completion.

Request
URI
POST
https://{api_host}/api/v1/compatibility/openai/v1/chat/completions
COPY
Request Body
ChatCompletionsRequestPayload of type(s) application/json
Required

Show optional properties

{
    "messages": [
        {
            "content": "You are a helpful assistant.",
            "role": "system"
        },
        {
            "content": "Hello!",
            "role": "user"
        }
    ],
    "model": "model-to-use"
}
{
    "seed": 0,
    "temperature": "number",
    "n": 0,
    "stop": [
        "string"
    ],
    "max_tokens": 0,
    "stream": false,
    "model": "string",
    "messages": [
        {
            "role": "string",
            "content": "string"
        }
    ]
}
integer
seed
Optional

Seed to propagate to the LLM for making repeated requests with the same seed as deterministic as possible. Note that this feature is in beta for most inference servers.

number
temperature
Optional
Constraints: minimum: 0 maximum: 2 default: 0

temperature

integer
n
Optional
Constraints: minimum: 1 default: 1

n

array of string
stop
Optional
Constraints: minItems: 1

stop

integer
max_tokens
Optional
Constraints: minimum: 1

max_tokens

boolean
stream
Optional

stream

string
model
Required

ID of the completions model to use.

array of object
messages
Required
Constraints: minItems: 1

messages

Authentication
This operation uses the following authentication methods.
Responses
200

Successful Response

Operation doesn't return any data structure

400

Invalid model endpoint specified or model endpoint not ready.

Operation doesn't return any data structure

404

Unknown model endpoint requested.

Operation doesn't return any data structure

422

Validation Error

Returns HTTPValidationError of type(s) application/json
"HTTPValidationError Object"
array of object
detail
Optional

detail


Code Samples
COPY
                    curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"model:"string","messages":["object"]}' https://{api_host}/api/v1/compatibility/openai/v1/chat/completions