首頁 > 科技與 AI > Hugging Face 每月 $0.10 免費 Credits 是 Token 嗎?GPT-OSS-120B Agent 導流

延伸主題

Hugging Face 每月 $0.10 免費 Credits 是 Token 嗎?GPT-OSS-120B Agent 導流

Hugging Face Inference Providers F...

Hugging Face routed inference 每月 0.10 美元 credits、GPT-OSS-120B 與學生 Agent 路由 canary 的 YOLO LAB 原創封面

Hugging Face Inference Providers 是第 57 個可以直接列入學生主要 AI Agent fuel manifest 的候選。官方現行 Pricing and Billing 說,每個 Hugging Face Free User 每月有 $0.10 credits,可用於 Inference Providers;金額標示為 subject to change。這是一筆美元額度,不是固定 token 數,也不是每個模型都能換成相同的 request 次數。

Hugging Face routed inference 每月 0.10 美元 credits、GPT-OSS-120B 與學生 Agent 路由 canary 的 YOLO LAB 原創封面
YOLO LAB 原創編輯封面:以 Hugging Face routed inference、GPT-OSS-120B、每月 $0.10 credits 與 custom provider key 分離呈現主要 Agent 導流入口;非 Hugging Face 官方宣傳圖。

最重要的條件是 request 必須 routed by Hugging Face。官方比較表寫明 routed request 的 monthly credits 會套用、無需另外建立 provider account;如果使用 custom provider key,月度免費 credits 不會套用,費用由外部 provider 直接計算。本文分類為 CONDITIONAL_FREE_ROUTED_INFERENCE_CREDIT,可作低額度、月度、路由限定的文字或多模態 canary。

這對主要 agent 很實用,因為它把多個 provider 和模型放在同一個 Hugging Face router 後面,並可使用 Python、JavaScript、OpenAI-compatible HTTP 或 InferenceClient。但 `$0.10` 不是無限 token,也不是 provider 給的永續贈品;額度用完後,官方仍允許 pay-as-you-go,若沒有 owner 批准購買 credits,gateway 必須停止。

本系列捕獲的是合法公開的免費或條件式 API 入口,不捕獲私人 secret、不分享 Hugging Face token、不借用別人的帳戶、不把 custom provider key 當成免費額度、不用多帳戶或自動充值放大 credits。本輪沒有登入 Hugging Face、沒有建立 token、沒有購買 credits、沒有發 live inference,也沒有送出學生或客戶資料。

主要 agent 的共通 secret、資料分類和 fallback 邊界可延伸閱讀 AI agent 使用 FAQ。本篇只把 Hugging Face routed credits 當成一個受控 adapter:先由本機 stub 驗證路由、模型、成本、月度重置、429、402 和權限,再由合法 owner 執行一次短 synthetic canary。

當日敲門模型:openai/gpt-oss-120b(Agent 推理、免費額度非固定 token)

截至 2026-08-25,Hugging Face 官方 gpt-oss guide 把 openai/gpt-oss-120b 定位為支援 reasoning、agentic workflow、tool calling、structured outputs、streaming 和 reasoning effort controls 的 Inference Providers 模型;官方也列出較小的 gpt-oss-20b。對主要 agent,120b 是本篇當日的高能力文字敲門模型候選,可透過 https://router.huggingface.co/v1/chat/completions 的 OpenAI-compatible route 使用,但仍然必須走 routed billing。

Provider policy 可以附加在 model id:openai/gpt-oss-120b:fastest 追求可用 provider 中的吞吐,:cheapest 選輸出 token 成本較低者,:preferred 依帳戶偏好順序;這些策略不會把 `$0.10` 變成固定 token 數。第一個 canary 應使用 :cheapest 或 owner 明確批准的 provider、短 synthetic prompt、低 max output、關閉真實 tool side effect,並在回應後讀回 resolved provider、usage、actual cost 和剩餘 credits。

這個模型 section 是「當日可用的高能力入口」,不是永久免費承諾,也不是 Hugging Face 替模型作者支付全部推理費。Free User 的月度 credit 只在 eligible routed request 套用;custom provider key、Team/Enterprise organization credits 和自行購買的 pay-as-you-go balance 另行記帳。若 model catalog、provider availability、token permission 或 cost read-back 缺一,主要 agent 只允許 local stub。

Free User 每月 0.10 美元 credits

官方 Pricing and Billing 把 Free Users 的 monthly credits 列為 $0.10,並註明數字可能變更;PRO Users 是 `$2.00`,Team 或 Enterprise organization 是每 seat `$2.00`。學生主要 agent 應只把 Free User 的 `$0.10` 寫入免費 manifest,不把 PRO、Team 或 Enterprise credits 當成個人免費資格。

這筆額度會自動套用在 routed request,通常按 provider 的模型與硬體價格扣除。相同 `$0.10` 可能支援許多短文字請求,也可能只支援少量圖像、語音或大型模型請求;沒有當日 model price、provider、input/output usage 和實際 balance,就不能換算成固定 token 數或「可用幾次」。

Team 或 Enterprise 的 `$2.00 per seat` 是訂閱組織的共享 credits,不是學生自己擁有的免費 token。若 organization 要代付,官方要求明確指定 organization billing;owner 必須設定 spend limit、provider allowlist 和撤銷流程。學生不能只因為加入某個 workspace,就自行把 organization budget 當成個人額度。

function classifyHfRoute(snapshot) {
  if (snapshot.route === 'huggingface' && snapshot.authMode === 'routed') {
    if (snapshot.accountType === 'free' && snapshot.monthlyCreditsUsd >= 0.10) {
      return 'HF_FREE_ROUTED_CREDIT';
    }
    return 'HF_ROUTED_CREDIT_UNKNOWN';
  }
  if (snapshot.authMode === 'custom_provider_key') {
    return 'CUSTOM_KEY_NO_HF_FREE_CREDIT';
  }
  if (snapshot.organizationBilling === true) {
    return snapshot.ownerApproved === true
      ? 'ORG_CREDIT_OWNER_REVIEW'
      : 'ORG_CREDIT_NOT_STUDENT_FREE';
  }
  return 'ROUTE_UNKNOWN';
}

這個分類器把免費資格、路由模式和 organization billing 分開。它不把「可以用 Hugging Face token 認證」直接等同「有免費 credits」,也不把 custom provider key 的成功 request 計入 Hugging Face free fuel。每個 job 要在 ledger 中保存 route、authMode、accountType、provider、model、credits before、credits after 和 checkedAt。

Routed request 與 custom provider key

官方 Inference Providers 文件 說 routed request 會使用 Hugging Face 的 provider keys,請求由 Hugging Face 路由到合作 provider,帳務由 Hugging Face 管理;使用 custom provider key 則由你在設定中提供外部 key,費用由該 provider 計算,月度 Hugging Face credits 不適用。

這不是細節,而是第 57 篇的主要驗收條件。相同的 InferenceClient、相同的 model id,若 auth mode 不同,可能走不同的 key、不同的 billing、不同的資料政策和不同的免費資格。adapter 要明確拒絕未標記 routed 的 request,不能只看 SDK 呼叫成功。

若課程要教多 provider fallback,先固定 routed mode,再將 provider selection 設成 auto:fastest:cheapest 或 owner-approved provider。自動 fallback 可能改變實際 provider、延遲、模型版本和 cost;每次 response 都要記錄 resolved provider、model、usage 和 billing source,不要只保存原始 model id。

function chooseHfProvider(config) {
  if (config.authMode !== 'routed') {
    throw new Error('Free Hugging Face credits require routed authentication');
  }
  if (config.providerPolicy === 'custom_key') {
    throw new Error('Custom provider keys are outside the HF free-credit route');
  }
  const allowed = ['auto', 'fastest', 'cheapest', 'preferred'];
  if (!allowed.includes(config.providerPolicy)) {
    throw new Error('Provider policy is not approved');
  }
  return { providerPolicy: config.providerPolicy, billTo: null };
}

上面的 policy guard 只允許 routed mode,並明確禁止 custom provider key 混入免費 canary。若組織要使用 bill_to,那是另一條 owner-controlled organization route;不能讓學生或 agent 任意指定別人的 organization,也不能把 shared credits 偽裝成 Free User 的個人 `$0.10`。

Fine-grained Hugging Face token 與環境變數

官方文件要求使用 Hugging Face token 認證,並建議建立 fine-grained token,權限只開 Make calls to Inference Providers。token 的權限不是免費額度本身;它只是讓 routed request 能辨識帳戶與扣用量。主要 agent 應把 token 由 server-side secret manager 注入,學生只看到 task status、model summary 和去識別化 usage。

官方 First API Call 示範使用 HF_TOKEN 環境變數與 InferenceClient;官方主文件也提供 OpenAI-compatible router endpoint。示範中的 placeholder 永遠不能換成真實 token。建立 token、設定權限、撤銷 token 和查看 billing 都由合法 owner 操作。

fine-grained token 要有用途名稱、建立時間、owner、可接受資料分類、可用 route、撤銷日和課程清理日。若只需要 Inference Providers,就不要授予 repository write、organization admin、billing 或其他不必要權限。token 泄漏後先撤銷並檢查 usage/billing,再建立新 token;禁止以另一個帳戶掩蓋未知消耗。

function requireHfSecret(env, policy) {
  const token = env.HF_TOKEN;
  if (!token || token.length < 20) {
    throw new Error('HF_TOKEN must be injected from an approved secret store');
  }
  if (policy.authMode !== 'routed' || policy.permission !== 'inference_only') {
    throw new Error('Hugging Face canary requires routed inference-only access');
  }
  return { tokenPresent: true, token: '[INJECTED]' };
}

function redactHfLog(value) {
  return String(value).replace(/Bearer\s+[^\s]+/gi, 'Bearer [REDACTED]').replace(/hf_[A-Za-z0-9_-]+/g, 'hf_[REDACTED]');
}

這段只做環境變數與 log redaction,不會讀取或輸出本機 token。任何紀錄都不能保存完整 Bearer header、token、帳戶 email 或 private model path;只保存 token fingerprint、權限摘要、route、provider、model、usage 和查核時間。學生提交的 prompt 也要先通過資料分類,不要把秘密放進免費 request。

模型、provider 和免費額度的實際換算

Hugging Face Inference Providers 可以接觸多個 provider 與模型,官方提供 `:fastest`、`:cheapest` 和 `:preferred` 等選擇策略;但模型 catalog、provider availability、硬體價格、context limit 和工具支援都可能變動。免費 manifest 不應寫死某個 model 永遠存在,也不能用模型名稱推算每月 `$0.10` 能跑多少 token。

一個安全的 estimate 要至少帶 model、resolved provider、input tokens、output tokens、modality、estimated USD、actual USD、credits before、credits after 和 response status。若使用圖像、音訊或視頻,成本通常不是單純 token;若使用 function calling,工具本身的外部費用也要另列,不能從 Hugging Face free credits 中假設免費。

function checkHfBudget(job, account, policy) {
  if (job.route !== 'huggingface' || job.authMode !== 'routed') {
    return { status: 'STOP', reason: 'not_free_routed_route' };
  }
  if (job.inputClass !== 'public' && job.inputClass !== 'synthetic') {
    return { status: 'DATA_REVIEW' };
  }
  if (!Number.isFinite(job.estimatedUsd) || job.estimatedUsd > policy.maxUsd) {
    return { status: 'MANUAL_REVIEW', reason: 'cost_unknown_or_over_cap' };
  }
  if (!Number.isFinite(account.remainingUsd) || account.remainingUsd < job.estimatedUsd) {
    return { status: 'STOP', reason: 'monthly_credit_insufficient' };
  }
  return { status: 'CANARY_BUDGET_OK', maxOutputTokens: policy.maxOutputTokens };
}

這個函式只做本地 hard cap,不是 Hugging Face 的官方價格計算器。Free User 的 `$0.10` 會 subject to change;真正的 actual usage 要在 response、billing page 或 Inference Providers usage breakdown read-back。若 actual cost 和 estimate 不一致,停止下一個 job,先保存 provider、model、usage 和 balance evidence。

主要 agent 的文字、工具與多模態邊界

Hugging Face 很適合當主要 agent 的小型 text canary:短摘要、分類、結構化輸出、簡短 function-calling 規劃或模型比較。工具呼叫的真正副作用仍由 agent gateway 控制,模型只提出 tool call,不能因為有 Inference Providers credits 就自動執行付款、刪除、傳訊息或外部寫入。

官方 Function Calling guide 說明模型可以產生函式呼叫,但每個工具都要有自己的 schema、權限與人工接手。學生作業先使用 local fake tools,確認模型輸出不會洩漏 token、把字串當成 shell、重複呼叫或跳過 confirmation,再考慮 routed inference。

若要做 image、audio 或 video,先用 provider/model allowlist 及單一 output 限制。多模態 input 可能包含圖片、音訊、文件或公開 URL,資料責任與成本都比短文字高。第一個 free canary 應優先選低成本、無上傳、短 output 的文字模型,其他 modality 只留在 local stub 或人工審核。

429、402、權限與 provider fallback

Inference Providers 是多 provider 路由層,HTTP status、provider error、billing error 和模型拒絕可能來自不同位置。主要 agent 要把 401/403、402、404、409、429、5xx、content policy、model unavailable 和 balance mismatch 分開;不要把所有錯誤都轉成 retry,也不要把 provider fallback 當成免費額度增加。

function routeHfResponse(response, state) {
  if (state.retryCount >= 1 || state.remainingUsd <= 0) {
    return { status: 'STOP', reason: 'retry_or_budget_cap' };
  }
  if (response.status === 401 || response.status === 403) {
    return { status: 'MANUAL_REVIEW', reason: 'token_permission_or_model_access' };
  }
  if (response.status === 402) {
    return { status: 'PAYMENT_REQUIRED' };
  }
  if (response.status === 429) {
    return { status: 'WAIT', retryAfter: response.headers.get('retry-after') };
  }
  if (response.status >= 500) return { status: 'RETRY_ONCE' };
  return { status: response.ok ? 'ACCEPTED' : 'UNCLASSIFIED' };
}

429 要遵守 provider 或 router 的等待時間;402 要停止在 billing review;401/403 要查 fine-grained permission、model scope 和 token state;5xx 只有在 request 尚未產生外部副作用且仍在 budget 內時有限重試。若使用 auto provider selection,retry 也可能選到另一個 provider,所以每次重試都要重新記錄 resolved provider 和 actual cost。

Hugging Face routing 的資料安全

官方 Security and Compliance 說 routing 使用 TLS/SSL 傳輸,Hugging Face 不為訓練目的保存 user data,routing request body 和 response 不保存;debug logs 最多保留 30 天,且不保存 user data 或 tokens。這是 Hugging Face routing 層的說明,不代表外部 provider 的資料政策相同;仍要對照 Hub SecurityPrivacy Policy

官方也提醒 external providers 各自負責 security measures,因此 model、provider、資料分類和地區要進 manifest。學生第一輪只送 public、synthetic 或去識別化資料;不要把學校名單、未成年人資料、醫療內容、客戶文件、未公開程式碼或其他 provider token 放進 request。若 provider policy 無法查核,退回 local-only。

回應中的 model output、usage metadata、provider name、request id 和錯誤文字也可能包含敏感資訊。公開報表只保存 hash、status、usage、cost、latency、route 和查核時間;完整 prompt、response、URL、token、帳戶 email 和 billing reference 放在受限儲存並設清理日期。免費 credits 不能降低資料治理標準。

Hugging Face token 的學生使用方式

學生若只做學習,可以使用自己合法建立的 Hugging Face free account,在官方 Playground 或受控範例中觀察模型與 provider;不要把 token 交給同學、老師或主要 agent。若班級要集中管理,應由 owner 建立 gateway 與 organization policy,學生只看到可用的作業 route,不看到 shared token。

主要 agent 最適合提供三種模式:LOCAL_ONLY 讓學生練習完整流程;HF_FREE_ROUTED 只允許短 synthetic canary 且月度 hard cap;HF_ORG_APPROVED 由 owner 承擔 organization credits、spend limit 和資料責任。模式轉換要有 owner decision 和 fresh read-back,不能讓學生在 prompt 中要求「改用付費 route」。

若 `$0.10` 已耗盡,系統應顯示 credit exhausted、local fallback 或等待下一個月度週期;不能自動購買 credits。若官方將 monthly amount、eligible providers 或 billing flow 改變,manifest 轉為 unknown,直到重新讀 pricing page、usage、account type 和實際 response,再由 owner 確認。

月度 credit ledger 與重置查核

Hugging Face free credits 是月度額度,主要 agent 應保存 month key、account type、initial credits、credits before、actual cost、credits after、provider、model、request id、billing source 和 checkedAt。不要把下一個月可能得到的 `$0.10` 預先算進本月可用 budget,也不要因為 billing page 暫時沒有數字就假設無限。

function closeHfCanary(result) {
  const required = ['month', 'route', 'authMode', 'provider', 'model', 'status', 'actualUsd'];
  if (!required.every(field => result && result[field] !== undefined)) {
    return { status: 'INCONCLUSIVE', reason: 'billing_read_back_incomplete' };
  }
  if (result.authMode !== 'routed' || result.dataClass !== 'synthetic') {
    return { status: 'STOP', reason: 'free_route_contract_failed' };
  }
  if (result.paymentTriggered || result.secretLeaked || result.actualUsd > result.maxUsd) {
    return { status: 'STOP', reason: 'budget_or_secret_contract_failed' };
  }
  return { status: 'HF_FREE_ROUTED_CANARY_CONFIRMED', month: result.month };
}

完成 canary 只代表一個月、一個帳戶、一次 routed request 的 contract 已經讀回,不代表 `$0.10` 永久固定、所有 provider 都 eligible、所有模型都支援工具,或學生可以無限使用。每次月度切換、模型更新、provider 變更和 SDK 升級都要重新跑 local stub 與最小 read-back,並保存結果。

主要 agent 的三階段 Hugging Face canary

第一階段 local-only:模擬 fine-grained permission、routed/custom key、provider selection、monthly `$0.10`、usage、402、429、model unavailable 和 fallback。第二階段 account read-back:由合法 owner 確認 Free User、當月 credits、eligible route、token permission、provider policy、billing page 和 spend stop。第三階段才做一次短 synthetic text request,固定 model、短 prompt、低 output、零工具副作用。

若 request 使用 custom provider key,canary 必須標成 CUSTOM_KEY_NO_HF_FREE_CREDIT;若使用 Team/Enterprise billing,標成 HF_ORG_APPROVED;若只有 token permission 但沒有 balance read-back,標成 ACCOUNT_READ_BACK_REQUIRED。所有未知狀態都走 local fallback,不用猜測。

主 agent 可以把 Hugging Face 當成「小額多模型實驗燃料」,但不能把它當成沒有成本的生產層。它最適合驗證模型路由、簡短 agent planning、工具 schema 和 provider fallback;大量批次、長上下文、圖像影音或正式產品流量,必須另做 paid budget、provider SLA、資料政策和失敗恢復設計。

條款、帳戶輪換與付款停止線

Hugging Face free account、PRO、Team、Enterprise 和外部 provider account 是不同資格。主要 agent 不代學生建立多個帳戶、不使用別人的 token、不把 shared organization credits 當個人免費資源,也不因月度額度用完就自動購買或切換 custom provider key。正常的 token rotation 只能用於安全修復與 lifecycle,不能用來取得更多 grant。

若出現未授權 billing、credits 異常下降、token 外洩、provider policy 不明、資料分類失敗或連續 429,先停止 adapter、撤銷受影響 token、保存去秘密化 evidence,再由 owner 處理。不要用變形 prompt、換帳戶、換 provider key、無限 retry 或提高 organization cap 來掩蓋問題。

官方文件表示月度 free credits 與 pay-as-you-go 可以並存,這正是 gateway 必須設 hard stop 的原因。學生看到「credits exhausted」時,正確結果是 local-only 或 owner review;不是自動在 billing page 買 credits。所有付款都要有明確 owner、金額上限、資料責任和回讀。

OpenAI-compatible router 與 SDK 邊界

官方主文件提供 OpenAI-compatible router endpoint https://router.huggingface.co/v1,也提供 InferenceClient 的 Python 與 JavaScript 用法。這對主要 agent 很方便,因為 adapter 可以維持統一的 chat completions contract;但統一介面不代表每個 provider、model 或 tool capability 完全相同,manifest 仍要保存 resolved provider 和 capability。

最小的文字 canary 可以固定一個已查核的 model id、短 system prompt、短 user prompt、低 max output tokens 和非 streaming response。若 agent 需要 streaming、structured output、function calling 或 vision,先在 local stub 驗證 response parser、timeout、tool schema 和拒絕路徑,再開一個新的 capability flag。不要把「chat completion 成功」擴大成「整個 agent 已可用」。

使用 OpenAI SDK 時,base URL、token、model、provider policy 和 billing route 要由 server-side config 注入;學生只送已分類的 task。每一個 request 都要留下 request id、model、provider policy、resolved provider、usage、cost、status 和 retry count。若 router 回傳 provider 不在 allowlist,立即停止並回到 local fallback。

Provider catalog 與自動選擇

Inference Providers 的價值是集中接觸多個 provider,但這也使模型清單、可用區域、排程、價格和資料政策成為動態狀態。課程不要把一個 model id、provider 名稱或示範結果永久寫死;每次 canary 前以官方 Hub filter、provider support、model card 和 usage read-back 確認。

auto:fastest 可能為了可用性選擇不同 provider;:cheapest 也只代表當下路由策略,不代表成本零或固定。對學生教學,建議先固定 provider policy 與 model,再另做一個 auto fallback 實驗,將 latency、cost、quality、moderation 和 error rate 分開比較。

如果 provider 暫時不可用,fallback 只可在同一個 approved routed budget 內進行一次。不能因自動 fallback 反覆改 provider 就消耗多份月度額度,也不能用不同帳戶或 custom provider key 將一次失敗變成未記帳的成功。gateway 要對每個嘗試建立獨立 ledger entry。

function approveHfModel(snapshot, policy) {
  const providerOk = policy.providers.includes(snapshot.resolvedProvider);
  const modelOk = policy.models.includes(snapshot.model);
  const routeOk = snapshot.authMode === 'routed' && snapshot.monthlyCreditsUsd > 0;
  if (!providerOk || !modelOk || !routeOk) {
    return { status: 'STOP', reason: 'model_provider_or_route_not_approved' };
  }
  if (snapshot.capabilities.includes('tool_use') && policy.allowTools !== true) {
    return { status: 'MANUAL_REVIEW', reason: 'tool_capability_not_approved' };
  }
  return { status: 'MODEL_CANARY_APPROVED' };
}

這個 guard 讓 model catalog、provider、route 和工具能力成為明確欄位。若官方更新模型或 provider mapping,先更新 allowlist 和 local fixture,再做一次短 read-back;不要因上一個月的 model 仍然回應,就默認它仍使用同一個 provider 或同一個價格。

月度週期與帳戶 read-back

官方文件把 Free User monthly credits 描述為自動套用,但公開頁面不應被當成某一個帳戶的即時 balance。owner 每月要讀回 account type、credit amount、used amount、remaining amount、billing mode、eligible provider、payment state 和 checkedAt。沒有 read-back 時,manifest 狀態應是 MONTHLY_CREDIT_UNKNOWN

月度切換不能靠系統時間猜測。以 Hugging Face billing page 或官方 usage breakdown 為準,保存查核日期與時區;如果頁面顯示 subject to change、額度暫時未載入或 provider eligibility 不明,該月只允許 local stub。不要預先消耗下一個週期,也不要為了趕課程在當月最後幾分鐘無限 retry。

organization billing 也要做 fresh read-back。官方文件要求指定 organization 才能將請求計入 Team/Enterprise credits,且只有屬於該 organization 的 user 才能使用。gateway 要檢查 membership、owner approval、spend limit 和 bill-to value,禁止學生在輸入欄位直接指定任意 organization。

資料安全與外部 provider 責任

Hugging Face routing 層的 security page 是重要正面訊號,但它不會替所有外部 provider 承擔完整資料責任。使用自動或指定 provider 前,owner 要查該 provider 的 privacy、retention、training、region、content policy 和輸出保存規則。若無法對上,就不把學生資料送過去,即使剩餘 free credits 仍在。

課程第一輪只用 public/synthetic prompt,例如簡短的無個人資料摘要或測試分類。若測試 function calling,工具 payload 使用假的城市、假的商品和假的計算結果;若測試 image 或 document,使用公開授權素材或完全合成的 fixture。免費額度的成本很小,不代表錯誤資料外洩的成本也小。

安全檢查還要覆蓋 prompt injection、tool injection、model output 中的 secret、provider error 中的 request content 和 log 中的 token。agent 只把已分類的 prompt 送給 adapter,adapter 對 response 做 schema validation、敏感字串清理和 output size limit,再回傳學生可看的最小結果。

學生作業與教師驗收

第一個作業可以要求學生建立一個 local Hugging Face gateway simulator:輸入 route、auth mode、model、provider、estimated cost 和 prompt class,輸出 approve、manual review、payment required、credit exhausted 或 local fallback。學生要證明 custom key 不會套用 free credit、未分類資料不會送出、429 不會無限重試。

第二個作業由教師或 owner 讀回一個合法 Free User account 的月度狀態,使用去識別化欄位完成 evidence packet;不需要把 token、email 或完整 billing screenshot 放進學生報告。第三個作業才是可選的一次 synthetic routed request,並記錄 resolved provider、actual cost、usage、latency、status 和 fallback。

驗收標準不是「成功得到回答」而已,還包括:沒有 secret 洩漏、沒有付款、沒有送出未分類資料、沒有使用 custom provider key、沒有超過 output cap、沒有無限 retry、沒有把 organization credit 誤標為個人免費,以及能在 credits exhausted 後清楚回到 local-only。這些證據才足以讓主 agent 使用下一個學生作業。

更新、撤銷與停止線

每次 Hugging Face SDK、router、provider catalog、pricing 或 token permission 更新,都先在隔離環境跑 parser、cost fixture、429 fixture、model fixture 和 secret redaction。若更新影響 provider selection 或 billing,不要直接在課堂或 production gateway 中熱切換。先將 route 降級成 local-only,再由 owner 完成 fresh read-back。

撤銷條件包括 token 外洩、未授權 organization billing、actual cost 大於 hard cap、provider policy 變成 unknown、連續 rate limit、模型不再可用、學生資料誤送或 response parser 失敗。撤銷後保留去秘密化 evidence 與 status,清理 token、cookie、prompt、response 和 output URL,不用新帳戶掩蓋事件。

持續捕獲與 fuel rotation

把 Hugging Face 放入持續 fuel rotation 時,crawler 只收集公開 policy signal:Free User monthly amount、subject to change、routed/custom key 差異、provider catalog、security page、token permission 和 billing 說明。它不嘗試登入、不讀取帳戶餘額、不抓取 token、不測試別人的 key,也不把搜尋摘要直接寫成可用額度。

每個月的候選卡片要有 policyCheckedAtaccountReadBackAtroutecreditAmountUsdeligibleProviderscustomKeyExcludedownerexpiryOrResetnextReviewAt。公開政策和帳戶結果分開保存;兩者不一致時採較保守的結果,讓 agent 退回 local-only。

每次月度使用後,報告不要只寫「免費額度已用」。至少報告 routed request 數、resolved provider、模型、input/output usage、actual USD、剩餘額度、429/402 次數、fallback 次數和未解釋差異。若只知道 token 仍有效、不知道 credits 是否扣用,狀態應是 BILLING_READ_BACK_REQUIRED

這個 rotation 讓學生可以持續學習而不依賴某一家 provider。Hugging Face routed credits 可以用來比較模型和 provider;本機 stub 可以在 credits exhausted、provider unavailable 或 terms unknown 時接手;已批准的 paid route 只能由 owner 開啟。三者的結果要在 UI 中明確標示,不能讓學生以為所有回答都來自同一個免費 token。

如果官方把 Free User 金額改為零、改變 eligible provider 或取消 routed credits,文章仍然有價值:它會保留 custom key 不適用、資料路由、token permission、billing 與 fallback 的架構。主要 agent 只需把狀態改成 FREE_GRANT_CHANGED,不必重寫整個工具層,也不會意外替學生啟動付費。

每一次 rotation 都要保留一個明確的 owner decision:繼續使用、改用 local-only、等待月度更新、轉為 paid review,或永久撤銷。這使免費資源的生命週期可追蹤,也讓學生知道 token fuel 是有條件的工程資源,而不是可以無限捕獲的私人密鑰。

第 57 篇結論與後續查核

Hugging Face Inference Providers 目前有官方可用的 Free User 月度 `$0.10` credits,適用於 routed by Hugging Face 的 Inference Providers request;custom provider key 不適用,Team/Enterprise credits 也不是學生個人免費資格。正確分類是 CONDITIONAL_FREE_ROUTED_INFERENCE_CREDIT:適合低額度、月度、短 synthetic canary,不是無限 token。

正式接入主要 agent 前,重新查 pricing、Inference Providers、First API Call、Security、model/provider availability 與合法帳戶 read-back。確認當月額度、routed auth、fine-grained permission、provider、model、actual cost、資料分類和 fallback;任何一項缺失,就停在 local stub,不建立、不分享、不收集任何 secret,也不把上一個月的 credits 快照當成今天的餘額。

截至 2026-08-25,本輪未做 Hugging Face 登入、建立 token、購買 credits、organization billing、live inference、外部 publication 或 WordPress 寫入。文章只保存公開官方政策與本地 adapter 邊界;`$0.10`、openai/gpt-oss-120b 的 eligible providers、模型價格和月度資格仍以查核當日的官方頁面與合法帳戶 read-back 為準,並要在下一個月重新驗證。

作者與編輯責任

本文署名作者:

|YOLO LAB 主編

YOLO LAB 的文章由署名作者或編輯團隊完成。主編 Dex 負責編輯制度、重要事實查核原則、AI 協作規範與重大更正;文章中的分析與判斷以公開來源、作品內容及可驗證資料為依據。

文章若有需要補充或修正的資料,可透過聯絡頁提供原始來源、日期與具體段落,編輯團隊會依出版政策檢查。

KEEP READING

接著讀什麼?

從同一主題繼續閱讀,或回到 YOLO LAB 的完整文章索引,找到下一個值得投入時間的問題。

發表迴響

探索更多來自 YOLO LAB 的內容

立即訂閱即可持續閱讀,還能取得所有封存文章。

繼續閱讀