Chat Completions
The Chat Completions API works to mimic the functionality of the Hatz AI Chat Platform. It works very similarly to the OpenAI and Anthropic completions API, where you can just about swap to use it as a drop in replacement.
List of Available Models
Copied!
You can use the /v1/chat/models
endpoint to get a list of available models that are available to use.
The name
field of each model is the field (model id) that will be used within your requests.
The display_name
field is the name of the actual model
The vision
boolean dictates whether the model has image capabilities (recognizing image files)
Example Query
curl 'https://ai.hatz.ai/v1/chat/models' \
-H 'X-API-Key: $HATZ_API_KEY'
Response:
{
"data": [
{
"name": "gpt-3.5-turbo",
"developer": "OpenAI",
"display_name": "GPT 3.5 Turbo",
"max_tokens": 16385,
"vision": false
},
{
"name": "gpt-4",
"developer": "OpenAI",
"display_name": "GPT 4",
"max_tokens": 8192,
"vision": false
},
... rest of data
]
}
Message StructureCopied!
Messages are in the JSON Body of the request
You have the following types of messages
System Message
You can only have one system
message within the array. The system message is developer provided instructions that the model should follow, regardless of messages sent by the user.
User Message
Messages sent by an end user, containing prompts or additional context information.
Assistant Message
Messages sent by the model in response to user messages.
Example Message Array
"messages": [{"role": "system", "content": "Send responses with a humor"}, {"role": "user", "content": "Can you describe the difference between different text file types"}],
Example QueryCopied!
curl 'https://ai.hatz.ai/v1/chat/completions' \
-H 'X-API-Key: $HATZ_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"messages": [{"role": "system", "content": "Send responses with a humor"}, {"role": "user", "content": "Can you describe the difference between different text file types"}],
"model": "gpt-4o",
"stream": false
}'
Response:
{
"choices": [
{
"message": {
"content": "Sure thing! Think of text file types as different personalities at a party. \n\n1. **.txt** - This is the plain Jane of text files. No frills, no fuss, just straight-up text. If it were a person, it would be the one wearing a \"Hello, my name is...\" sticker.\n\n2. **.doc/.docx** - The Microsoft Word files love to dress up. They've got fonts, colors, and sometimes even clip art. They're like the person who shows up in a tuxedo when everyone else is in jeans.\n\n3. **.pdf** - The PDF is the bouncer of the text file world. Once something's in PDF form, it's locked down and hard to edit. It's like the friend who says, \"We’re not changing the plan!\"\n\n4. **.rtf** - Rich Text Format files try to please everyone. They have some basic formatting, like bold or italics, but they don't go overboard. Imagine someone who brings a cheese platter to a potluck—not too fancy, but not boring either.\n\n5. **.md** - Markdown files are the hipsters of text files. They're minimalistic and love to hang around in tech circles, pretending they don’t care about appearances, but they still look surprisingly good on the web.\n\n6. **.html** - HTML files are the social butterflies. They’re designed to interact with everyone on the web. They’re the ones at the party gossiping about the latest viral meme and can show you pictures, videos, and more.\n\n7. **.csv** - Comma-separated values files are the nerds with a heart of gold. They might look like a jumbled mess of data at first, but they're great at organizing info into spreadsheets. Think pocket protectors and glasses, but they're the ones you'll hire to do your taxes.\n\nEach type has its quirks, but they all have their place in the digital world!",
"role": "assistant"
}
}
],
"model": "gpt-4o",
"usage": {
"input_tokens": 26,
"output_tokens": 398
}
}