websearch: tavily provider returns 403 (key rejected via Bearer auth)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 80/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- api
调研方向
从 packages/core/src/plugin/websearch/tavily.ts 开始,该提供方目前发送的是 Authorization: Bearer <key>。将其与 Tavily 文档中在请求体中包含 api_key 的请求进行比较,并使用相同的已配置密钥复现 403。修复应切换到或回退到可接受的认证方式,并在认证失败时呈现更清晰的错误;完成意味着使用 tvly-dev- 密钥可以成功进行 Web 搜索。
由索引模型根据 Issue 内容生成。
描述
Summary
The built-in web search with provider tavily fails with HTTP 403 on every
search. The same API key works when sent as api_key in the request body, but
is rejected when sent as Authorization: Bearer <key> — which is how the
Tavily websearch provider sends it.
Environment
- opencode version: 2.4.1 (desktop app)
- OS: Windows 10.0.19045.6456 (win32 x64)
- websearch provider: tavily
- Tavily key:
tvly-dev-…(dev/free tier)
Reproduction
- Configure
websearch.provider = "tavily"and setTAVILY_API_KEY. - Ask the model to search the web.
- Observe:
Web search request failed (HTTP 403).
Expected Behavior
Web search returns results using the configured Tavily key.
Actual Behavior
Every search returns HTTP 403. Direct API tests with the same key (from the
same machine/IP) show:
POST https://api.tavily.com/searchwith{"api_key": "<key>", ...}
-> 200 OKPOST https://api.tavily.com/searchwith header
Authorization: Bearer <key>-> 403 Forbidden (HTML response)
The provider sends the key as a Bearer token
(packages/core/src/plugin/websearch/tavily.ts):
...(credential?.type === "key"
? { Authorization: `Bearer ${credential.key}` }
: { "X-Tavily-Access-Mode": "keyless" }),
So the 403 is Tavily rejecting Bearer auth for this key — not a network/VPN
issue and not an invalid key (the same key returns 200 via the body method).
Additional Context
- On another machine where only the Tavily MCP server is used (which sends the
key differently), no such error occurs. - A
tvly-dev-key may only support the legacyapi_key-in-body
authentication. If so, the provider could fall back to that method, or
surface a clearer error than a bare 403.
- 主要语言
- TypeScript
- 星标
- 228k
- 派生
- 31k
- 平均合并
- 3 小时 22 分钟
- 30 天内合并 PR
- 476
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
anomalyco/opencode 的其他 Issue
-
desktop: app-version.v1 in drafts.sqlite is never refreshed — reports 1.19.4 while running 2.3.2未关闭area/desktop platform/windows type/feature version/v2
难度 2/5 1-3 小时 新手友好度 66/100
anomalyco/opencode#66079 · 1 条评论 ·
维护者通常 1 天内回复
-
area/mcp platform/windows status/repro-simulated type/bug version/v2
难度 2/5 1-3 小时 新手友好度 72/100
anomalyco/opencode#66073 · 1 条评论 ·
维护者通常 1 天内回复
-
area/providers platform/windows type/feature version/v2
难度 2/5 1-3 小时 新手友好度 74/100
anomalyco/opencode#66001 · 1 条评论 ·
维护者通常 1 天内回复
-
area/mcp platform/windows type/feature version/v2
难度 2/5 1-3 小时 新手友好度 72/100
anomalyco/opencode#65997 · 1 条评论 ·
维护者通常 1 天内回复
-
@opencode/ui: v2-text-text-faint and light v2-state-fg-warning fall below WCAG AA 4.5:1 contrast可能已有人在做 @KhadeerBasha1232 今天认领。 未关闭status/repro-plausible
难度 2/5 1-3 小时 新手友好度 75/100
anomalyco/opencode#65923 · 2 条评论 ·
维护者通常 1 天内回复
查看 anomalyco/opencode 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
lidofinance/validator-ejector#233 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
ai-driven-qa bug claude Major
难度 2/5 1-3 小时 新手友好度 78/100
linagora/twake-mail-admin#742 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
OpenSlides/openslides-client#6728 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 66/100