Chat
This page will teach you how to use our Chat endpoint
Overview
Making a request
Non-Streaming
import requests
import json
# Define the API endpoint and headers
api_url = "http://ai.is-a.dev/v1/chat/completions"
headers = {
"Content-Type": "application/json"
}
payload = {
"model": "llama-3.1-70b-turbo",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Write a haiku about recursion in programming."}
]
"tools": False # Enables or disables Tools
}
response = requests.post(api_url, headers=headers, data=json.dumps(payload))
completion = response.json()
print(completion['choices'][0]['message']['content'])const api_url = "http://katz.is-a.dev/v1/chat/completions";Streaming
Response Examples
Error Handling
Error Example
Last updated