LoopGpt API Documentation
API for model discovery and chat requests only. Every chat request is billed to the API key owner points balance.
Quick Start
From zero to first chat response in three steps.
1. Create API Key
Create it from your dashboard settings page.
2. Add Auth Header
Send X-API-Key: YOUR_API_KEY.
3. Send Chat Message
Call POST /api/v1/chat/send with model_id and message.
Required Headers
All protected endpoints require an API key.
X-API-Key: YOUR_API_KEY
Accept: application/json
Content-Type: application/json
Public Endpoints
No auth required for model discovery endpoints.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/models | List models with filters (q, category, type, page). |
| GET | /api/models/{id_or_slug} | Get safe model details and capabilities. |
| GET | /api/categories | List active model categories. |
Chat Endpoints (Authenticated)
All endpoints below require a valid API key.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/chat/send | Send a chat prompt and return the model response. |
Rate Limits
Rate limits and points checks are enforced per API key owner.
Global Limit
Platform-level request-per-minute protection.
Per-Key Limit
Each key has custom rate_limit (requests/min).
Points Billing
Each chat call deducts points from the API key owner account. If balance is insufficient, response is No points remaining.
Error Codes
Standard HTTP status codes used across API responses.
Request Examples
Ready-to-run request examples in cURL, Python, and PHP.
1) cURL - List Models
curl "https://loopgpt.net/api/models?page=1&q=chat"
2) Send Chat Message (Choose Language)
import requests
base_url = "https://loopgpt.net"
api_key = "YOUR_API_KEY"
payload = {
"model_id": 1,
"message": "Hello from API"
}
r = requests.post(
f"{base_url}/api/v1/chat/send",
json=payload,
headers={
"X-API-Key": api_key,
"Content-Type": "application/json",
"Accept": "application/json"
},
timeout=30
)
print(r.status_code)
print(r.json())
curl -X POST "https://loopgpt.net/api/v1/chat/send" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d "{\"model_id\":1,\"message\":\"Hello from API\"}"
<?php
$baseUrl = 'https://loopgpt.net';
$apiKey = 'YOUR_API_KEY';
$payload = json_encode([
'model_id' => 1,
'message' => 'Hello from API',
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$ch = curl_init($baseUrl . '/api/v1/chat/send');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Accept: application/json',
'X-API-Key: ' . $apiKey,
],
CURLOPT_POSTFIELDS => $payload,
CURLOPT_TIMEOUT => 30,
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "HTTP " . $status . PHP_EOL;
echo $raw . PHP_EOL;
Response Examples
All API responses are JSON. Use these examples as your parser contract.
1) Success (`200`)
{
"success": true,
"message": "Success",
"data": {
"conversation_id": 123,
"assistant_message_id": 456,
"response": "Hello! How can I help you today?",
"message": "Hello! How can I help you today?",
"usage": {
"tokens": 82,
"latency_ms": 642,
"cost": 1
}
}
}
2) Invalid API Key (`401`)
{
"success": false,
"message": "Invalid API key"
}
3) No Points Remaining (`429`)
{
"success": false,
"message": "No points remaining"
}
4) Validation Error (`400`)
{
"success": false,
"message": "Message cannot be empty"
}