How to Use Reverb
A guide to using Reverb with OpenAI-compatible API endpoints
1. Setup
Use your API key from the dashboard to authenticate requests to the Reverb endpoint.
Endpoint: https://api.ozone-ai.com/v1/chat/completions
Add your API key to the Authorization header:
Authorization: Bearer YOUR_API_KEY
Replace YOUR_API_KEY
with the key from your API Keys dashboard.
2. Basic Usage
Send a POST request to the chat completions endpoint with your messages.
Example Request (Python)
import requests
api_key = "YOUR_API_KEY"
url = "https://ozone-ai.com/api/v1/chat/completions"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
data = {
"model": "reverb-7b",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain the concept of quantum entanglement"}
],
"max_tokens": 100
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
Example Response
{
"id": "chatcmpl-abc",
"object": "chat.completion",
"created": 1699999999,
"model": "reverb-7b",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum entanglement is a phenomenon where two or more particles become linked, such that the state of one instantly influences the state of the other, regardless of distance."
},
"finish_reason": "length"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 40,
"total_tokens": 65
}
}
3. Streaming Responses
Enable streaming to receive responses in real-time by setting "stream": true
.
Example Request (JavaScript)
const apiKey = 'YOUR_API_KEY';
const url = 'https://ozone-ai.com/api/v1/chat/completions';
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'reverb-7b',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Explain the concept of quantum entanglement' }
],
stream: true,
max_tokens: 100
})
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { value, done } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
const lines = chunk.split('\n').filter(line => line.trim());
for (const line of lines) {
if (line.startsWith('data: ')) {
const data = line.slice(6);
if (data === '[DONE]') break;
const json = JSON.parse(data);
const content = json.choices[0].delta.content || '';
if (content) console.log(content);
}
}
}
This streams the response chunk-by-chunk, suitable for real-time applications.