API Reference
Complete reference for the AltLLM API. Fully compatible with OpenAI SDK.
Base URL
https://altllm-api.viber.autonome.fun/v1Authentication
All API requests require a Bearer token in the Authorization header.
Authorization: Bearer YOUR_API_KEYGet your API key from the API Keys page.
Chat Completions
POST
/v1/chat/completionsCreate a chat completion with optional streaming and tool use.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID (e.g., altllm-standard) |
messages | array | Yes | Array of message objects |
stream | boolean | No | Enable streaming (default: false) |
max_tokens | integer | No | Maximum tokens to generate |
temperature | number | No | Sampling temperature (0-2, default: 1) |
top_p | number | No | Nucleus sampling (0-1) |
stop | string | array | No | Stop sequences |
tools | array | No | Custom tools for function calling |
tool_choice | string | object | No | Tool selection mode |
response_format | object | No | Output format (e.g., JSON mode) |
Message Object
{
"role": "user" | "assistant" | "system" | "tool",
"content": "string or array",
"name": "optional tool name",
"tool_call_id": "optional tool call ID"
}Example Request
curl https://altllm-api.viber.autonome.fun/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "altllm-standard",
"messages": [
{"role": "system", "content": "You are a helpful crypto assistant."},
{"role": "user", "content": "What is the price of Bitcoin?"}
],
"max_tokens": 500
}'Example Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1704067200,
"model": "altllm-standard",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The current price of Bitcoin is $95,051 USD..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 50,
"total_tokens": 75
}
}Streaming
Enable real-time streaming by setting stream: true.
Stream Request
curl https://altllm-api.viber.autonome.fun/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "altllm-standard",
"messages": [{"role": "user", "content": "Hello"}],
"stream": true
}'Stream Response Format
data: {"id":"chatcmpl-abc123","choices":[{"delta":{"role":"assistant"}}]}
data: {"id":"chatcmpl-abc123","choices":[{"delta":{"content":"Hello"}}]}
data: {"id":"chatcmpl-abc123","choices":[{"delta":{"content":"!"}}]}
data: {"id":"chatcmpl-abc123","choices":[{"delta":{},"finish_reason":"stop"}]}
data: [DONE]Tool Use / Function Calling
Define custom tools for the model to use. Built-in crypto tools are automatically available.
Custom Tool Definition
{
"model": "altllm-pro",
"messages": [{"role": "user", "content": "Get my portfolio for 0x123..."}],
"tools": [{
"type": "function",
"function": {
"name": "get_portfolio",
"description": "Get user's crypto portfolio",
"parameters": {
"type": "object",
"properties": {
"wallet_address": {"type": "string"}
},
"required": ["wallet_address"]
}
}
}],
"tool_choice": "auto"
}Tool Call Response
{
"choices": [{
"message": {
"role": "assistant",
"content": null,
"tool_calls": [{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_portfolio",
"arguments": "{\"wallet_address\": \"0x123...\"}"
}
}]
},
"finish_reason": "tool_calls"
}]
}List Models
GET
/v1/modelsList all available models.
curl https://altllm-api.viber.autonome.fun/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"Health Check
GET
/healthCheck API gateway health status.
curl https://altllm-api.viber.autonome.fun/health{
"status": "healthy",
"service": "altllm-gateway",
"version": "1.0.0"
}Rate Limits
Rate limits are applied per API key. Check response headers for current usage.
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per minute |
X-RateLimit-Remaining | Remaining requests in current window |
X-RateLimit-Reset | Time until rate limit resets (Unix timestamp) |