Authentication
All API requests require authentication using an API key passed in the Authorization header.
Getting Your API Key
Section titled “Getting Your API Key”- Sign up at hiapi.ai
- Go to Dashboard → API Keys
- Click Create New Key
- Copy the key — it won’t be shown again
Using Your API Key
Section titled “Using Your API Key”Include the key in the Authorization header with the Bearer prefix:
curl -X POST https://api.hiapi.ai/v1/images/generations \ -H "Authorization: Bearer sk-your-api-key" \ -H "Content-Type: application/json" \ -d '{"model": "dall-e-3", "prompt": "hello world"}'from openai import OpenAI
client = OpenAI( api_key="sk-your-api-key", base_url="https://api.hiapi.ai/v1")import OpenAI from "openai";
const client = new OpenAI({ apiKey: "sk-your-api-key", baseURL: "https://api.hiapi.ai/v1"});Security Best Practices
Section titled “Security Best Practices”- Never expose your API key in client-side code or public repositories
- Use environment variables to store your key:
HIAPI_API_KEY - Rotate keys regularly from the Dashboard
- Use separate keys for development and production
Error Responses
Section titled “Error Responses”| Status Code | Meaning |
|---|---|
401 | Invalid or missing API key |
403 | API key doesn’t have permission |
429 | Rate limit exceeded |