Skip to content

API Documentation

HuosuAI provides a fully OpenAI-compatible RESTful API supporting chat completions, text embeddings, image generation, and more.

Base URL

https://api.huosu.com/v1

All API requests must use HTTPS.

Authentication

HuosuAI uses Bearer Token authentication. Include your API Key in the HTTP header:

http
Authorization: Bearer YOUR_API_KEY

Supported Endpoints

Chat Completions

POST /v1/chat/completions

The primary conversation endpoint supporting multi-turn dialogue, streaming, function calling, and JSON Mode.

Request Example:

json
{
  "model": "gpt-4o",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Explain what a large language model is."}
  ],
  "temperature": 0.7,
  "max_tokens": 2048,
  "stream": false
}

Key Parameters:

ParameterTypeRequiredDescription
modelstringYesModel identifier, e.g. gpt-4o, claude-sonnet-4-20250514
messagesarrayYesArray of conversation messages with role and content
temperaturenumberNoSampling temperature, 0-2, default 1
max_tokensintegerNoMaximum tokens to generate
streambooleanNoEnable streaming output, default false
toolsarrayNoFunction calling tool definitions
response_formatobjectNoResponse format control, e.g. {"type": "json_object"}

Embeddings

POST /v1/embeddings

Convert text to vector representations for semantic search, similarity computation, and RAG applications.

Image Generations

POST /v1/images/generations

Generate images from text descriptions using models like DALL-E.

Models

GET /v1/models

List all currently available models.

Audio Transcriptions

POST /v1/audio/transcriptions

Convert audio files to text using Whisper models.

Moderations

POST /v1/moderations

Check text content for policy violations.

Error Codes

HTTP StatusError TypeDescription
400invalid_request_errorInvalid request parameters
401authentication_errorInvalid or expired API Key
403permission_errorNo permission to access the resource
429rate_limit_errorRate limit exceeded, retry later
500server_errorInternal server error
502upstream_errorUpstream model service error

Rate Limits

LimitDefaultDescription
Requests per minute60 RPMCan be increased upon request
Concurrency10Simultaneous requests
Max payload10 MBPer request body size

Intelligent Model Aggregation Platform