8341TokenFactory

API Documentation

Detailed integration guide and API reference to help you quickly integrate the 8341TokenFactory LLM API and AI gateway

1Quick Start

Start using the 8341TokenFactory API in three simple steps:

  1. Register a 8341TokenFactory account and log in to the dashboard
  2. Create an API Key in the dashboard
  3. Use your API Key to call our endpoints

Tip: New users receive free trial credits upon registration — no credit card required.

2Base URL

The API base URL is below. All requests use HTTPS:

text
https://www.token8341.com/v1

Chat Completions endpoint:

text
POST https://www.token8341.com/v1/chat/completions

Note: This endpoint is fully compatible with the OpenAI Chat Completions API format. You can directly use the OpenAI SDK.

3Authentication

8341TokenFactory uses Bearer Token authentication. Include your API Key in the request header:

text
Authorization: Bearer sk-your-api-key-here

You can create and manage your keys in the 'API Keys' section of the dashboard. Never expose your API Key in public repositories or client-side code.

4Supported Models

Model IDModel NameProvider状态
deepseek-v4.1-flashDeepSeek V4.1 FlashDeepSeek可用
deepseek-v4-proDeepSeek V4 ProDeepSeek可用
deepseek-v4-flashDeepSeek V4 FlashDeepSeek可用
kimi-k3Kimi K3Moonshot可用
kimi-k2.5Kimi K2.5Moonshot可用
glm-5.3GLM-5.3Zhipu可用
glm-4.7-flashGLM-4.7 FlashZhipu可用
qwen3.8-maxQwen3.8 MaxAlibaba Cloud可用
qwen3.8-plusQwen3.8 PlusAlibaba Cloud可用
minimax-m3MiniMax M3MiniMax可用
doubao-seed-2.1-proDoubao Seed 2.1 ProByteDance可用
ernie-5.1ERNIE 5.1Baidu可用
-GPT-4o / Claude / GeminiOpenAI / Anthropic / Google暂未开放

More models are being added continuously. Stay tuned for updates.

5Code Examples

curl

bash
curl https://www.token8341.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-your-api-key-here" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'

Python (openai SDK)

python
from openai import OpenAI

client = OpenAI(
    base_url="https://www.token8341.com/v1",
    api_key="sk-your-api-key-here"
)

response = client.chat.completions.create(
    model="deepseek-v4.1-flash",
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

print(response.choices[0].message.content)

Node.js (openai SDK)

javascript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://www.token8341.com/v1",
  apiKey: "sk-your-api-key-here",
});

const response = await client.chat.completions.create({
  model: "deepseek-v4.1-flash",
  messages: [
    { role: "user", content: "Hello!" },
  ],
});

console.log(response.choices[0].message.content);

6Error Codes

When an API request fails, the following HTTP status codes and error information are returned:

json
{
  "error": {
    "message": "Insufficient balance",
    "type": "insufficient_balance",
    "code": 402
  }
}
Status CodeNameDescription
400Bad Request请求参数错误,请检查请求体格式
401UnauthorizedAPI Key 无效或缺失,请检查 Authorization 请求头
402Insufficient Balance账户余额不足,请充值后重试
404Not Found请求的模型或接口不存在
429Rate Limit请求频率过高,请稍后重试
500Internal Server Error服务内部错误,请联系技术支持
503Service Unavailable模型服务暂时不可用,请稍后重试

Integration FAQ

Common questions about API Key, model switching, and integration languages

Can one API Key call all models?

Yes. This is the core feature of 8341TokenFactory—developers only need to integrate once to call all models on the platform, with no need to separately apply for accounts and manage Keys for each vendor.

Do I need to change code to switch models?

No logic code changes are needed; simply changing the single parameter of the model ID allows switching between domestic and overseas models.

Which programming languages are supported?

Mainstream integration examples such as cURL, Python, and Node.js are provided, compatible with any language that supports HTTP requests and the official OpenAI SDK.

How does API authentication work?

Authentication uses a Bearer Token. Simply include the API Key in the request header. The interface is fully compatible with OpenAI's Chat Completions format, so you can call it directly using the official OpenAI SDK without any additional adaptation.

Are there ready-made SDKs or code examples?

Yes. The platform provides integration examples for cURL, Python, Node.js, and other mainstream languages, so developers can quickly integrate using their preferred language.

Will models be added continuously? Do new models require code changes?

Yes. The platform continuously integrates new leading domestic and international models, with a consistent integration method and billing system. Once new models are launched, they can be used directly without any code changes.

How do I use the caching mechanism for large model APIs? In what scenarios will it hit?

The platform uses a shared cache for identical prompts across users. When a cache hit occurs, the price drops by more than 90%, with the lowest cache hit price at ¥0.010 per million Tokens, and the hit portion is billed at the cache price. This is suitable for scenarios where multiple users repeatedly use the same prefix prompt, such as fixed system prompts, public knowledge prefixes, etc.—put the unchanging part first to achieve a higher hit rate.

If an API call fails or times out, how do I implement automatic retries and fallback?

The usual approach is: use exponential backoff retries for timeouts and retryable errors, and set a maximum number of retries; if it still fails, fall back to a backup model. On the platform, switching models only requires changing the model ID, with zero code changes—just write the fallback target as another model ID. The platform also has multi-node redundancy and cross-region intelligent routing, so single-node anomalies are automatically switched over.

How do I compare the performance and cost of different models?

A single API Key can call all models. Switching models only requires changing the model ID, with zero code changes, so you do not need separate integrations for each model when doing horizontal comparisons. It is recommended to call each model with the same batch of business samples, record output quality and usage, and then compare official prices and this site's prices item by item using the "All-Model Price Comparison Table" on the official website.

How should server-side API Keys be stored securely?

It is recommended to store the API Key only on the server side and carry it via the request header as a Bearer Token. Do not write it into frontend or client-side code. Platform request and response data are transmitted with end-to-end HTTPS encryption, and enterprise-level permission management and audit logs are provided, making call records traceable.

In high-concurrency scenarios, how do you ensure stable calls and low latency?

The platform relies on computing centers in Horinger in Inner Mongolia, Hami in Xinjiang, Zhongwei in Ningxia, and other locations, using self-developed scheduling algorithms for cross-region intelligent routing and dynamic load balancing, with automatic switchover for single-node anomalies. Users in core cities can get millisecond-level latency, and the service availability commitment is 99.9%. It is recommended that the client side also use backoff retries and multi-model fallback.

How do I monitor call volume, costs, and anomalies?

The platform provides a unified account and a single billing system, with transparent usage, real-time balance crediting, and the ability to view consumption details at any time. It also provides audit log functionality for API calls, making call records traceable. If enterprise users need stricter compliance requirements (permission management, audit logs, etc.), they can contact customer service for business coordination.