One API for All AI — smart routing, shared asset library, cost optimization.
This repo uses a placeholder token. The examples will return
401 Unauthorizeduntil you replaceYOUR_KEY_HEREwith a real key.👉 Register free at aigatecloud.com — get 100 free credits on the T0 plan. No credit card required.
# 1. Clone
git clone https://github.com/aigatecloud/api-examples.git
cd api-examples
# 2. Copy env file
cp .env.example .env
# 3. Add your real key (get one free at aigatecloud.com)
# Edit .env → replace sk-aigate-YOUR_KEY_HERE
# 4. Run an example
php examples/generate-image.phphttps://api.aigatecloud.com/v1/
All requests require:
Authorization: Bearer sk-aigate-YOUR_KEY_HERE
Content-Type: application/json
| Endpoint | Method | Credits | Description |
|---|---|---|---|
/v1/search |
GET | 0 | Search asset library |
/v1/generate/image |
POST | 10 | Generate or fetch image |
/v1/me |
GET | 0 | Account info & credit balance |
Video generation (
/v1/generate/video, 100 credits) requires Starter plan or above.BYOK (bring your own OpenAI/Runway/etc. key) requires Scale plan.
| Action | Credits |
|---|---|
| Generate / fetch image | 10 |
| Generate / fetch video | 100 |
| Search library | 0 |
Check balance (/me) |
0 |
Credits never expire. Top up any time at aigatecloud.com.
| Plan | Price | Credits | Video |
|---|---|---|---|
| Free | $0 | 100 | ✗ |
| Starter | $9 one-time | 1,200 | ✓ |
| Creator ⭐ | $29 one-time | 4,000 | ✓ |
| Pro | $79 one-time | 12,000 | ✓ + webhooks |
| Scale | $199 one-time | 35,000 | ✓ + BYOK |
examples/generate-image.php— generate an image from a promptexamples/generate-video.php— generate a short video clip (Starter+)examples/search.php— search the shared asset libraryexamples/generate-image.js— JavaScript (Node.js / browser fetch)examples/generate-image.py— Python requests
All responses are JSON:
{
"ok": true,
"source": "library",
"provider": "pexels",
"credits_charged": 10,
"credits_balance": 90,
"asset": {
"id": 1042,
"url": "https://cdn.aigatecloud.com/assets/img_9x16_luxury_a41f.jpg",
"thumbnail_url": "https://cdn.aigatecloud.com/assets/thumb/img_9x16_luxury_a41f.jpg",
"aspect_ratio": "9:16",
"use_case": "viral_background",
"tags": ["luxury", "gold", "lifestyle"],
"width": 1080,
"height": 1920
}
}Error responses:
{ "ok": false, "error": "Insufficient credits. Purchase more at aigatecloud.com", "code": 429 }MIT — free to use in commercial projects. Attribution appreciated but not required.
Built by the Melyx ecosystem.