| name | gateway-client |
| description | Build clients that integrate with the IMG.LY AI Gateway (`gateway.img.ly`) — discovering models, generating images/video/audio/text, uploading inputs, and consuming the SSE response stream. Use whenever the user wants to call, integrate with, or build a client for the IMG.LY Gateway, or mentions `gateway.img.ly`, `IMG.LY Gateway`, IMG.LY AI generation, or an IMG.LY API key starting with `sk_`. |
IMG.LY Gateway — Client Integration
You are helping a developer integrate with the IMG.LY AI Gateway. The gateway is a unified REST + SSE API that routes requests to AI providers for image, video, audio, and text generation. Clients only deal with one API — auth, billing, asset storage, and provider routing are handled server-side.
Always start by fetching the live integration guide
The gateway publishes a current, machine-readable integration reference at:
https://gateway.img.ly/llms.txt
Fetch this before answering specific questions about endpoints, request shapes, SSE event names, error codes, or available capabilities. The reference is updated as the gateway evolves and supersedes anything you may have learned from training data.
WebFetch https://gateway.img.ly/llms.txt
Use the live reference as the source of truth. The notes below are stable mental-model context that doesn't change with releases.
Mental model
- One endpoint for everything. All generation goes through
POST /v1/responses. The request body shape varies by model type (media models take prompt + model-specific properties; text models take messages in OpenAI chat-completions format), but the route, auth, and response transport are uniform.
- All responses are SSE streams. Even for fast image models, the response is
text/event-stream. Always parse as SSE — never try to read it as a single JSON body. Events: , (streaming text), , .