HiAPI
ModelsPricingDocs
API Reference

API Documentation

OpenAI-compatible API for image, video, and text generation. Drop-in replacement — just change the base URL.

OpenAI Compatible

Use the official OpenAI SDK. Just change the base URL and API key — your existing code works instantly.

Secure by Default

All requests are encrypted via HTTPS. API keys are scoped and can be revoked at any time.

Global CDN

Low-latency access from anywhere. Our infrastructure is distributed across multiple regions.

Quick Start

1

Get your API key

Sign up and create an API key from the dashboard. New users get free balance to start.

2

Install the SDK

Use the official OpenAI SDK for your language, or make direct HTTP requests.

# No installation needed for cURL
3

Make your first API call

Generate an image with a single API call. Replace YOUR_API_KEY with your actual key.

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-Pro", "stream": false, "messages": [{"role": "user", "content": "Draw a cute cat"}]}'

Authentication

All API requests require an API key passed in the Authorization header as a Bearer token.

Authorization: Bearer YOUR_API_KEY

Never expose your API key in client-side code or public repositories. Use environment variables to store your key securely.

Base URL

All API endpoints are relative to this base URL. If you're using the OpenAI SDK, set this as the base_url parameter.

https://api.hiapi.ai/v1

API Endpoints

Chat Completions (Image Generation)

POST/v1/chat/completions

Generate high-quality images via chat-style API. Use Nano-Banana-Pro for best quality with configurable aspect ratio and resolution, or Nano-Banana for fast generation.

Parameters

NameTypeRequiredDescription
modelstringRequiredNano-Banana-Pro (high quality) or Nano-Banana (fast)
messagesarrayRequiredArray of message objects with role and content
streambooleanOptionalEnable streaming responses (default: false)
extra_body.google.image_config.aspect_ratiostringOptionalImage aspect ratio: 1:1, 16:9, 9:16, 4:3, 3:4 (default: 1:1)
extra_body.google.image_config.image_sizestringOptionalImage resolution: 1K (1024px) or 2K (2048px, Pro only)

Code Example

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-Pro",
    "stream": false,
    "messages": [
      {
        "role": "user",
        "content": "Draw a cute cat sitting on a windowsill"
      }
    ],
    "extra_body": {
      "google": {
        "image_config": {
          "aspect_ratio": "1:1",
          "image_size": "1K"
        }
      }
    }
  }'

Error Handling

The API uses standard HTTP status codes. Errors return a JSON object with details.

Status CodeDescription
400Bad Request — Invalid parameters or missing required fields
401Unauthorized — Invalid or missing API key
403Forbidden — Insufficient permissions or account suspended
429Too Many Requests — Rate limit exceeded. Please slow down.
500Internal Server Error — Something went wrong on our end. Try again later.

Error Response Format

{
  "error": {
    "message": "Invalid token",
    "type": "new_api_error",
    "code": ""
  }
}

Ready to build?

Get your API key and start generating images, videos, and more in minutes.

HiAPI

One API, All AI Models

Company

  • About

Legal

  • Terms of Service
  • Privacy Policy
© 2026 hiapi. All rights reserved.