cURL
cURL is the fastest way to test HiAPI endpoints from the command line.
Authentication
Section titled “Authentication”All requests need the Authorization header:
-H "Authorization: Bearer YOUR_API_KEY"Image Generation
Section titled “Image Generation”curl -X POST https://api.hiapi.ai/v1/images/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen-image-2.0", "prompt": "a futuristic city at sunset", "size": "1024x1024" }'Chat-Compatible Image Generation
Section titled “Chat-Compatible Image Generation”curl -X POST https://api.hiapi.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "Nano-Banana", "stream": false, "messages": [{"role": "user", "content": "draw a cute cat"}] }'Video Generation
Section titled “Video Generation”curl -X POST https://api.hiapi.ai/v1/videos \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "wan2.7-t2v", "prompt": "sunset timelapse over mountains", "size": "1920*1080", "seconds": "5" }'Check Balance
Section titled “Check Balance”curl https://api.hiapi.ai/v1/dashboard/billing/usage \ -H "Authorization: Bearer YOUR_API_KEY"- Use
jqto pretty-print responses:curl ... | jq . - Save API key as env variable:
export HIAPI_KEY=sk-...then use-H "Authorization: Bearer $HIAPI_KEY"