From 84b94a837621aa2b9a0d5350997edbc9fd6964c4 Mon Sep 17 00:00:00 2001 From: Yevhenii Shcherbina Date: Tue, 31 Mar 2026 12:54:38 -0400 Subject: [PATCH] feat: add chatgpt support for aibridge proxy (#23826) Add ChatGPT support for AIBridgeProxy --- cli/testdata/server-config.yaml.golden | 5 +++-- coderd/aibridge/aibridge.go | 3 ++- codersdk/deployment.go | 4 ++-- enterprise/aibridgeproxyd/aibridgeproxyd.go | 2 ++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cli/testdata/server-config.yaml.golden b/cli/testdata/server-config.yaml.golden index b44c6accb2..2da6b7918f 100644 --- a/cli/testdata/server-config.yaml.golden +++ b/cli/testdata/server-config.yaml.golden @@ -858,9 +858,9 @@ aibridgeproxy: # decrypted and routed through AI Bridge. Requests to other domains will be # tunneled directly without decryption. Supported domains: api.anthropic.com, # api.openai.com, api.individual.githubcopilot.com, - # api.business.githubcopilot.com, api.enterprise.githubcopilot.com. + # api.business.githubcopilot.com, api.enterprise.githubcopilot.com, chatgpt.com. # (default: - # api.anthropic.com,api.openai.com,api.individual.githubcopilot.com,api.business.githubcopilot.com,api.enterprise.githubcopilot.com, + # api.anthropic.com,api.openai.com,api.individual.githubcopilot.com,api.business.githubcopilot.com,api.enterprise.githubcopilot.com,chatgpt.com, # type: string-array) domain_allowlist: - api.anthropic.com @@ -868,6 +868,7 @@ aibridgeproxy: - api.individual.githubcopilot.com - api.business.githubcopilot.com - api.enterprise.githubcopilot.com + - chatgpt.com # URL of an upstream HTTP proxy to chain tunneled (non-allowlisted) requests # through. Format: http://[user:pass@]host:port or https://[user:pass@]host:port. # (default: , type: string) diff --git a/coderd/aibridge/aibridge.go b/coderd/aibridge/aibridge.go index d91efa7dbb..5c5d93ee0a 100644 --- a/coderd/aibridge/aibridge.go +++ b/coderd/aibridge/aibridge.go @@ -31,7 +31,8 @@ const ( // ChatGPT provider. const ( ProviderChatGPT = "chatgpt" - BaseURLChatGPT = "https://chatgpt.com/backend-api/codex" + HostChatGPT = "chatgpt.com" + BaseURLChatGPT = "https://" + HostChatGPT + "/backend-api/codex" ) // IsBYOK reports whether the request is using BYOK mode, determined diff --git a/codersdk/deployment.go b/codersdk/deployment.go index 3fa8c38266..b529ee9e42 100644 --- a/codersdk/deployment.go +++ b/codersdk/deployment.go @@ -3926,11 +3926,11 @@ Write out the current server config as YAML to stdout.`, Name: "AI Bridge Proxy Domain Allowlist", Description: "Comma-separated list of AI provider domains for which HTTPS traffic will be decrypted and routed through AI Bridge. " + "Requests to other domains will be tunneled directly without decryption. " + - "Supported domains: api.anthropic.com, api.openai.com, api.individual.githubcopilot.com, api.business.githubcopilot.com, api.enterprise.githubcopilot.com.", + "Supported domains: api.anthropic.com, api.openai.com, api.individual.githubcopilot.com, api.business.githubcopilot.com, api.enterprise.githubcopilot.com, chatgpt.com.", Flag: "aibridge-proxy-domain-allowlist", Env: "CODER_AIBRIDGE_PROXY_DOMAIN_ALLOWLIST", Value: &c.AI.BridgeProxyConfig.DomainAllowlist, - Default: "api.anthropic.com,api.openai.com,api.individual.githubcopilot.com,api.business.githubcopilot.com,api.enterprise.githubcopilot.com", + Default: "api.anthropic.com,api.openai.com,api.individual.githubcopilot.com,api.business.githubcopilot.com,api.enterprise.githubcopilot.com,chatgpt.com", Hidden: true, Group: &deploymentGroupAIBridgeProxy, YAML: "domain_allowlist", diff --git a/enterprise/aibridgeproxyd/aibridgeproxyd.go b/enterprise/aibridgeproxyd/aibridgeproxyd.go index 475e9a2f4a..720ebaff6b 100644 --- a/enterprise/aibridgeproxyd/aibridgeproxyd.go +++ b/enterprise/aibridgeproxyd/aibridgeproxyd.go @@ -780,6 +780,8 @@ func defaultAIBridgeProvider(host string) string { return agplaibridge.ProviderCopilotBusiness case agplaibridge.HostCopilotEnterprise: return agplaibridge.ProviderCopilotEnterprise + case agplaibridge.HostChatGPT: + return agplaibridge.ProviderChatGPT default: return "" }