Skip to Content
Media GatewayOverview

Media Gateway

Express.js API gateway for AI video/image generation, Cloudflare R2 storage, and automated asset management.

Endpoints

EndpointMethodDescription
/healthGETProvider status
/auth/jimeng/qrPOSTStart Jimeng QR login
/auth/jimeng/qr/pollGETPoll QR login status
/auth/jimeng/statusGETJimeng auth status
/auth/flow4api/loginPOSTFlow4API login
/auth/kling/loginPOSTKling login
/modelsGETList available models
/images/generatePOSTText-to-image
/images/transformPOSTImage-to-image
/videos/generatePOSTText-to-video
/videos/generate-from-imagePOSTImage-to-video
/videos/generate-transitionPOSTVideo transition (first+last frame)
/videos/omniPOSTUnified video generation
/generations/:provider/:idGETPoll generation status
/assets/:provider/images/:idGETGet image URL
/assets/:provider/videos/:idGETGet video URL
/creditsGETCredit balance
/credits/historyGETCredit history
/credits/claim-dailyPOSTClaim daily credits
/storage/uploadPOSTUpload to R2/GDrive
/storage/listGETList files
/storage/mkdirPOSTCreate folder
/audio/ttsPOSTText-to-speech
/social/publishPOSTSubmit publish task
/social/discoverPOSTSubmit discovery task
/social/trackPOSTSubmit tracking task

All endpoints are under /api/v1/creative/ and require CF Access headers. See Interactive API Docs for full details.

Environment Variables

See .env.example for the full list. Key variables:

VariableDescription
JIMENG_SIGN_SERVICE_URLSidecar URL (default http://localhost:3457)
R2_ACCOUNT_IDCloudflare R2 account
R2_ACCESS_KEY_ID / R2_SECRET_ACCESS_KEYR2 credentials
SOCIAL_WORKER_URLCF Worker URL for social gateway
OPENAI_API_KEYOpenAI API key (Sora provider)
KLINGAI_ACCESS_KEY / KLINGAI_SECRET_KEYKling AI credentials
XAI_API_KEYxAI API key
SLACK_BOT_TOKENSlack bot token for notifications
SOCIAL_API_SECRETShared secret for social worker auth
Last updated on