aibridge

package
v2.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package aibridge provides utilities for the AI Bridge feature.

Index

Constants

View Source
const (
	ProviderCopilotBusiness   = "copilot-business"
	HostCopilotBusiness       = "api.business.githubcopilot.com"
	ProviderCopilotEnterprise = "copilot-enterprise"
	HostCopilotEnterprise     = "api.enterprise.githubcopilot.com"
)

Copilot provider.

View Source
const (
	ProviderChatGPT = "chatgpt"
	HostChatGPT     = "chatgpt.com"
	BaseURLChatGPT  = "https://" + HostChatGPT + "/backend-api/codex"
)

ChatGPT provider.

View Source
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.

View Source
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

func ExtractAuthToken(header http.Header) string

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.

func IsBYOK added in v2.32.0

func IsBYOK(header http.Header) bool

IsBYOK reports whether the request is using BYOK mode, determined by the presence of the X-Coder-AI-Governance-Token header.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL