AIGate API
One unified API to generate AI images and videos, search a curated 1,000+ asset library, and manage credits. Built for creators, developers, and automation pipelines.
https://cp.aigatecloud.com/api/v1
· All responses are JSON · All requests require Bearer auth
Quick start (30 seconds)
# 1. Get your API key from the dashboard
# 2. Search the library
curl "https://cp.aigatecloud.com/api/v1/search?q=luxury+lifestyle&type=image" \
-H "Authorization: Bearer sk-aigate-YOUR_API_KEY"
# 3. Generate an image
curl -X POST "https://cp.aigatecloud.com/api/v1/generate/image" \
-H "Authorization: Bearer sk-aigate-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"prompt":"cinematic sunset luxury","aspect_ratio":"9:16"}'
How it works
- Library first — every generate request searches 1,000+ pre-made assets first. If a match is found, it's returned instantly for the base credit cost.
- AI generate fallback — if no library match, AIGate generates via AI (costs more credits). You're always told which happened.
- BYOK routing (Scale tier) — connect your own provider keys. Requests route through your account; AIGate charges only the platform fee.
Authentication
All API calls require a Bearer token in the Authorization header. Get your token from the dashboard → API Keys.
Authorization: Bearer sk-aigate-xxxxxxxxxxxxxxxxxxxxxxxx
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer sk-aigate-... | required |
| Content-Type | application/json | required for POST |
Credit System
Every action costs credits. Credits never expire. Even library hits cost credits — you're paying for access, routing, and storage.
| Pack | Credits | ~Images | ~Videos | Price |
|---|---|---|---|---|
| Free | 100 | ~10 | ~1 | $0 |
| Starter | 1,200 | ~120 | ~12 | $9 one-time |
| Creator | 4,000 | ~400 | ~40 | $29 one-time |
| Pro | 12,000 | ~1,200 | ~120 | $79 one-time |
| Scale | 35,000 | ~3,500 | ~350 | $199 one-time |
response.credits_balance field in every response shows your remaining balance in real time.
Errors & Rate Limits
| HTTP Code | error field | Meaning |
|---|---|---|
| 401 | missing_api_key / invalid_api_key | Missing or wrong token |
| 402 | insufficient_credits | Not enough credits — buy a pack |
| 403 | video_not_included | Video requires Starter tier or above |
| 429 | rate_limit | Too many requests — back off and retry |
| 503 | generation_unavailable | AI provider unavailable — library only |
{
"error": "insufficient_credits",
"credits_needed": 10,
"credits_balance": 3,
"hint": "Buy a credit pack at aigatecloud.com/#pricing"
}
GET /api/v1/search
Search the asset library (1,000+ curated images and videos). Searching is free — you only pay when serving/downloading via generate endpoints.
Query parameters
luxury sunsetlifestyle, motivation, nature, business, education, fengshuirealistic, cinematic, minimal, luxury, abstractimage or video9:16, 16:9, 1:1, 4:5, 3:4calm, inspirational, luxury, happy, powerfulExample
curl "https://cp.aigatecloud.com/api/v1/search?topic=lifestyle&type=image&aspect_ratio=9:16&limit=5" \
-H "Authorization: Bearer sk-aigate-YOUR_API_KEY"
Response
{
"ok": true,
"total": 214,
"page": 1,
"count": 5,
"items": [
{
"id": 4821,
"asset_type": "image",
"url": "https://pic.aigatecloud.com/images/lifestyle/p_pex8127.jpg",
"width": 1280, "height": 720,
"aspect_ratio": "16:9",
"topic": "lifestyle",
"mood": "calm",
"tags": "lifestyle,person,happy,bright,aesthetic",
"quality_score": 7
}
]
}
POST /api/v1/generate/image
Request body: prompt, topic, aspect_ratio, force_gen...
curl -X POST /api/v1/generate/image -H "Authorization: Bearer ..." -d '{"prompt":"..."}'POST /api/v1/generate/video
Library-first video search, AI-gen fallback. 100 credits per request.
GET /api/v1/me
Returns tier, credit balance, and feature flags.
BYOK — Bring Your Own Key
| Provider | Type |
|---|---|
| openai_images | image |
| runwayml | video |
| luma | video |
| kling | video |
Webhooks
Webhooks available on Scale plan. Receive async notifications when generation completes.
Smart Routing
Advanced routing available on Scale plan.
SDKs & Code Examples
A reference implementation (PHP) is available on GitHub. Use it as a starting point for your integration.
git clone https://github.com/melyx-id/aigatecloud-api-examples
cd api-examples
cp .env.example .env
# Add your API key to .env
php examples/generate-image.php
PHP (minimal)
<?php
// AIGate — minimal PHP client
// Get your API key: https://cp.aigatecloud.com
$apiKey = getenv('AIGATE_KEY') ?: 'sk-aigate-YOUR_API_KEY';
function aigate(string $method, string $path, array $body = []): array {
global $apiKey;
$ch = curl_init('https://cp.aigatecloud.com/api/v1' . $path);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey, 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => $body ? json_encode($body) : null,
CURLOPT_TIMEOUT => 30,
]);
$resp = curl_exec($ch); curl_close($ch);
return json_decode($resp, true) ?? ['error' => 'parse_error'];
}
// Search library (free)
$results = aigate('GET', '/search?topic=lifestyle&type=image&limit=3');
foreach ($results['items'] ?? [] as $item) {
echo $item['url'] . "\n";
}
// Generate image (10 credits)
$gen = aigate('POST', '/generate/image', [
'prompt' => 'luxury sunset apartment golden light',
'aspect_ratio' => '9:16',
]);
echo $gen['asset']['url'] ?? $gen['error'] ?? 'error';
echo "\nCredits left: " . ($gen['credits_balance'] ?? '?') . "\n";
JavaScript (fetch)
const AIGATE_KEY = 'sk-aigate-YOUR_API_KEY';
async function aigate(path, body = null) {
const res = await fetch('https://cp.aigatecloud.com/api/v1' + path, {
method: body ? 'POST' : 'GET',
headers: {
'Authorization': 'Bearer ' + AIGATE_KEY,
'Content-Type': 'application/json',
},
body: body ? JSON.stringify(body) : undefined,
});
return res.json();
}
// Search library
const results = await aigate('/search?topic=lifestyle&type=image&limit=5');
console.log(results.items);
// Generate image (10 credits)
const gen = await aigate('/generate/image', {
prompt: 'luxury lifestyle cinematic',
aspect_ratio: '9:16',
});
console.log(gen.asset?.url, 'credits left:', gen.credits_balance);
Python
import requests
AIGATE_KEY = "sk-aigate-YOUR_API_KEY"
BASE = "https://cp.aigatecloud.com/api/v1"
headers = {"Authorization": f"Bearer {AIGATE_KEY}"}
# Search
r = requests.get(f"{BASE}/search", params={"topic":"lifestyle","type":"image"}, headers=headers)
print(r.json()["items"][0]["url"])
# Generate image (10 credits)
r = requests.post(f"{BASE}/generate/image",
json={"prompt": "luxury apartment golden sunset", "aspect_ratio": "9:16"},
headers={**headers, "Content-Type": "application/json"})
data = r.json()
print(data["asset"]["url"], "| credits left:", data.get("credits_balance"))