Tokfai integration docs
AI API relay for developers and small teams. Path: sign up → top up ¥99 → create a key → set Base URL → call /v1/models → run chat → check Usage / Credits. Base URL: https://api.tokfai.com/v1
Early public beta — start small. Email junpengpanchina@gmail.com for a human review if integration, billing, image jobs, or usage logs look wrong.
Real integration path
Authorization: Bearer sk-tokfai_xxx. Top up ¥99, verify models and chat, check Usage / Credits, then wire clients.
- 1Sign up / sign in, then top up the ¥99 trial pack
- 2Create a sk-tokfai_… API key; set Base URL to https://api.tokfai.com/v1
- 3Call /v1/models with curl, then /v1/chat/completions
- 4Check Usage / Credits for charges and failed requests, then wire Cherry Studio / Cursor
https://api.tokfai.com/v1
curl -sS https://api.tokfai.com/v1/models \ -H "Authorization: Bearer sk-tokfai_xxx"
curl -sS https://api.tokfai.com/v1/chat/completions \
-H "Authorization: Bearer sk-tokfai_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "auto-fast",
"messages": [{"role":"user","content":"Reply with TOKFAI_OK"}],
"stream": false
}'curl -sS https://api.tokfai.com/v1/chat/completions \
-H "Authorization: Bearer sk-tokfai_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "auto-fast",
"messages": [{"role":"user","content":"Reply with TOKFAI_OK"}],
"stream": true
}'from openai import OpenAI
client = OpenAI(
api_key="sk-tokfai_xxx",
base_url="https://api.tokfai.com/v1",
)
resp = client.chat.completions.create(
model="auto-fast",
messages=[{"role": "user", "content": "Reply with TOKFAI_OK"}],
)
print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-tokfai_xxx",
baseURL: "https://api.tokfai.com/v1",
});
const resp = await client.chat.completions.create({
model: "auto-fast",
messages: [{ role: "user", content: "Reply with TOKFAI_OK" }],
});
console.log(resp.choices[0].message.content);Engineering material analysis
Tokfai cannot read local paths on your computer. Upload real files or a project archive.
- 1Upload materials
- 2Extract file content
- 3Model analysis
- 4Output markdown diagnosis report
Supported formats
zip, PDF, txt, md, log, json, csv, c, cpp, h, py, m, and more
Output file
tokfai-uav-diagnosis-YYYYMMDD-HHMMSS.mdAnalysis scope
- Flight approval
- Airspace restrictions
- Flight-control code
- Attitude control
- Task scheduling
- Control allocation
- Motor / throttle output
- Safety boundaries
- Log diagnostics
Script example
export TOKFAI_API_KEY="sk-tokfai_xxx" python3 scripts/aviation/tokfai-uav-intake.py \ --path "/你的工程目录" \ --question "请分析无人机工程材料,重点看审批、空域、安全边界、飞控、姿态环、油门/电机输出和交付风险"
Local paths exist only on your machine — Tokfai in the cloud cannot read them. Sending a path like Flight/FlightControl/txg_control_task.c delivers text, not file content. Upload files via the intake script or upload API.
API integration
Authorization: Bearer sk-tokfai_xxx
| — | https://api.tokfai.com | Base URL |
| GET | /v1/models | List available models |
| POST | /v1/chat/completions | Chat completions |
| POST | /v1/responses | Reasoning / Codex-style clients |
| POST | /v1/images/generations | Image generation |
Client configuration
Connect Codex, Cursor, and Cherry Studio to Tokfai API.
config.toml
model = "gpt-5.5" model_provider = "openai" openai_base_url = "https://api.tokfai.com/v1"
auth.json
~/.codex/auth.json
{
"OPENAI_API_KEY": "sk-tokfai_xxx"
}Test
curl -sS https://api.tokfai.com/v1/models
curl -sS https://api.tokfai.com/v1/responses \
-H "Authorization: Bearer sk-tokfai_xxx" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.5","input":"回复 TOKFAI_AUTH_OK","stream":false}'Common errors
Missing Bearer token | No Authorization header |
invalid_token | API key wrong or expired |
404 | Wrong base_url — use https://api.tokfai.com/v1 |
stream disconnected | Client or proxy interrupted — disable proxy and retry |
model_not_available | Model id not in Tokfai model list |
Connection
- Base URL: https://api.tokfai.com/v1
- API Key: sk-tokfai_xxx
- Model: gpt-5.5 or a model id from Models
Local files
Whether Cursor analyzes local files depends on it sending file content in the request. Tokfai only processes what reaches the API.
Connection
- Provider: OpenAI Compatible
- Base URL: https://api.tokfai.com/v1
- API Key: sk-tokfai_xxx
- Fetch models from /v1/models
High-frequency calls & production
Tokfai is in early public beta: start with ¥99 to verify the API, latency, and cost before you scale.
Self-serve packs fit developers, small teams, Cherry Studio / Cursor, and mid-scale use — not formal large-buyer SLA procurement.
Million-RPM, distillation, training-data supply, large-scale scraping, grey-market / illegal use, and personal privacy / sensitive data are not self-serve offers.
If integration, billing, or usage logs look wrong, email junpengpanchina@gmail.com for a human review. Calls follow rate limits, Usage / Credits, and actual responses.