API Documentation
Version 1.0.0
Integrate BlivoAI's powerful AI chat capabilities directly into your applications. Our REST API provides programmatic access to the same AI models available in our web interface, enabling you to build custom solutions, automate workflows, and embed intelligent conversation features into your products.
Authentication
All API requests require authentication using a Bearer token. You can generate and manage your API keys from your BlivoAI account settings. Keep your API keys secure and never share them publicly. Each API key is tied to your account and inherits your plan's usage limits and feature access.
# Example: Include your API key in the Authorization header
curl -X POST https://blivoai.com/api/chat \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "blivoai-chat",
"messages": [{"role": "user", "content": "Hello!"}]
}'Chat Completions
The Chat Completions endpoint is the core of the BlivoAI API. Send a conversation history and receive an AI-generated response. The endpoint supports streaming for real-time output, multiple AI models, and configurable parameters for fine-tuning the response quality and creativity.
/api/chatSend messages to an AI model and receive completions. Supports both streaming and non-streaming responses.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | The ID of the model to use (e.g., "blivoai-chat", "blivoai-pro") |
| messages | array | Yes | Array of message objects with role and content |
| stream | boolean | No | Enable streaming responses (default: false) |
| temperature | number | No | Sampling temperature, 0.0 to 2.0 (default: 0.7) |
| max_tokens | integer | No | Maximum tokens in the response (default: model max) |
Example Request
const response = await fetch('https://blivoai.com/api/chat', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'blivoai-chat',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Explain quantum computing briefly.' }
],
stream: true,
temperature: 0.7,
}),
});
// For streaming responses
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);
process.stdout.write(chunk);
}Response Format
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1718480000,
"model": "blivoai-chat",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum computing uses quantum bits..."
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 150,
"total_tokens": 170
}
}Available Models
The models available through the API depend on your subscription plan. Free plan users have access to select free models, while Basic and Pro plan users can access a broader range of models including premium options. Check the model selector in the BlivoAI web interface for the most up-to-date list of available models and their capabilities.
| Model | Min Plan | Description |
|---|---|---|
| blivoai-chat | Free | Fast and capable for most everyday tasks |
| blivoai-fast | Free | Quick responses with great quality |
| blivoai-advanced | Basic | Balanced performance and intelligence |
| blivoai-pro | Pro | Advanced reasoning and complex tasks |
| blivoai-vision | Pro | Image generation and visual AI capabilities |
Rate Limits and Usage
API usage is governed by your plan's monthly token limit. Each request consumes tokens based on the combined length of your input messages and the model's response. When you approach your monthly limit, you will receive warning headers in API responses. When your limit is exceeded, subsequent requests will receive a 429 status code until your limit resets at the beginning of the next billing cycle.
// Response headers when approaching limit
X-RateLimit-Limit: 50000
X-RateLimit-Remaining: 5000
X-RateLimit-Reset: 1719792000
// When limit is exceeded
HTTP/1.1 429 Too Many Requests
{
"error": {
"message": "Monthly token limit exceeded. Upgrade your plan for more capacity.",
"type": "rate_limit_error",
"code": "token_limit_exceeded"
}
}Error Handling
The BlivoAI API uses standard HTTP status codes to indicate the success or failure of requests. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error caused by the information provided (such as missing parameters or insufficient permissions), and codes in the 5xx range indicate an error on our end.
| Status Code | Meaning | Action |
|---|---|---|
| 200 | Success | Process the response data |
| 401 | Unauthorized | Check your API key |
| 429 | Rate Limited | Wait or upgrade your plan |
| 500 | Server Error | Retry after a brief wait |
SDKs and Libraries
The BlivoAI API uses a standard REST format, making it easy to integrate with any HTTP client or programming language. You can use fetch, axios, or any other HTTP library to make requests. Simply send a POST request with your API key in the Authorization header and your conversation messages in the request body.
// Using with Python requests
import requests
response = requests.post(
"https://blivoai.com/api/chat",
headers={
"Authorization": "Bearer YOUR_BLIVOAI_API_KEY",
"Content-Type": "application/json"
},
json={
"model": "blivoai-chat",
"messages": [
{"role": "user", "content": "Hello, BlivoAI!"}
]
}
)
print(response.json()["choices"][0]["message"]["content"])Need Help?
If you need assistance integrating the BlivoAI API, encounter issues, or have feature requests, our team is here to help. Contact us through the platform for dedicated support.
Get Started with BlivoAI