Next-gen gateway API
Base: https://aigate.corelogix.dev · Omit provider/model for free-first auto · Attach references for vision / img2img / video guidance.
Access & cost
No key: rate-limited (~20 req/min/IP) and free models only (Workers AI, free-tier keys, OpenRouter :free). With Authorization: Bearer ag_… (app key from Admin): no public limit, paid keys used as last-resort fallback. Routing is always free-first.
POST /v1/chat/completions
OpenAI-compatible: full multi-turn messages (system/user/assistant, image parts), stream, temperature, max_tokens, top_p. Use any id from /v1/models or auto. Extras: modality (text|html|image|video), provider; response headers x-aigate-provider / x-aigate-model.
curl -N https://aigate.corelogix.dev/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"stream": true,
"temperature": 0.7,
"max_tokens": 800,
"messages": [
{ "role": "system", "content": "You are concise." },
{ "role": "user", "content": "Name 3 prime numbers" },
{ "role": "assistant", "content": "2, 3, 5" },
{ "role": "user", "content": "Three more?" }
]
}'
Works with the official SDKs:
from openai import OpenAI
client = OpenAI(base_url="https://aigate.corelogix.dev/v1", api_key="ag_YOUR_KEY")
for chunk in client.chat.completions.create(model="auto", stream=True,
messages=[{"role": "user", "content": "Hello"}]):
print(chunk.choices[0].delta.content or "", end="")
GET /v1/models
OpenAI-style list. Each item has modality, free, owned_by (provider). Filter with ?modality=text|image|video|html.
POST /v1/images/generations
curl -s https://aigate.corelogix.dev/v1/images/generations -H "Content-Type: application/json" \
-d '{ "prompt": "a red fox in snow, photo", "n": 1, "response_format": "b64_json" }'
Returns { data: [{ b64_json | url }] }. n up to 4 with an app key. Optional images (data URLs) for image-to-image on vision providers.
POST /v1/embeddings
curl -s https://aigate.corelogix.dev/v1/embeddings -H "Content-Type: application/json" \
-d '{ "model": "@cf/baai/bge-m3", "input": ["hello", "world"] }'
Free (Workers AI). Models: @cf/baai/bge-m3 (multilingual, default), bge-large/base/small-en-v1.5. Up to 100 inputs.
Voice: POST /v1/audio/transcriptions · /v1/audio/translations · /v1/audio/speech
curl -s https://aigate.corelogix.dev/v1/audio/transcriptions -F file=@voice.webm -F language=en
curl -s https://aigate.corelogix.dev/v1/audio/speech -H "Content-Type: application/json" \
-d '{ "input": "Hello from AIGate", "voice": "luna" }' -o hello.mp3
Free (Workers AI). Speech-to-text: Whisper large-v3-turbo (multipart file or JSON audio base64; response_format json|text|verbose_json; translations outputs English). Text-to-speech returns audio (WAV from MeloTTS, MP3 from Aura; see Content-Type): MeloTTS by default (language e.g. en, fr), Deepgram Aura-2 when voice is an Aura speaker (e.g. luna, orion). Max 4096 characters.
Video: POST /v1/videos → GET /v1/videos/{id}
Async jobs (Sora-style). Engines: Google Veo (Gemini key) and Alibaba Wan (DashScope key). Optional image (data URL) for image-to-video, aspect_ratio (16:9|9:16|1:1) or size, seconds, negative_prompt, model (vid_veo, vid_wan, or a raw veo-…/wan… id).
curl -s https://aigate.corelogix.dev/v1/videos -H "Authorization: Bearer ag_YOUR_KEY" -H "Content-Type: application/json" \
-d '{ "prompt": "drone shot over a misty forest at sunrise", "aspect_ratio": "16:9" }'
# → { "id": "video_…", "status": "queued", ... }
curl -s https://aigate.corelogix.dev/v1/videos/video_… # poll: queued | in_progress | completed | failed
curl -L https://aigate.corelogix.dev/v1/videos/video_…/content -o out.mp4
POST /api/generate
Native endpoint for every modality. Rich media[] + flat fields + OpenAI-shaped choices. Accepts the same messages/params; "stream": true streams text/HTML as OpenAI SSE. Video waits up to ~90s, otherwise returns 202 with a job to poll.
curl -s https://aigate.corelogix.dev/api/generate \
-H "Content-Type: application/json" \
-d '{
"modality": "image",
"prompt": "product photo on white",
"references": [{ "mimeType": "image/jpeg", "dataBase64": "<base64 or data-url>" }]
}'
POST /api/chat is an alias.
Modalities
text · image · video · html (returns a full HTML document)
References
"references": [
{ "mimeType": "image/png", "dataBase64": "iVBOR..." }
]
Or OpenAI image_url parts inside the last user message. With references the router prefers vision-capable providers (Gemini, OpenRouter vision, Qwen-VL…).
Other
GET /api/models?modality=image · GET /health · CORS enabled on /v1/* and /api/generate.
POST /api/agent/keys
Bearer aigate-agent — register any provider + optional baseUrl, tier (free|paid).