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
Sign up → top up ¥99 → create a key → set Base URL → call /v1/models → run chat → check Usage / Credits.
API integration
OpenAI-compatible endpoints: /v1/models, /v1/chat/completions, /v1/responses, /v1/images/generations.
Client configuration
Connect Codex, Cursor, Cherry Studio, and similar tools to Tokfai.

Real integration path

Authorization: Bearer sk-tokfai_xxx. Top up ¥99, verify models and chat, check Usage / Credits, then wire clients.

  1. 1Sign up / sign in, then top up the ¥99 trial pack
  2. 2Create a sk-tokfai_… API key; set Base URL to https://api.tokfai.com/v1
  3. 3Call /v1/models with curl, then /v1/chat/completions
  4. 4Check Usage / Credits for charges and failed requests, then wire Cherry Studio / Cursor
Base URL
https://api.tokfai.com/v1
GET /v1/models
curl -sS https://api.tokfai.com/v1/models \
  -H "Authorization: Bearer sk-tokfai_xxx"
POST /v1/chat/completions · 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": false
  }'
POST /v1/chat/completions · stream=true
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
  }'
Python · OpenAI SDK
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)
Node.js · OpenAI SDK
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.

UAV engineering material analysis
Upload UAV project archives or related materials. Tokfai reads content and outputs a diagnosis report.
  1. 1Upload materials
  2. 2Extract file content
  3. 3Model analysis
  4. 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.md

Analysis 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 "请分析无人机工程材料,重点看审批、空域、安全边界、飞控、姿态环、油门/电机输出和交付风险"
Why can't Tokfai read a path you type?

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.comBase URL
GET/v1/modelsList available models
POST/v1/chat/completionsChat completions
POST/v1/responsesReasoning / Codex-style clients
POST/v1/images/generationsImage generation

Client configuration

Connect Codex, Cursor, and Cherry Studio to Tokfai API.

Codex

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 tokenNo Authorization header
invalid_tokenAPI key wrong or expired
404Wrong base_url — use https://api.tokfai.com/v1
stream disconnectedClient or proxy interrupted — disable proxy and retry
model_not_availableModel id not in Tokfai model list
Cursor

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.

Cherry Studio

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.

View pricing & scale notes