Skip to content

Conversation

@ssncferreira
Copy link
Contributor

@ssncferreira ssncferreira commented Dec 19, 2025

Description

Implements request routing for the AI Bridge Proxy. After MITM decryption, requests to known AI providers (Anthropic, OpenAI) are rewritten to the corresponding aibridged endpoint, while requests to unknown hosts are passed through to their original destination.

Changes

  • Add CoderAccessURL configuration option for specifying the Coder deployment URL
  • Add handleRequest to route decrypted requests based on target host
  • Route known AI providers (Anthropic and OpenAI) to AI Bridge specific endpoint.
  • Passthrough requests to unknown hosts directly to their original destination
  • Inject Coder session token (from feat: add proxy authorization to aibridgeproxyd #21342) as Authorization: Bearer header for aibridged
  • Add tests for routing and passthrough behavior

Depends on: #21342
Closes: coder/internal#1181

Copy link
Contributor Author

ssncferreira commented Dec 19, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-routing branch 2 times, most recently from bc4caed to 97198d5 Compare December 23, 2025 13:11
@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-proxy-authorization branch from 88a304c to 56e1c5c Compare December 23, 2025 13:26
@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-routing branch 4 times, most recently from b82c306 to 5e6a35c Compare December 23, 2025 20:07
@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-proxy-authorization branch from 4157564 to ac0129f Compare December 23, 2025 21:49
@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-routing branch from 5a1d2dc to 4196397 Compare December 23, 2025 21:49
@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-proxy-authorization branch from ac0129f to ae82ddd Compare December 23, 2025 21:52
@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-routing branch 3 times, most recently from 644e954 to 4654e31 Compare December 23, 2025 22:21
@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-proxy-authorization branch from 176e7e7 to 097fbc9 Compare December 23, 2025 22:21
@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-proxy-authorization branch from 097fbc9 to 7145548 Compare December 23, 2025 22:43
@ssncferreira ssncferreira force-pushed the ssncferreira/feat-aiproxy-routing branch from 4654e31 to e0906db Compare December 23, 2025 22:43
Comment on lines +25 to 28
const (
HostAnthropic = "api.anthropic.com"
HostOpenAI = "api.openai.com"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why these need to be consts? I only see a single usage of each?

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.

3 participants