Ollama
Ollama 是本地默认选项:一个 CLI、一个模型库、localhost:11434/v1 上的 OpenAI 兼容服务。`ollama pull llama3.3` 拉一次,之后当普通供应商调用。
Ollama 是本地默认选项:一个 CLI、一个模型库、localhost:11434/v1 上的 OpenAI 兼容服务。`ollama pull llama3.3` 拉一次,之后当普通供应商调用。
macOS、Linux、Windows。没有配额。除非你主动选择 Cloud,请求不会离开你的机器。想要图形界面选 LM Studio;想要生产级批处理选 vLLM。
- 最大上下文
- Whatever your RAM allows
- 免费额度
- 无限且私密
- 注册要求
- 什么都不用 —— 无账号
端点
接口地址
http://localhost:11434/v1速率限制
None — it is your machine- OpenAI 兼容
- 官方 SDK:Ollama SDK
- 文本
- 图像
- 代码
- 视觉
- 推理
代码示例
npm install openaiimport OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'http://localhost:11434/v1',
apiKey: 'not-needed'
})
const response = await client.chat.completions.create({
model: 'llama3.3',
messages: [{ role: 'user', content: 'Explain closures in one paragraph.' }]
})
console.log(response.choices[0].message.content)pip install openaifrom openai import OpenAI
client = OpenAI(
base_url="http://localhost:11434/v1",
api_key="not-needed",
)
response = client.chat.completions.create(
model="llama3.3",
messages=[{"role": "user", "content": "Explain closures in one paragraph."}],
)
print(response.choices[0].message.content)curl http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "llama3.3",
"messages": [{"role": "user", "content": "Explain closures in one paragraph."}]
}'npm install ollamaimport { Ollama } from 'ollama'
const ollama = new Ollama({ host: 'http://localhost:11434' })
const response = await ollama.chat({
model: 'llama3.3',
messages: [{ role: 'user', content: 'Explain closures in one paragraph.' }]
})
console.log(response.message.content)pip install ollamafrom ollama import Client
client = Client(host="http://localhost:11434")
response = client.chat(
model="llama3.3",
messages=[{"role": "user", "content": "Explain closures in one paragraph."}],
)
print(response["message"]["content"])值得注意
- 第一次请求之前,先跑一次 `ollama pull llama3.3`。
你能免费使用的模型5
- Llama 3.3 70B
llama-3.3-70b - Qwen 3
qwen3 - GPT-OSS 120B
gpt-oss-120b - DeepSeek R1
deepseek-ai/DeepSeek-R1 - DeepSeek V4
deepseek-v4-flash