One key. Every freem product API.
One API key is the universal credential for every freem product. Create a key, send it as a Bearer token, and call any product API. A key carries a recharge balance (for the LLM gateway) and a per-product subscription level (for product daily quotas).
面向 agent:一把 API key 即通用凭证。充值余额只用于 LLM 网关(按 token 计费),per-product 订阅级别决定各产品的每日配额。机器可读清单见 /agents.json。
GET https://api.clssai.com/key — anonymous, instant, with a $0.10 trial credit (no card required). Or sign in and use the panel below — your default key is bound automatically.
Send Authorization: Bearer sk-… to any product endpoint below, or the OpenAI-compatible gateway.
Top up balance or set a per-product subscription via /api/agent/recharge · /api/agent/subscribe.
Your keys self-serve · 自助领取
Signed in: your bound keys appear here (first visit creates a default key). Not signed in: create an unbound key instantly — save it, it is shown only once here.
5-minute quickstart copy, paste, run · 复制即跑
# 1) Get a key
# Open https://api.clssai.com/key in a browser — anonymous, instant, and every key carries a $0.10 trial credit (no card required). Signed-in at freem.ai? GET /api/agent/my-keys auto-creates your bound default key.
# 2) Verify the key — see balance & per-product subs
curl https://freem.ai/api/agent/me -H 'Authorization: Bearer sk-YOURKEY'
# 3) First model call — OpenAI-compatible gateway
curl https://clssai.com/v1/chat/completions -H 'Authorization: Bearer sk-YOURKEY' -H 'Content-Type: application/json' -d '{"model":"claude-haiku-4-5","messages":[{"role":"user","content":"hi"}]}'
# 4) Call a product API — e.g. AI search with sources
curl -X POST https://freem.ai/api/search -H 'Authorization: Bearer sk-YOURKEY' -H 'Content-Type: application/json' -d '{"query":"what changed in AI agents this week","model":"auto"}'
The key model
- Credential — An sk- key (same key system as the LLM gateway). One account can own many keys; each key is metered independently. Sub-keys (e.g. one per domain/site) are supported and each is billed independently.
- Recharge balance — Universal pay-as-you-go USD balance. Used ONLY by the LLM gateway (clssai.com/v1, per-token billing). balance = recharge + credit - allocated - consumption.
- Subscription level — Per-product tier in key.subs (e.g. { search: 'pro', notebook: 'plus' }). Tiers: free | plus | pro | ent. Gates each product's daily quota. Absent => 'free'. Product APIs are gated by subscription level only (they do not draw down the recharge balance).
- Introspect —
GET /api/agent/me(Bearer) → balance + per-product subs.
Product APIs
Freem Search / Chat search
AI answer grounded in the live web, with sources. Streaming SSE or async queue.
| Method | Path | Auth | Params | Returns |
|---|---|---|---|---|
| POST | /api/search | Bearer ✓ meter: skip_queue (instant) / privacy (private) | { query, model: 'auto'|'pro', stream?: bool, instant?: bool, private?: bool, attachments?: [{dataUrl,mime}] } | SSE: data:{delta} ... data:{done, summary(html), sources[], text}. Or async: {id,status} then poll /api/job. |
| POST | /api/follow-up | Bearer ✓ meter: skip_queue / privacy | { history:[{role,text}], query, model, stream?, instant?, private? } | Same SSE/async shape as /api/search. |
| GET | /api/job?id= | Bearer ✓ | ?id=<jobId> | { id, status, summary, sources[], text, error } |
Notebooks (Cortex) notebook
Ground answers in your sources; generate audio/slides/video/infographic/docs.
| Method | Path | Auth | Params | Returns |
|---|---|---|---|---|
| POST | /api/notebook/create | Bearer ✓ | { title? } | { notebook } |
| POST | /api/notebook/source/add | Bearer ✓ | { notebook_id, type:'url'|'youtube'|'text', content } | { source } |
| POST | /api/notebook/chat | Bearer ✓ | { notebook_id, query, source_ids[] } | { html, text, citations[], suggestions[] } (synchronous) |
| POST | /api/notebook/generate | Bearer ✓ meter: notebook_gen | { notebook_id, kind:'audio'|'video'|'slide_deck'|'infographic'|'report'|'quiz'|... , source_ids[], options } | { artifact:{ status:'running'|'done', request_id, url, text } } — poll GET /api/notebook/artifact?id= |
| GET | /api/notebook/artifact?id= | Bearer ✓ | ?id=<artifactId> | { artifact } |
Speak (pronunciation) speak
Text-to-speech helper for pronunciation practice. (Live scoring is an in-browser, interactive feature — not a headless agent API.)
| Method | Path | Auth | Params | Returns |
|---|---|---|---|---|
| GET | /api/speak/tts | cookie | ?text=&voice=&rate=&fmt=wav|mp3 | audio/mpeg | audio/wav (edge-cached) |
Account / membership membership
Inspect the caller's tier and per-feature daily quota.
| Method | Path | Auth | Params | Returns |
|---|---|---|---|---|
| GET | /api/membership | Bearer ✓ | { tier, features:{privacy,skip_queue,notebook_gen:{limit,used,remaining}} } | |
| GET | /api/agent/me | Bearer ✓ | { key, balance, recharge, credit, consumption, expires_at, subs:{}, account:{user_id} } |
ViaAI — AI Branch (merchant presence) via
Open a merchant's official branch in the AI world: 7-model presence audit, hosted machine-readable fact pages (JSON-LD + llms.txt + facts.json), keyword radar, publish channels. Human pages at /via; username-cookie login (/via/login), plans free/$20/$200/$2000.
| Method | Path | Auth | Params | Returns |
|---|---|---|---|---|
| POST | /api/via/audit | cookie | { merchant, category, city, facts?, lang:'zh'|'en' } | SSE: data:{stage:'start'|'result'|'judging'} ... data:{stage:'done', url:'/via/report/<id>', score:{presence,first,errors}} — what 7 AI platforms say about the merchant |
| POST | /api/via/branch | cookie | { facts:{ name, category, city, tagline, intro, address, phone, hours, price_range, services:[{name,price,desc}], faq:[{q,a}], ... }, lang } | { slug, token, url:'/via/b/<slug>' } — hosted fact page; token edits it |
| POST | /api/via/keywords | cookie | { category, city, merchant? } | { mode:'live'|'simulated', rows:[{keyword, search_volume, cpc, competition, monthly[]}] } — customer search demand |
| GET | /via/b/<slug>/facts.json | Bearer ✓ | canonical merchant fact file (see also /via/b/<slug>/llms.txt) |
LLM Gateway clssai.com/v1
OpenAI-compatible. Point any OpenAI SDK at the base URL with your sk- key. 100+ models (GPT, Claude, Gemini, Grok, DeepSeek, …). Billed against the key's recharge balance.
curl https://clssai.com/v1/chat/completions -H 'Authorization: Bearer sk-...' -d '{"model":"claude-haiku-4-5","messages":[{"role":"user","content":"hi"}]}'
Commerce — keys, recharge, subscribe
| Method | Path | Params | What it does |
|---|---|---|---|
| POST | /api/agent/keys | { parent? } | Create a fresh key (or a sub-key under a parent). Live & self-serve; signed-in creations bind to your account. IP-rate-limited. |
| GET | /api/agent/my-keys | (cookie session) | List keys bound to the signed-in account; auto-creates and binds a default key on first call. |
| POST | /api/agent/recharge | { key, amount, success_url? } | Stripe one-time checkout that tops up the key's recharge balance. Disabled until AGENT_COMMERCE is enabled. |
| POST | /api/agent/subscribe | { key, product, tier, interval } | Stripe subscription that sets key.subs[product] = tier. Disabled until AGENT_COMMERCE is enabled. |
- Product APIs are gated purely by the key's per-product subscription level (key.subs[product]); they do not consume the recharge balance.
- Commerce endpoints (keys/recharge/subscribe) are in PREVIEW: live only after the operator enables AGENT_COMMERCE following Stripe test-mode verification. Until then, get a key from api.clssai.com/key.
- GEO (g.freem.ai) and Flow (u.freem.ai) run on separate workers and are currently cookie-session only; Bearer-key support there is planned.
- KV is eventually consistent (~60s): a freshly changed subscription/balance may take up to a minute to reflect.