Documentation
¶
Overview ¶
Package oai provides ChatGPT OAuth-backed OpenAI clients for rocketclaw.
Index ¶
- func AuthFilePath(workspace string) (string, error)
- func AuthFilePathIn(workspace, workDir string) (string, error)
- func LoginBrowser(ctx context.Context, workspace string, out io.Writer) (string, error)
- func LoginBrowserIn(ctx context.Context, workspace, workDir string, out io.Writer) (string, error)
- func LoginDevice(ctx context.Context, workspace string, out io.Writer) (string, error)
- func LoginDeviceIn(ctx context.Context, workspace, workDir string, out io.Writer) (string, error)
- func NewChatGPTClient(workspace string, opts ...option.RequestOption) (*openai.Client, error)
- func NewChatGPTClientIn(workspace, workDir string, opts ...option.RequestOption) (*openai.Client, error)
- func SaveToken(workspace string, token Token) error
- func SaveTokenIn(workspace, workDir string, token Token) error
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthFilePath ¶
AuthFilePath returns the workspace-local token file path.
func AuthFilePathIn ¶
AuthFilePathIn returns the workspace-local token file path in workDir.
func LoginBrowser ¶
LoginBrowser completes the local browser OAuth flow and saves the resulting token.
func LoginBrowserIn ¶
LoginBrowserIn completes the local browser OAuth flow and saves the resulting token in workDir.
func LoginDevice ¶
LoginDevice completes the headless device OAuth flow and saves the resulting token.
func LoginDeviceIn ¶
LoginDeviceIn completes the headless device OAuth flow and saves the resulting token in workDir.
func NewChatGPTClient ¶
NewChatGPTClient creates an OpenAI client that sends Responses API requests to ChatGPT Codex.
func NewChatGPTClientIn ¶
func NewChatGPTClientIn(workspace, workDir string, opts ...option.RequestOption) (*openai.Client, error)
NewChatGPTClientIn creates an OpenAI client that sends Responses API requests to ChatGPT Codex using workDir auth.
func SaveTokenIn ¶
SaveTokenIn writes the ChatGPT OAuth token to workDir with owner-only permissions.
Types ¶
type Token ¶
type Token struct {
Refresh string `json:"refresh"`
Access string `json:"access"`
Expires int64 `json:"expires"`
AccountID string `json:"account_id,omitempty"`
}
Token is the persisted ChatGPT OAuth credential used for Codex requests.
func LoadTokenIn ¶
LoadTokenIn reads the persisted ChatGPT OAuth token from workDir.