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/v1All API requests must use HTTPS.
Authentication
HuosuAI uses Bearer Token authentication. Include your API Key in the HTTP header:
http
Authorization: Bearer YOUR_API_KEYSupported Endpoints
Chat Completions
POST /v1/chat/completionsThe 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model identifier, e.g. gpt-4o, claude-sonnet-4-20250514 |
messages | array | Yes | Array of conversation messages with role and content |
temperature | number | No | Sampling temperature, 0-2, default 1 |
max_tokens | integer | No | Maximum tokens to generate |
stream | boolean | No | Enable streaming output, default false |
tools | array | No | Function calling tool definitions |
response_format | object | No | Response format control, e.g. {"type": "json_object"} |
Embeddings
POST /v1/embeddingsConvert text to vector representations for semantic search, similarity computation, and RAG applications.
Image Generations
POST /v1/images/generationsGenerate images from text descriptions using models like DALL-E.
Models
GET /v1/modelsList all currently available models.
Audio Transcriptions
POST /v1/audio/transcriptionsConvert audio files to text using Whisper models.
Moderations
POST /v1/moderationsCheck text content for policy violations.
Error Codes
| HTTP Status | Error Type | Description |
|---|---|---|
| 400 | invalid_request_error | Invalid request parameters |
| 401 | authentication_error | Invalid or expired API Key |
| 403 | permission_error | No permission to access the resource |
| 429 | rate_limit_error | Rate limit exceeded, retry later |
| 500 | server_error | Internal server error |
| 502 | upstream_error | Upstream model service error |
Rate Limits
| Limit | Default | Description |
|---|---|---|
| Requests per minute | 60 RPM | Can be increased upon request |
| Concurrency | 10 | Simultaneous requests |
| Max payload | 10 MB | Per request body size |
