引言
把"免费大模型 API"按能力维度切片会清晰得多。本文从文本对话、图像生成、语音合成/识别三类各取代表,给出端点、配额与适用场景。比起死记几十个模型名,按任务家族来组织能让你在面对新模型时迅速归类——比如新出的某 Llama 变体只是文本对话类的又一选项,新出的 SDXL Lightning 只是图像生成类的一员。
flowchart LR
A["Free LLM APIs"]
A --> T["Text / Chat"]
A --> I["Image Generation"]
A --> V["Voice"]
T --> T1["OpenRouter :free"]
T --> T2["Groq LPU"]
T --> T3["DeepSeek V3/R1"]
T --> T4["Mistral La Plateforme"]
T --> T5["Gemini Flash"]
I --> I1["Hugging Face FLUX/SDXL"]
I --> I2["Pollinations URL API"]
V --> V1["Whisper-large-v3 ASR"]
V --> V2["Edge-TTS Free"]
V --> V3["Coqui / Fish Audio Trial"]
文本对话
- OpenRouter:
openrouter.ai/api/v1,:free 模型零成本,协议与 OpenAI SDK 完全兼容。
- Groq:
api.groq.com/openai/v1,LPU 推理让首 token 延迟降到几十毫秒。
- DeepSeek:
api.deepseek.com/v1,deepseek-reasoner 推理路径在数学与代码任务上表现突出。
- Gemini:
generativelanguage.googleapis.com/v1beta,多模态输入,免费层 1M 上下文。
- Mistral:
api.mistral.ai/v1,open-mistral-7b 与 Mixtral 8x7B 都有免费配额。
图像生成
- Hugging Face Inference:直接调用
black-forest-labs/FLUX.1-dev、stabilityai/sdxl 等开源大图模型,免费层 1 RPM 起步。
- Pollinations.ai:
https://image.pollinations.ai/prompt/{prompt},URL 即出图,无需注册,适合做 demo 与占位图。
- Together AI:FLUX schnell 在 $5 信用内可跑数百张,端点
api.together.xyz/v1/images/generations。
语音
- ASR(语音转文字):
whisper-large-v3 通过 Hugging Face 或 Groq 调用,Groq 端点秒级转录 1 分钟音频。
- TTS(文字转语音):Edge-TTS 完全免费(基于微软 Edge 在线 TTS),Coqui XTTS 自部署可克隆音色,Fish Audio 有试用额度。
代码示例
from openai import OpenAI
# 文本对话:OpenRouter 调 Llama 3.3 70B 免费
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key="sk-or-...")
r1 = client.chat.completions.create(
model="meta-llama/llama-3.3-70b-instruct:free",
messages=[{"role": "user", "content": "用 100 字介绍向量数据库"}],
)
# 图像:Pollinations URL API(无需 key)
import requests
url = "https://image.pollinations.ai/prompt/" + requests.utils.quote("cyberpunk city at night")
img = requests.get(url, timeout=120).content
# ASR:Groq 调 Whisper
gclient = OpenAI(base_url="https://api.groq.com/openai/v1", api_key="gsk_...")
with open("audio.mp3", "rb") as f:
r3 = gclient.audio.transcriptions.create(model="whisper-large-v3", file=f)
print(r3.text)
选型建议
文本对话首选 OpenRouter(覆盖最广)+ Groq(延迟最低)做双备份;图像生成首选 Hugging Face(可控)+ Pollinations(无 key 降级);语音 ASR 用 Groq Whisper,TTS 用 Edge-TTS 起步、需要音色克隆时切到 Coqui 自部署。三类各有兜底后,单家 provider 停服不会让产品停转。
Introduction
Slicing "free LLM APIs" by capability makes the landscape far easier to navigate. Instead of memorizing dozens of model names, you can reason about three task families — text, image, and voice — and slot any new model into the right family as it appears. This article picks representative endpoints from each family, lists quotas and use cases, and gives a unified code pattern so you can swap providers without rewriting application logic.
flowchart LR
A["Free LLM APIs"]
A --> T["Text / Chat"]
A --> I["Image Generation"]
A --> V["Voice"]
T --> T1["OpenRouter :free"]
T --> T2["Groq LPU"]
T --> T3["DeepSeek V3/R1"]
T --> T4["Mistral La Plateforme"]
T --> T5["Gemini Flash"]
I --> I1["Hugging Face FLUX/SDXL"]
I --> I2["Pollinations URL API"]
V --> V1["Whisper-large-v3 ASR"]
V --> V2["Edge-TTS Free"]
V --> V3["Coqui / Fish Audio Trial"]
Text and Chat
- OpenRouter:
openrouter.ai/api/v1 — :free models cost nothing, fully OpenAI-SDK compatible.
- Groq:
api.groq.com/openai/v1 — LPU inference brings time-to-first-token into the tens of milliseconds.
- DeepSeek:
api.deepseek.com/v1 — deepseek-reasoner reasoning path excels at math and code.
- Gemini:
generativelanguage.googleapis.com/v1beta — multimodal input, 1M context in the free tier.
- Mistral:
api.mistral.ai/v1 — open-mistral-7b and Mixtral 8x7B both have free quotas.
Image Generation
- Hugging Face Inference: call
black-forest-labs/FLUX.1-dev, stabilityai/sdxl, and other open-weight image models directly. Free tier starts at 1 RPM.
- Pollinations.ai:
https://image.pollinations.ai/prompt/{prompt} — a URL is enough to get an image, no sign-up needed. Ideal for demos and placeholder art.
- Together AI: FLUX schnell runs hundreds of images inside the $5 credit, endpoint
api.together.xyz/v1/images/generations.
Voice
- ASR (speech-to-text):
whisper-large-v3 via Hugging Face or Groq. The Groq endpoint transcribes a minute of audio in seconds.
- TTS (text-to-speech): Edge-TTS is fully free (built on Microsoft Edge online TTS). Coqui XTTS, self-hosted, can clone voices. Fish Audio has a trial quota.
Unified Code Pattern
from openai import OpenAI
# Text chat: OpenRouter calling Llama 3.3 70B free
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key="sk-or-...")
r1 = client.chat.completions.create(
model="meta-llama/llama-3.3-70b-instruct:free",
messages=[{"role": "user", "content": "Explain vector databases in 100 words."}],
)
# Image: Pollinations URL API (no key needed)
import requests
url = "https://image.pollinations.ai/prompt/" + requests.utils.quote("cyberpunk city at night")
img = requests.get(url, timeout=120).content
# ASR: Groq Whisper
gclient = OpenAI(base_url="https://api.groq.com/openai/v1", api_key="gsk_...")
with open("audio.mp3", "rb") as f:
r3 = gclient.audio.transcriptions.create(model="whisper-large-v3", file=f)
print(r3.text)
Selection Guidance
For text chat, run OpenRouter (widest coverage) plus Groq (lowest latency) as dual backups. For image generation, use Hugging Face as the controllable path and Pollinations as the no-key fallback. For voice, start with Groq Whisper for ASR and Edge-TTS for TTS; switch to self-hosted Coqui when you need voice cloning. With one fallback per family, no single provider outage can take the product down.