HT
HaoToken免费 API 甄选
📖 入门教程

Cloudflare Workers AI 免费层:每天 10 万次推理不要钱

Cloudflare Workers AI is absolutely cracked. 100,000 neurons per day for free, 47+ models, no credit card. I run my enti...

Cloudflare Workers AI 免费层:每天 10 万次推理不要钱

> "Cloudflare Workers AI is absolutely cracked. 100,000 neurons per day for free, 47+ models, no credit card. I run my entire Telegram bot on it and haven't spent a cent. The only catch is it runs on their edge network so latency is inconsistent." — u/cloudflare_dev, Reddit r/LLMDevs, 2026

引言

Cloudflare Workers AI 是 Cloudflare 边缘计算平台上的 AI 推理服务。它最大的特点是 100,000 neurons/day 免费额度——这意味着每天 10 万次神经元计算,换算成实际请求大约数千到上万次。而且,不需要绑定信用卡,有 Cloudflare 账号即可使用。

2026 年 Cloudflare Workers AI 支持的免费模型超过 47 个,包括 Llama 3.1 8B、Mistral 7B、Qwen 2.5 Coder 等。更妙的是,它和 Cloudflare Workers 无缝集成,可以构建全栈无服务器 AI 应用。

---

具体步骤:使用 Cloudflare Workers AI 免费层

第一步:注册 Cloudflare 账号

访问 cloudflare.com,注册免费账号。2026 年支持 Google 和 Apple 登录。

不需要信用卡。Cloudflare 的免费计划包含 Workers AI 的免费层。

第二步:进入 Workers AI

登录后,在 Dashboard 左侧找到 "AI" 选项(或直接访问 dash.cloudflare.com/?to=ai)。

第三步:浏览免费模型

2026 年 Workers AI 免费层支持的主要模型:

模型类型说明
@cf/meta/llama-3.1-8b-instruct通用对话最快的免费模型
@cf/mistral/mistral-7b-instruct-v0.3通用质量稳定
@cf/qwen/qwen2.5-coder-7b-instruct代码编程专用
@cf/deepseek/deepseek-r1推理深度推理
@cf/facebook/bart-large-cnn摘要文本摘要专用

第四步:生成 API Token

  1. 进入 Dashboard > My Profile > API Tokens
  2. 创建 Token,选择 "Workers AI" 权限
  3. 保存 token(格式:`:`)

第五步:Python 调用

import requests

account_id = "your_account_id"
api_token = "your_api_token"

headers = {
    "Authorization": f"Bearer {api_token}",
    "Content-Type": "application/json"
}

response = requests.post(
    f"https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/run/@cf/meta/llama-3.1-8b-instruct",
    headers=headers,
    json={
        "messages": [
            {"role": "user", "content": "解释一下Cloudflare Workers AI的免费额度"}
        ]
    }
)

result = response.json()
print(result["result"]["response"])

第六步:在 Workers 中直接调用(最佳方式)

如果使用 Cloudflare Workers,可以直接调用 AI 绑定,不需要手动管理 API 认证:

// wrangler.toml 需要配置 ai 绑定
export default {
  async fetch(request, env) {
    const response = await env.AI.run("@cf/meta/llama-3.1-8b-instruct", {
      messages: [
        { role: "user", content: "用中文回答:什么是边缘计算?" }
      ]
    });
    return new Response(response);
  }
}

这是最推荐的使用方式——直接在边缘计算中调用 AI,延迟最低。

---

curl 示例

curl -X POST "https://api.cloudflare.com/client/v4/accounts//ai/run/@cf/meta/llama-3.1-8b-instruct" \
  -H "Authorization: Bearer " \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "Hello, world!"}
    ]
  }'

---

够干什么?实际场景建议

场景每日额度消耗适合程度
Telegram/Discord Bot~2000 neurons/天✅ 完美运行
个人网站 AI 助手~5000 neurons/天✅ 足够
文本分类 API~1000 neurons/天✅ 适合
翻译服务~3000 neurons/天✅ 足够小团队
图片生成(Stable Diffusion)~50000 neurons/天⚠️ 仅限轻量使用

100,000 neurons/day 相当于

  • 约 5000 次 LLM 推理请求(Llama 8B)
  • 约 200 次 Stable Diffusion 图片生成
  • 约 10000 次文本分类

---

2026 年现状与变化

  • 免费额度翻倍:2025 年底从 50,000 提升到 100,000 neurons/day
  • 模型从 20+ 增加到 47+:2026 年新增了 DeepSeek R1 和 Qwen 2.5 Coder
  • Workers AI 正式 GA:2025 年 beta,2026 年正式版
  • 向量数据库集成:可以和 Cloudflare D1 数据库 + Vectorize 搭配使用
  • 全球延迟优化:边缘节点部署,但 8B 模型首次加载需要预热

---

交叉引用

  • Hugging Face Inference API — 另一个边缘推理方案
  • OpenRouter 免费模型路由 — 对比不同网关
  • 全部薅一遍:20 家免费 API 额度叠加 — 作为基础设施层
  • 免费 API 的坑与避雷指南 — 限流和温启动问题

---

数据来源

  • Cloudflare Workers AI 官方文档 (developers.cloudflare.com/workers-ai)
  • Reddit r/LLMDevs, "Cloudflare Workers AI free tier" 经验帖
  • Cloudflare 2026 Roadmap
  • 个人实践经验,2026 年 5 月