POST
/
v1
/
chat
/
completions
Create chat completion
curl --request POST \
  --url https://inference.api.nscale.com/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json; charset=utf-8' \
  --data '{
  "frequency_penalty": 0,
  "logit_bias": null,
  "logprobs": false,
  "max_completion_tokens": 100,
  "max_tokens": 100,
  "messages": [
    {
      "content": "What is the weather in Paris?",
      "role": "user"
    }
  ],
  "model": "meta-llama/Llama-3.1-8B-Instruct",
  "n": 1,
  "presence_penalty": 0,
  "seed": 42,
  "stop": "\n",
  "stream": false,
  "stream_options": null,
  "temperature": 1,
  "tool_choice": "auto",
  "tools": [
    {
      "function": {
        "description": "Get the weather for a city",
        "name": "get_weather",
        "parameters": {
          "properties": {
            "city": {
              "description": "City name",
              "type": "string"
            }
          },
          "required": [
            "city"
          ],
          "type": "object"
        }
      },
      "type": "function"
    }
  ],
  "top_logprobs": 0,
  "top_p": 1
}'
{
  "id": "<string>",
  "object": "<string>",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "<string>",
        "content": "<string>",
        "reasoning_content": "<string>",
        "tool_calls": [
          "<any>"
        ]
      },
      "logprobs": {
        "content": [
          {
            "token": "<string>",
            "logprob": 123,
            "bytes": [
              123
            ],
            "top_logprobs": [
              {
                "token": "<string>",
                "logprob": 123,
                "bytes": [
                  123
                ]
              }
            ]
          }
        ]
      },
      "finish_reason": "<string>",
      "stop_reason": "<any>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "total_tokens": 123,
    "completion_tokens": 123,
    "prompt_tokens_details": "<any>"
  },
  "prompt_logprobs": "<string>",
  "system_fingerprint": "<string>"
}

Authorizations

Authorization
string
header
required

Security scheme that accepts Identity JWTs and deprecated API/User keys.

Body

application/json; charset=utf-8
model
string
required
messages
(Message · object | ImageMessage · object)[]
required
stream
boolean
default:false
stream_options
object
max_completion_tokens
integer
max_tokens
integer
n
integer
default:1
frequency_penalty
number
default:0
logit_bias
object
logprobs
boolean
default:false
presence_penalty
number
default:0
response_format
object
stop
any
temperature
number
default:1
top_p
number
default:1
top_logprobs
integer
tool_choice
any

Controls which (if any) tool is called by the model. Only 'auto' and 'none' are supported here. 'required' tool_choice option requires vllm>=0.8.3 and is not currently supported.

tools
any[]
seed
integer

Response

id
string
required
object
string
required
created
integer
required
model
string
required
choices
ChatCompletionChoice · object[]
required
usage
object
required
prompt_logprobs
string
system_fingerprint
string