📚 API Documentation
Learn how to integrate GetApi into your application
🚀 Quick Start
- Sign up for a free account
- Generate your API key from the dashboard
- Make your first API call
🔑 Authentication
All API requests require authentication using your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
📊 Rate Limits
- Free Tier: 1,000 requests per day
- Pro Tier: Unlimited requests
- Rate Limit Headers: Check X-RateLimit-* headers
💬 Chat Completions
Endpoint: POST /api/v1/chat/completions
Request Example (Python)
import requests
url = "http://localhost:5000/api/v1/chat/completions"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
],
"max_tokens": 150
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
Request Example (JavaScript)
const response = await fetch('http://localhost:5000/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-3.5-turbo',
messages: [
{
role: 'user',
content: 'Hello, how are you?'
}
],
max_tokens: 150
})
});
const data = await response.json();
console.log(data);
Response Format
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-3.5-turbo",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm doing well, thank you!"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}
📋 List Models
Endpoint: GET /api/v1/models
Get a list of all available models and their pricing.
curl -H "Authorization: Bearer YOUR_API_KEY" \
http://localhost:5000/api/v1/models
⚠️ Error Handling
GetApi uses standard HTTP response codes:
- 200: Success
- 400: Bad Request - Invalid parameters
- 401: Unauthorized - Invalid API key
- 404: Not Found - Model not found
- 429: Too Many Requests - Rate limit exceeded
- 500: Internal Server Error
- 503: Service Unavailable - Provider is down