API Reference
Complete reference documentation for the HuiLink API.
Authentication
All API requests require authentication via a Bearer token in the Authorization header.
Authorization: Bearer sk-xxxxxxxxxxxxxxxxHeaders
AuthorizationBearer sk-xxxxxxxxContent-Typeapplication/jsonAPI Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/chat/completions | Send a chat completion request to a supported model. |
POST | /v1/embeddings | Create an embedding vector representing the input text. |
POST | /v1/images/generations | Generate images from text prompts |
POST | /v1/video/generations | Generate videos from text prompts |
GET | /v1/models | List the models available to your account. |
Create Chat Completion
Send a chat completion request to a supported model.
curl https://gateway.hkting.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
"temperature": 0.7,
"max_tokens": 1024
}'Request Body
modelModel ID to use (e.g. gpt-4o, deepseek-v4-flash)
messagesArray of message objects with role and content
temperatureSampling temperature 0-2 (default 1.0)
max_tokensMaximum tokens to generate (default 4096)
streamEnable streaming via SSE (default false)
top_pNucleus sampling parameter (default 1.0)
frequency_penaltyPenalize token frequency (-2.0 to 2.0, default 0)
presence_penaltyPenalize token presence (-2.0 to 2.0, default 0)
stopUp to 4 sequences where the API stops generating
toolsList of tool definitions for function calling
userEnd-user identifier for monitoring
Response
idUnique request identifier
objectAlways chat.completion
createdUnix timestamp of creation
modelThe model used for completion
choicesList of completion choices
usage.prompt_tokensNumber of prompt tokens
usage.completion_tokensNumber of completion tokens
usage.total_tokensTotal tokens consumed
Response Example
{
"id": "chatcmpl-9a8b7c6d5e4f",
"object": "chat.completion",
"created": 1734567890,
"model": "gpt-4o",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 9,
"total_tokens": 21
}
}Create Embedding
Create an embedding vector representing the input text.
curl https://gateway.hkting.com/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-api-key" \
-d '{
"model": "text-embedding-ada-002",
"input": "The quick brown fox jumps over the lazy dog"
}'Request Body
modelEmbedding model ID (e.g. text-embedding-ada-002)
inputInput text or array of tokens to embed
Response Example
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
0.0023064255,
-0.009327292,
... // 1536 dimensions
]
}
],
"model": "text-embedding-ada-002",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}List Models
List the models available to your account.
curl https://gateway.hkting.com/v1/models \
-H "Authorization: Bearer sk-your-api-key"| Model | Provider | Context Length | Features |
|---|---|---|---|
gpt-4o | OpenAI | 128K | Vision, Function Calling |
gpt-4o-mini | OpenAI | 128K | Vision |
gpt-4-turbo | OpenAI | 128K | Vision, Function Calling |
deepseek-v4-flash | DeepSeek | 1M | Reasoning, Fast |
deepseek-v4-pro | DeepSeek | 1M | Reasoning, Pro |
qwen-plus | Qwen | 128K | General |
qwen-max | Qwen | 128K | Function Calling |
Image Generation
Generate images from text descriptions using our media generation providers (Jimeng/即梦, DALL-E, etc.).
curl https://gateway.hkting.com/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jimeng-image",
"prompt": "A serene mountain landscape at sunset",
"n": 1,
"size": "1024x1024"
}'Request Body
modelImage model ID (e.g. jimeng-image, dall-e-3)
promptText description of the desired image
nNumber of images to generate (1-4, default 1)
sizeImage size (e.g. 1024x1024, 1920x1080, default 1024x1024)
styleImage style (e.g. realistic, cartoon, anime) — supported by Jimeng
negative_promptWhat to avoid in the generated image
seedRandom seed for reproducible results
Response
createdUnix timestamp of creation
dataArray of generated image objects
data[].urlURL of the generated image (expires after 24h)
data[].revised_promptAI-revised version of the input prompt (if applicable)
{
"created": 1734567890,
"data": [
{
"url": "https://.../generated-image.png",
"revised_prompt": "A serene mountain landscape at sunset with golden light..."
}
]
}| Model | Provider | Type |
|---|---|---|
jimeng-image | Jimeng (即梦) | Text-to-Image |
dall-e-3 | OpenAI | Text-to-Image |
dall-e-2 | OpenAI | Text-to-Image |
Video Generation
Generate short videos from text descriptions.
curl https://gateway.hkting.com/video/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jimeng-video",
"prompt": "A cat walking in the park",
"duration": 5
}'Request Body
modelVideo model ID (e.g. jimeng-video)
promptText description of the desired video
durationVideo duration in seconds (5 or 10, default 5)
sizeAspect ratio (e.g. 16:9, 9:16, 1:1, default 16:9)
negative_promptWhat to avoid in the generated video
seedRandom seed for reproducible results
Response
idUnique video generation request ID
statusGeneration status (e.g. processing, completed, failed)
outputURL of the generated video file
{
"id": "video-gen-xxx",
"status": "completed",
"output": "https://.../generated-video.mp4"
}| Model | Provider | Max Duration |
|---|---|---|
jimeng-video | Jimeng (即梦) | 10s |
Rate Limits
API requests are subject to rate limits based on your plan. Exceeding limits returns a 429 status code.
| Plan | RPM | TPM |
|---|---|---|
| Free | 20 | 40,000 |
| Pay-as-you-go | 500 | 200,000 |
| Enterprise | Custom | Custom |
Rate limits can be configured per API key by an admin. Contact your admin to adjust limits.
Error Codes
The API uses standard HTTP status codes to indicate the outcome of a request.
| Code | Meaning | Common Cause |
|---|---|---|
200 | OK | Request succeeded |
400 | Bad Request | Invalid request body or parameters |
401 | Unauthorized | Invalid or missing API key |
402 | Payment Required | Insufficient balance |
404 | Not Found | Model or endpoint not found |
422 | Unprocessable Entity | Request validation failed |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Internal server error |
502 | Bad Gateway | Upstream provider returned an error |
503 | Service Unavailable | All upstream providers are unavailable |