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": "dall-e-3", "prompt": "a futuristic city at sunset", "size": "1024x1024" }'Chat Completions
Section titled “Chat Completions”curl -X POST https://api.hiapi.ai/v1/chat/completions \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o", "messages": [{"role": "user", "content": "Hello!"}] }'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 }'Music Generation
Section titled “Music Generation”curl -X POST https://api.hiapi.ai/v1/audio/generations \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "suno", "prompt": "upbeat pop song about summer", "duration": 60 }'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"