API Reference

Complete reference documentation for the HuiLink API.

Authentication

All API requests require authentication via a Bearer token in the Authorization header.

http
Authorization: Bearer sk-xxxxxxxxxxxxxxxx

Headers

AuthorizationBearer sk-xxxxxxxx
Required
Content-Typeapplication/json
Required

API Endpoints

MethodEndpointDescription
POST
/v1/chat/completionsSend a chat completion request to a supported model.
POST
/v1/embeddingsCreate an embedding vector representing the input text.
POST
/v1/images/generationsGenerate images from text prompts
POST
/v1/video/generationsGenerate videos from text prompts
GET
/v1/modelsList the models available to your account.

Create Chat Completion

Send a chat completion request to a supported model.

cURL
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

model
string
Required

Model ID to use (e.g. gpt-4o, deepseek-v4-flash)

messages
array
Required

Array of message objects with role and content

temperature
number
Optional

Sampling temperature 0-2 (default 1.0)

max_tokens
integer
Optional

Maximum tokens to generate (default 4096)

stream
boolean
Optional

Enable streaming via SSE (default false)

top_p
number
Optional

Nucleus sampling parameter (default 1.0)

frequency_penalty
number
Optional

Penalize token frequency (-2.0 to 2.0, default 0)

presence_penalty
number
Optional

Penalize token presence (-2.0 to 2.0, default 0)

stop
string|array
Optional

Up to 4 sequences where the API stops generating

tools
array
Optional

List of tool definitions for function calling

user
string
Optional

End-user identifier for monitoring

Response

id
string
Optional

Unique request identifier

object
string
Optional

Always chat.completion

created
integer
Optional

Unix timestamp of creation

model
string
Optional

The model used for completion

choices
array
Optional

List of completion choices

usage.prompt_tokens
integer
Optional

Number of prompt tokens

usage.completion_tokens
integer
Optional

Number of completion tokens

usage.total_tokens
integer
Optional

Total tokens consumed

Response Example

json
{
  "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
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

model
string
Required

Embedding model ID (e.g. text-embedding-ada-002)

input
string|array
Required

Input text or array of tokens to embed

Response Example

json
{
  "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.

bash
curl https://gateway.hkting.com/v1/models \
  -H "Authorization: Bearer sk-your-api-key"
ModelProviderContext LengthFeatures
gpt-4oOpenAI128KVision, Function Calling
gpt-4o-miniOpenAI128KVision
gpt-4-turboOpenAI128KVision, Function Calling
deepseek-v4-flashDeepSeek1MReasoning, Fast
deepseek-v4-proDeepSeek1MReasoning, Pro
qwen-plusQwen128KGeneral
qwen-maxQwen128KFunction Calling

Image Generation

Generate images from text descriptions using our media generation providers (Jimeng/即梦, DALL-E, etc.).

cURL
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

model
string
Required

Image model ID (e.g. jimeng-image, dall-e-3)

prompt
string
Required

Text description of the desired image

n
integer
Optional

Number of images to generate (1-4, default 1)

size
string
Optional

Image size (e.g. 1024x1024, 1920x1080, default 1024x1024)

style
string
Optional

Image style (e.g. realistic, cartoon, anime) — supported by Jimeng

negative_prompt
string
Optional

What to avoid in the generated image

seed
integer
Optional

Random seed for reproducible results

Response

created
integer
Optional

Unix timestamp of creation

data
array
Optional

Array of generated image objects

data[].url
string
Optional

URL of the generated image (expires after 24h)

data[].revised_prompt
string
Optional

AI-revised version of the input prompt (if applicable)

json
{
  "created": 1734567890,
  "data": [
    {
      "url": "https://.../generated-image.png",
      "revised_prompt": "A serene mountain landscape at sunset with golden light..."
    }
  ]
}
ModelProviderType
jimeng-imageJimeng (即梦)Text-to-Image
dall-e-3OpenAIText-to-Image
dall-e-2OpenAIText-to-Image

Video Generation

Generate short videos from text descriptions.

cURL
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

model
string
Required

Video model ID (e.g. jimeng-video)

prompt
string
Required

Text description of the desired video

duration
integer
Optional

Video duration in seconds (5 or 10, default 5)

size
string
Optional

Aspect ratio (e.g. 16:9, 9:16, 1:1, default 16:9)

negative_prompt
string
Optional

What to avoid in the generated video

seed
integer
Optional

Random seed for reproducible results

Response

id
string
Optional

Unique video generation request ID

status
string
Optional

Generation status (e.g. processing, completed, failed)

output
string
Optional

URL of the generated video file

json
{
  "id": "video-gen-xxx",
  "status": "completed",
  "output": "https://.../generated-video.mp4"
}
ModelProviderMax Duration
jimeng-videoJimeng (即梦)10s

Rate Limits

API requests are subject to rate limits based on your plan. Exceeding limits returns a 429 status code.

PlanRPMTPM
Free2040,000
Pay-as-you-go500200,000
EnterpriseCustomCustom

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.

CodeMeaningCommon Cause
200
OKRequest succeeded
400
Bad RequestInvalid request body or parameters
401
UnauthorizedInvalid or missing API key
402
Payment RequiredInsufficient balance
404
Not FoundModel or endpoint not found
422
Unprocessable EntityRequest validation failed
429
Too Many RequestsRate limit exceeded
500
Internal Server ErrorInternal server error
502
Bad GatewayUpstream provider returned an error
503
Service UnavailableAll upstream providers are unavailable