free-llm-apis

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Free LLM API Setup

免费 LLM API 设置

Help users pick a free LLM provider and configure their API key. Every provider here has a permanent free tier, no credit card needed.
帮助用户选择免费的 LLM 提供商并配置其 API key。此处列出的每个提供商都有永久免费额度,无需信用卡。

Provider Selection

提供商选择

Ask the user what matters most, then recommend accordingly:
PriorityBest picks
Highest rate limitsGroq (30 RPM, 14.4K RPD), Cerebras (30 RPM, 14.4K RPD)
Largest model selectionCloudflare Workers AI (49+ models), OpenRouter (32+ models)
Strongest proprietary modelsGoogle Gemini (Gemini 2.5 Pro), GitHub Models (GPT-4o)
Fastest inferenceGroq, Cerebras (both optimized for speed)
Highest token budgetMistral AI (1B tokens/month)
European providerMistral AI (EU), LLM7.io (UK)
No signup requiredLLM7.io (basic tier works without token)
先询问用户最看重哪些因素,再据此推荐:
优先事项推荐选择
最高速率限制Groq(30 RPM,14.4K RPD)、Cerebras(30 RPM,14.4K RPD)
模型数量最多Cloudflare Workers AI(49+ 个模型)、OpenRouter(32+ 个模型)
最强的专有模型Google Gemini(Gemini 2.5 Pro)、GitHub Models(GPT-4o)
最快推理Groq、Cerebras(两者均针对速度进行了优化)
最高 token 配额Mistral AI(每月 1B tokens)
欧洲提供商Mistral AI(EU)、LLM7.io(UK)
无需注册LLM7.io(基础层级无需 token 即可使用)

Provider categories

提供商类别

Provider APIs -- run by the companies that train the models:
  • Google Gemini, Cohere, Mistral AI, Zhipu AI
  • See references/provider-apis.md for setup instructions.
Inference providers -- third-party platforms hosting open-weight models:
  • GitHub Models, NVIDIA NIM, Groq, Cerebras, Cloudflare Workers AI, LLM7.io, Kluster AI, OpenRouter, Hugging Face
  • See references/inference-providers.md for setup instructions.
提供商 API——由训练模型的公司运营:
  • Google Gemini、Cohere、Mistral AI、Zhipu AI
  • 有关设置说明,请参阅 references/provider-apis.md。
推理提供商——托管 open-weight 模型的第三方平台:
  • GitHub Models、NVIDIA NIM、Groq、Cerebras、Cloudflare Workers AI、LLM7.io、Kluster AI、OpenRouter、Hugging Face
  • 有关设置说明,请参阅 references/inference-providers.md。

Workflow

工作流程

  1. Ask what models, rate limits, or features the user cares about. If they already know which provider they want, skip to step 3.
  2. Match their priorities against the table above. Suggest 1-2 options with a short reason.
  3. Load the right reference file and walk through the setup steps for that provider (API key, code example, env var).
  4. Offer a quick test script or curl command so they can confirm the key works.
  1. 询问用户最关注哪些模型、速率限制或功能。如果用户已经知道想使用哪个提供商,则直接跳到步骤 3。
  2. 根据上表匹配用户的优先事项。推荐 1-2 个选项,并简要说明原因。
  3. 加载相应的参考文件,并引导用户完成该提供商的设置步骤(API key、代码示例、环境变量)。
  4. 提供一个快速测试脚本或 curl 命令,方便用户确认 key 是否可用。

Quick Test Template

快速测试模板

After setup, use this to verify any provider:
python
from openai import OpenAI

client = OpenAI(api_key="KEY", base_url="BASE_URL")

response = client.chat.completions.create(
    model="MODEL_NAME",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
    max_tokens=50
)
print(response.choices[0].message.content)
Replace KEY, BASE_URL, and MODEL_NAME with values from the provider's setup guide.
设置完成后,使用以下代码验证任意提供商:
python
from openai import OpenAI

client = OpenAI(api_key="KEY", base_url="BASE_URL")

response = client.chat.completions.create(
    model="MODEL_NAME",
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
    max_tokens=50
)
print(response.choices[0].message.content)
将 KEY、BASE_URL 和 MODEL_NAME 替换为提供商设置指南中的对应值。

Key Notes

重要说明

  • All endpoints work with the OpenAI SDK unless noted.
  • RPM = requests per minute. RPD = requests per day.
  • Google Gemini's free tier is blocked in the EEA, UK, and Switzerland.
  • "Limits undocumented" = the provider doesn't publish rate limits.
  • Don't hardcode API keys. Use environment variables or a secrets manager.
  • 除非另有说明,所有端点均可与 OpenAI SDK 配合使用。
  • RPM = 每分钟请求数。RPD = 每天请求数。
  • Google Gemini 的免费层级在 EEA、英国和瑞士不可用。
  • "Limits undocumented" = 提供商未公布速率限制。
  • 不要硬编码 API key。请使用环境变量或 secrets manager。