Skip to content

Product and API documentation

This domain serves product information and technical documentation only — there is no live API endpoint. Below is the specification of our OpenAI-compatible interface so you can evaluate it. The team provides the production base URL, key and quota at onboarding.

Overview

  • OpenAI Chat Completions compatible: same paths, same fields, same error shapes.
  • One endpoint for Llama, Qwen and DeepSeek, including V4.1 Flash with 1M context.
  • Streaming passthrough, automatic upstream failover, token-based billing.

The HNS_BASE below is a placeholder; replace it with the base URL the team provides. This marketing domain does not answer /v1/*.

Authentication

Every request carries a bearer token once you are connected:

authorization
Authorization: Bearer sk-hns-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

A missing or malformed token returns 401, and a revoked key returns 401 as well. The server stores only the key’s SHA-256 hash and cannot recover the plaintext; if you lose it, create a new one.

Request format

POST /v1/chat/completions

curl — chat completions
curl $HNS_BASE/v1/chat/completions \
  -H "Authorization: Bearer $HNS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
    "messages": [
      {"role": "system", "content": "你是一位精簡的助理。"},
      {"role": "user", "content": "用三點說明 edge computing。"}
    ],
    "max_tokens": 256,
    "temperature": 0.7
  }'

GET /v1/models

curl — models
curl $HNS_BASE/v1/models \
  -H "Authorization: Bearer $HNS_KEY"

Each model in the response includes pricing.input and pricing.output (USD / 1M tokens) and context_window.

SDK setup

The official OpenAI SDK works as-is — just change the base URL and key.

Python

python
from openai import OpenAI

client = OpenAI(
    base_url=HNS_BASE + "/v1",
    api_key="sk-hns-...",
)

resp = client.chat.completions.create(
    model="meta-llama/Llama-3.3-70B-Instruct-Turbo",
    messages=[{"role": "user", "content": "你好"}],
)
print(resp.choices[0].message.content)
print(resp.usage)

Node / TypeScript

node / typescript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: HNS_BASE + "/v1",
  apiKey: process.env.HNS_KEY,
});

const resp = await client.chat.completions.create({
  model: "Qwen/Qwen2.5-72B-Instruct",
  messages: [{ role: "user", content: "你好" }],
});

Streaming

Add "stream": true and the response is text/event-stream. The gateway forwards chunk by chunk without buffering the whole answer; the final chunk carries usage, followed by data: [DONE].

curl — streaming
curl -N $HNS_BASE/v1/chat/completions \
  -H "Authorization: Bearer $HNS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-ai/DeepSeek-V3",
    "messages": [{"role": "user", "content": "寫一個 hello world"}],
    "stream": true
  }'

The gateway adds stream_options.include_usage for you, so you do not need to; usage is still billed.

Models and pricing

Prices are reference USD rates per 1M tokens, with input and output billed separately. The list the team provides at onboarding is authoritative.

  • meta-llama/Llama-3.3-70B-Instruct-Turbo

    Llama 3.3 70B Instruct · General chat and writing

    Context
    131,072
    Input / 1M
    $0.10
    Output / 1M
    $0.32
  • meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo

    Llama 3.1 8B Instruct Turbo · Fastest and cheapest — ideal for classification and extraction

    Context
    131,072
    Input / 1M
    $0.02
    Output / 1M
    $0.04
  • Qwen/Qwen2.5-72B-Instruct

    Qwen2.5 72B Instruct · Stable across Chinese and other languages

    Context
    32,768
    Input / 1M
    $0.36
    Output / 1M
    $0.40
  • deepseek-ai/DeepSeek-V3

    DeepSeek V3 · Reasoning and code

    Context
    163,840
    Input / 1M
    $0.32
    Output / 1M
    $0.89
  • deepseek-ai/DeepSeek-V4.1-Flash-1017

    DeepSeek V4.1 Flash · 1M context for long documents and agents

    Context
    1,048,576
    Input / 1M
    $0.20
    Output / 1M
    $0.60
  • Qwen/Qwen3-32B

    Qwen3 32B · Newer Qwen for reasoning and tool calls

    Context
    40,960
    Input / 1M
    $0.08
    Output / 1M
    $0.28
6 models in total. Contact us for the full list and onboarding. USD / 1,000,000 tokens · Source DeepInfra list pricing(2026-11-24 checked)

Error codes

Error shapes match OpenAI:

error response
{
  "error": {
    "message": "Missing or invalid API key.",
    "type": "invalid_request_error",
    "code": "invalid_api_key",
    "param": null
  }
}
HTTPcodeMeaning
400invalid_json / missing_model / model_not_foundThe request body is invalid
401invalid_api_keyNo key, or the key is invalid or revoked
402quota_exceededMonthly quota exhausted; resets on the 1st at 00:00 UTC
429rate_limit_exceededPer-minute request limit exceeded
502upstream_500 …Primary and backup upstreams both failed (the code carries the upstream status)
503upstream_not_configuredNo provider is currently configured for this model
504upstream_timeoutThe upstream sent no response headers within 30 seconds

Quota and rate limits

  • Every key has monthly_usd_quota (USD per month) and rpm_limit (requests per minute).
  • Usage accrues per UTC calendar month and resets at the start of the month.
  • When the quota is exhausted the gateway returns 402; monthly_usd_quota = 0 disables the key (immediate 402).
  • Exceeding the rate returns 429 with Retry-After.
  • The x-hns-provider response header shows which provider served the request, and x-hns-cost-usd shows its cost.

Bring your own key (BYOK)

If you already have a DeepInfra or Together key, send it with the request and it goes straight upstream with no service fee (token usage is still recorded).

BYOK headers
Authorization: Bearer sk-hns-...
X-Upstream-Provider: deepinfra      # or together
X-Upstream-Key: your-upstream-key

In BYOK mode x-hns-cost-usd is 0.000000; the usage record is still written so you can reconcile token counts.


To discuss onboarding, request a key or check your quota, contact us.