Skip to main content
POST
/
api
/
ai
/
chat
/
completions
Create chat completion
curl --request POST \
  --url https://hub.oxen.ai/api/ai/chat/completions \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {
      "content": "<string>",
      "role": "system",
      "name": "<string>",
      "tool_call_id": "<string>",
      "tool_calls": [
        {}
      ]
    }
  ],
  "model": "gpt-4o",
  "frequency_penalty": 123,
  "max_tokens": 123,
  "presence_penalty": 123,
  "response_format": {},
  "temperature": 123,
  "tool_choice": "<string>",
  "tools": [
    {}
  ],
  "top_p": 123
}
'
{
  "choices": [
    {
      "finish_reason": "<string>",
      "index": 123,
      "message": {
        "content": "<string>",
        "role": "<string>",
        "tool_calls": [
          {}
        ]
      }
    }
  ],
  "created": 123,
  "id": "<string>",
  "model": "<string>",
  "object": "chat.completion",
  "usage": {
    "completion_tokens": 123,
    "prompt_tokens": 123,
    "total_tokens": 123
  }
}

Body

application/json

Chat completion request

Request to generate a chat completion. Compatible with the OpenAI chat completions API.

messages
object[]
required
model
string
required

Model ID to use

Example:

"gpt-4o"

frequency_penalty
number | null
max_tokens
integer | null
presence_penalty
number | null
response_format
object
temperature
number | null
tool_choice
tools
object[] | null
top_p
number | null

Response

Chat completion

choices
object[]
created
integer
id
string
model
string
object
enum<string>
Available options:
chat.completion
usage
object