oauthproxy

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderCodex   = "codex"
	ProviderGemini  = "gemini"
	ProviderChatGPT = "chatgpt"
)

Variables

This section is empty.

Functions

func AuthDir

func AuthDir() (string, error)

func BackendProvider

func BackendProvider(providerName string) (string, error)

func ValidateLoginProvider

func ValidateLoginProvider(providerName string) (string, error)

ValidateLoginProvider returns the canonical public OAuth provider name. Codex remains an internal backend and a legacy runtime value, but new logins use the ChatGPT name because both routes authenticate the same account.

Types

type LoginOptions

type LoginOptions struct {
	NoBrowser    bool
	CallbackPort int
}

type LoginResult

type LoginResult struct {
	Provider string
	Backend  string
	Path     string
}

func Login

func Login(ctx context.Context, providerName string, opts LoginOptions) (LoginResult, error)

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func Start

func Start(parent context.Context, providerName string) (*Runtime, error)

func StartCodexAPI

func StartCodexAPI(parent context.Context, endpoint, upstreamAPIKey, modelSpec string) (*Runtime, error)

StartCodexAPI starts an embedded CLIProxyAPI runtime configured with a Responses/Codex API-key endpoint. CLIProxyAPI exposes Anthropic Messages and owns the full Claude-to-Responses translation in both directions.

func StartOAuth added in v1.3.4

func StartOAuth(parent context.Context, providerName, modelSpec string) (*Runtime, error)

func StartOpenAIChatAPI added in v1.3.4

func StartOpenAIChatAPI(parent context.Context, endpoint, upstreamAPIKey, modelSpec string) (*Runtime, error)

StartOpenAIChatAPI starts CLIProxyAPI with an OpenAI-compatible Chat Completions upstream. CLIProxyAPI owns both request and response translation.

func StartProvider added in v1.3.4

func StartProvider(parent context.Context, options StartOptions) (*Runtime, error)

StartProvider starts the embedded CLIProxyAPI adapter for every OpenAI-family provider. Claude Code connects directly to the runtime's /v1/messages route.

func (*Runtime) APIKey

func (r *Runtime) APIKey() string

func (*Runtime) ClaudeBaseURL added in v1.3.4

func (r *Runtime) ClaudeBaseURL() string

ClaudeBaseURL is the origin Claude Code uses before appending /v1/messages. Endpoint includes /v1 because ccl's model and diagnostics clients expect an OpenAI API root.

func (*Runtime) Endpoint

func (r *Runtime) Endpoint() string

func (*Runtime) Stop

func (r *Runtime) Stop()

type StartOptions added in v1.3.4

type StartOptions struct {
	Protocol      UpstreamProtocol
	Endpoint      string
	APIKey        string
	ModelSpec     string
	OAuthProvider string
}

type UpstreamProtocol added in v1.3.4

type UpstreamProtocol string
const (
	ProtocolOpenAIChat      UpstreamProtocol = "openai_chat"
	ProtocolOpenAIResponses UpstreamProtocol = "openai_responses"
)

Jump to

Keyboard shortcuts

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