API Overview
Access to various AI models through a simple REST interface
Base URL
https://zettalgor.com/api/v1
Key Features
- Multiple AI Models
- Usage Tracking
- RESTful Design
Authentication
Secure access to API endpoints
Bearer Token Authentication
All API requests require authentication using Bearer tokens in the Authorization header.
Authorization: Bearer YOUR_API_KEY
Security Notice:
Never expose your API key in client-side code or public repositories. Always keep your API keys secure and rotate them regularly.
Error Response Format
All authentication errors follow this standardized format:
{
"error": "Error message description",
"code": "ERROR_CODE"
}
API Endpoints
Complete list of available API endpoints
POST /query/ - Generate AI Text Completions
Request Headers
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Request Body
{
"model": "zetta_model",
"prompt": "Write a short story about a robot",
"max_tokens": 150,
"think":True
}
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
model |
string | Required | Model IRA name (see available models) |
prompt |
string | Required | Text prompt for the model |
max_tokens |
integer | Optional | Maximum tokens to generate (default: 100) |
think |
Boolean | Optional | want model to respond with thinking content too |
Success Response 200 OK
{
"response": "Once upon a time, there was a robot named...",
"usage": {
"input_tokens": 45,
"output_tokens": 150,
"total_tokens": 195,
},
"model": "zetta_model",
"response_time_ms": 1250
}
GET /models - Get Available Models
Success Response 200 OK
{
"models": [
{
"zetta_name": "zetta_thinking",
"description": "zetta deep thinking model for general text generation"
},
{
"zetta_name": "zetta_coder",
"description": "Code-specialized version of Llama 2"
},
{
"zetta_name": "zetta_small",
"description": "zetta_small model for efficient text generation"
}
]
}
Error Codes Reference
Complete list of possible error responses
HTTP Status | Error Code | Description |
---|---|---|
400 | INVALID_JSON |
Request body is not valid JSON |
400 | MISSING_FIELDS |
Required fields missing from request |
401 | AUTH_HEADER_INVALID |
Missing or malformed Authorization header |
403 | API_KEY_NOT_FOUND |
API key doesn't exist |
403 | API_KEY_INACTIVE |
API key is suspended or inactive |
404 | MODEL_NOT_FOUND |
Requested model doesn't exist or is disabled |
429 | DAILY_TOKEN_LIMIT_EXCEEDED |
Daily token quota exceeded |
429 | MONTHLY_REQUEST_LIMIT_EXCEEDED |
Monthly request quota exceeded |
500 | MODEL_DOWN_ERROR |
Error from the underlying AI service |
500 | INTERNAL_SERVER_ERROR |
Unexpected server error |
Code Examples
Implementation examples in multiple languages
import requests
import json
API_KEY = "your_api_key_here"
BASE_URL = "https://zettalgor.com/api/v1"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
def generate_text(prompt, model="zetta_model", max_tokens=150):
payload = {
"model": model,
"prompt": prompt,
"max_tokens": max_tokens,
"think": True
}
resp = requests.post(f"{BASE_URL}/query/", headers=headers, json=payload)
if resp.status_code == 200:
return resp.json()
print(f"Error: {resp.json()}")
return None
Support & Resources
Get help and additional resources