HTTP Requests
Use the API without an SDK - just plain HTTP.
Non-Streaming Request
curl https://dev.api-bizora.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-d '{
"model": "bizora",
"messages": [
{"role": "human", "content": "What is section 169?"}
]
}'
Streaming Request
Add -N flag and set stream: true:
curl -N https://dev.api-bizora.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-d '{
"model": "bizora",
"messages": [
{"role": "human", "content": "What is section 169?"}
],
"stream": true
}'
Python (requests library)
import requests
import json
url = "https://dev.api-bizora.ai/v1/chat/completions"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer sk_live_YOUR_API_KEY"
}
data = {
"model": "bizora",
"messages": [{"role": "human", "content": "What is section 169?"}]
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result['choices'][0]['message']['content'])
JavaScript (fetch)
const response = await fetch('https://dev.api-bizora.ai/v1/chat/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer sk_live_YOUR_API_KEY'
},
body: JSON.stringify({
model: 'bizora',
messages: [{ role: 'human', content: 'What is section 169?' }]
})
});
const data = await response.json();
console.log(data.choices[0].message.content);
Streaming with HTTP
Python
import requests
import json
response = requests.post(
"https://dev.api-bizora.ai/v1/chat/completions",
headers={
"Authorization": "Bearer sk_live_YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"model": "bizora",
"messages": [{"role": "human", "content": "Hello"}],
"stream": True
},
stream=True
)
for line in response.iter_lines():
if line:
line = line.decode('utf-8')
if line.startswith('data: '):
data = line[6:]
if data == '[DONE]':
break
chunk = json.loads(data)
content = chunk['choices'][0].get('delta', {}).get('content')
if content:
print(content, end='', flush=True)
JavaScript
const response = await fetch('https://dev.api-bizora.ai/v1/chat/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer sk_live_YOUR_API_KEY'
},
body: JSON.stringify({
model: 'bizora',
messages: [{ role: 'human', content: 'Hello' }],
stream: true
})
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
const lines = chunk.split('\n');
for (const line of lines) {
if (line.startsWith('data: ')) {
const data = line.slice(6);
if (data === '[DONE]') break;
const parsed = JSON.parse(data);
const content = parsed.choices?.[0]?.delta?.content;
if (content) {
process.stdout.write(content);
}
}
}
}