Skip to content

feat(providers): allow per-provider HTTP/SOCKS proxy for LLM traffic - #1314

Closed
dxiaom wants to merge 1 commit into
TencentCloud:mainfrom
dxiaom:feat/provider-proxy
Closed

dxiaom wants to merge 1 commit into
TencentCloud:mainfrom
dxiaom:feat/provider-proxy

Conversation

@dxiaom

@dxiaom dxiaom commented Sep 29, 2026

Copy link
Copy Markdown

Summary

Allow each LLM provider to route its traffic through its own HTTP/SOCKS proxy, without affecting other providers or the process environment.

Motivation

Some deployments need only a specific model vendor's endpoint to go through a proxy (e.g. to reach a geo-restricted API or reuse an existing corporate egress). There was no per-provider proxy option: HTTP(S)_PROXY env vars are global, and the proxy field added in octop-harness #21 was never surfaced through the provider config.

Changes

  • Backend
    • infra/agents/providers/store.py: parse extra_json.proxy from the provider row and forward it to the harness ProviderConfig
    • infra/agents/providers/probe.py: connectivity probes and remote model fetching also honor the proxy (provider_proxy() helper)
    • api/routers/providers.py: return extra_json in the providers API so the UI can render current proxy
  • Dashboard
    • "HTTP Proxy" input in the provider create/edit forms (stored in extra_json.proxy, no DB schema change)
    • "Test connection" and "Fetch models" include the proxy so drafts are validated through the same path
  • Dependencies
    • httpx[socks] added so socks5:///socks4:// proxies work out of the box

Notes

  • No DB migration: proxy lives in the existing extra_json column.
  • Depends on the octop-harness companion PR exposing ProviderConfig.proxy.

Test

  • Created a provider with extra_json={"proxy":"socks5://..."}; ProviderStore.build_harness_configs() shows proxy populated and the ChatOpenAI transport mounts a SOCKS pool.
  • Anthropic providers use the built-in anthropic_proxy.
  • PATCH round-trips the field; empty proxy removes it without touching other extra_json keys.

@dxiaom
dxiaom force-pushed the feat/provider-proxy branch from e2330b2 to 176e0fd Compare September 30, 2026 05:19
Route the LLM requests of a single provider through an optional proxy
without affecting other providers or the process-wide env vars:
- store extra_json.proxy on the provider row and forward it to the
  harness ProviderConfig (works with the octop-harness proxy field)
- connectivity probes and remote model fetching also honor the proxy
- return extra_json from the providers API so the UI can render it
- dashboard: HTTP Proxy input in provider create/edit forms; test
  connection and fetch-models requests carry the proxy
- add httpx[socks] so SOCKS proxy URLs work out of the box

No DB schema change: proxy lives in the existing extra_json column.
@dxiaom
dxiaom force-pushed the feat/provider-proxy branch from 176e0fd to c4c551c Compare October 19, 2026 10:30
@jubaoliang

Copy link
Copy Markdown
Collaborator

GitHub PR 提交规范

✅ PR 必备清单

1. 📸 提供视觉证明(截图/录屏)

必须贴截图,无论放在 PR 描述中还是评论里——让 reviewer 看到"人",证明是经过人工检查、用心完成的。

2. 🧪 测试用例完整 & CI 通过

  • ✅ 新增功能 → 新增对应测试
  • ✅ Bug 修复 → 添加回归测试
  • ✅ 所有 CI Workflow 必须通过 → 不要期望 reviewer 去 fix 你的 CI

3. 🔄 与 AI 协作:确认理解一致

  • 需求明确后,让 AI 重复一遍需求,确认理解无误
  • 代码生成后,主动追问:
    • "这个实现是否满足所有需求点?"
    • "是否有遗漏的场景?"

4. 🎯 代码质量:最小修改 & 追问优化

  • 坚守最小修改原则,一个 PR 只解决一个问题
  • AI 生成代码后,必问:
    • 是否还有优化空间?
    • 所有异常是否妥善处理?
    • 是否有冗余代码?

📋 Quick Checklist(可直接放进 PR 模板)

- [ ] 📸 已提供 UI 截图/功能演示
- [ ] 🧱 测试用例已添加并通过
- [ ] ✅ CI Workflow 全部通过
- [ ] 🤖 已与 AI 对齐需求理解
- [ ] 🎯 遵循最小修改原则,代码结构清晰
- [ ] 📝 已询问并处理代码优化建议

核心原则:PR 是沟通,不是交接。让 reviewer 轻松,就是让自己更快合入。


🔍 本 PR 自动检查发现的问题

  • 📸 本 PR 涉及前端改动,但描述中未提供截图/录屏等视觉证明
  • 🧱 未检测到测试文件变更:新增功能请补充对应测试,Bug 修复请补充回归测试

以上为 automated 检查提示,请补充后 @ 我重新评审。

@jubaoliang

Copy link
Copy Markdown
Collaborator

请把这个变更重新提交到 develop。功能修改和问题修复都要指向 develop,不要直接指向 main。

Please open this change against develop instead of main.

@jubaoliang jubaoliang closed this Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants