Light Logo
Openai

Create a chat completion

OpenAI compatible chat completions endpoint. If the model does not respond in time, the request will be timed out and the prediction will be cancelled.

POST
/chat/completions
AuthorizationBearer <token>

In: header

modelModel

The model to use for this OpenAI compatible endpoint. Models must be in the following format: model_owner/model_name or model_owner/model_name:version_number.

messagesMessages

A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, vision, and audio.

audio?ChatCompletionAudioParam | null

Parameters for audio output.

frequency_penalty?Frequency Penalty

Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.

logit_bias?Logit Bias

Modify the likelihood of specified tokens appearing in the completion.

logprobs?Logprobs

Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message.

max_completion_tokens?Max Completion Tokens

An upper bound for the number of tokens that can be generated for a completion.

modalities?Modalities

Output types that you would like the model to generate. Most models are capable of generating text, which is the default: ["text"]. To request that this model generate both text and audio responses, you can use: ["text", "audio"].

n?N

How many chat completion choices to generate for each input message.

parallel_tool_calls?Parallel Tool Calls

Whether to enable parallel tool calls during tool use.

Defaultfalse
prediction?ChatCompletionPredictionContentParam | null

Static predicted output content, such as the content of a text file that is being regenerated.

presence_penalty?Presence Penalty

Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.

reasoning_effort?Reasoning Effort

Constrains effort on reasoning for reasoning models.

stop?Stop

Stop sequence(s) where the API will stop generating further tokens.

temperature?Temperature

What sampling temperature to use.

top_p?Top P

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.

tool_choice?Tool Choice

Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool. none is the default when no tools are present. auto is the default if tools are present.

tools?Tools

A list of tools the model may call.

top_logprobs?Top Logprobs

An integer specifying the number of most likely tokens to return at each token position, each with an associated log probability.

verbosity?Verbosity

Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses.

Response Body

curl -X POST "https://api.wrift.ai/v1/chat/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "string",    "messages": [      {        "content": "string",        "role": "developer"      }    ]  }'
{
  "id": "string",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "logprobs": {
        "content": [
          {
            "token": "string",
            "bytes": [
              0
            ],
            "logprob": 0,
            "top_logprobs": {
              "token": "string",
              "bytes": [
                0
              ],
              "logprob": 0
            }
          }
        ],
        "refusal": [
          {
            "token": "string",
            "bytes": [
              0
            ],
            "logprob": 0,
            "top_logprobs": {
              "token": "string",
              "bytes": [
                0
              ],
              "logprob": 0
            }
          }
        ]
      },
      "message": {
        "content": "string",
        "refusal": "string",
        "role": "assistant",
        "audio": {
          "id": "string",
          "data": "string",
          "transcript": "string"
        },
        "tool_calls": [
          {
            "id": "string",
            "function": {
              "arguments": "string",
              "name": "string"
            },
            "type": "function"
          }
        ]
      }
    }
  ],
  "created": 0,
  "model": "string",
  "object": "chat.completion",
  "system_fingerprint": "string",
  "usage": {
    "completion_tokens": 0,
    "prompt_tokens": 0,
    "total_tokens": 0,
    "completion_tokens_details": {
      "accepted_prediction_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0,
      "rejected_prediction_tokens": 0
    },
    "prompt_tokens_details": {
      "audio_tokens": 0,
      "cached_tokens": 0
    }
  }
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}