Chat Completion

POST /chat/completion

Creates a model response for chat conversations. OmniAI translates OpenAI Chat Completion params for all models. Supported models can be found here.

Request

Headers

An API Key is required to access this endpoint.

Body

Message

Tool

Function

Example

{
  "model": "meta.llama3-70b-instruct-v1:0",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello!"
    }
  ]
}

Response

The API returns the response in JSON format.

The request will return a 200 with a chat completion object.

Example

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "meta.llama3-70b-instruct-v1:0",
  "system_fingerprint": "fp_aa87380ac5",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! How can I assist you today?",
    },
    "logprobs": null,
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 19,
    "completion_tokens": 9,
    "total_tokens": 28
  }
}

Last updated