Documentation
¶
Overview ¶
Package aibridge provides utilities for the AI Bridge feature.
Index ¶
Constants ¶
const ( ProviderCopilotBusiness = "copilot-business" HostCopilotBusiness = "api.business.githubcopilot.com" ProviderCopilotEnterprise = "copilot-enterprise" HostCopilotEnterprise = "api.enterprise.githubcopilot.com" )
Copilot provider.
const ( ProviderChatGPT = "chatgpt" HostChatGPT = "chatgpt.com" BaseURLChatGPT = "https://" + HostChatGPT + "/backend-api/codex" )
ChatGPT provider.
const HeaderCoderRequestID = "X-Coder-AI-Governance-Request-Id"
HeaderCoderRequestID is a header set by aibridgeproxyd on each request forwarded to aibridged for cross-service log correlation.
const HeaderCoderToken = "X-Coder-AI-Governance-Token" //nolint:gosec // This is a header name, not a credential.
HeaderCoderToken is a header set by clients opting into BYOK (Bring Your Own Key) mode. It carries the Coder token so that Authorization and X-Api-Key can carry the user's own LLM credentials. When present, AI Bridge forwards the user's LLM headers unchanged instead of injecting the centralized key.
The AI Bridge proxy also sets this header automatically for clients that use per-user LLM credentials but cannot set custom headers.
Variables ¶
This section is empty.
Functions ¶
func ExtractAuthToken ¶
ExtractAuthToken extracts a token from HTTP headers. It checks the BYOK header first (set by clients opting into BYOK), then falls back to Authorization: Bearer and X-Api-Key for direct centralized mode. If none are present, an empty string is returned.
Types ¶
This section is empty.