Skip to content

cURL

cURL is the fastest way to test HiAPI endpoints from the command line.

All requests need the Authorization header:

Terminal window
-H "Authorization: Bearer YOUR_API_KEY"
Terminal window
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"
}'
Terminal window
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!"}]
}'
Terminal window
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
}'
Terminal window
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
}'
Terminal window
curl https://api.hiapi.ai/v1/dashboard/billing/usage \
-H "Authorization: Bearer YOUR_API_KEY"
  • Use jq to pretty-print responses: curl ... | jq .
  • Save API key as env variable: export HIAPI_KEY=sk-... then use -H "Authorization: Bearer $HIAPI_KEY"