Skip to content

[Bug] 使用本地 Ollama (OpenAI 兼容端点) 时提示 "no API key configured" 错误 #109

@mikelix

Description

@mikelix

问题描述:
我在 Windows 11 (WSL2 Ubuntu) 环境下尝试通过 PicoClaw 对接本地运行的 Ollama。虽然 picoclaw status 显示 Provider 已配置,但在执行 agent 命令时,程序无法正确识别本地配置,报错提示缺少 API Key。

环境信息:
操作系统: Windows 11 + WSL2 (Ubuntu 22.04/24.04)

PicoClaw 版本: v0.1.0
本地 LLM 服务: Ollama (运行于 Windows 或 WSL2)

使用的模型: qwen2.5:3b-16k
复现步骤:

确认 Ollama 正常运行在 http://127.0.0.1:11434/v1。执行 curl http://127.0.0.1:11434/v1/models 能正常返回模型列表。

在 ~/.picoclaw/config.json 中配置 openai 或 vllm provider,指向上述 Ollama 地址。

运行命令: picoclaw agent -m "hello"

预期行为:
Agent 应该识别出该模型属于配置好的本地 OpenAI 兼容 Provider,并跳过 API Key 检查(或使用配置文件中提供的 dummy key)。

实际行为:
终端返回错误:
Error creating provider: no API key configured for model: qwen2.5:3b-16k

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions