Documentation
¶
Overview ¶
Package oai provides ChatGPT OAuth-backed OpenAI clients for rocketclaw.
Index ¶
- func AuthFilePathIn(workspace, runtimeDir string) (string, error)
- func LoginBrowserIn(ctx context.Context, workspace, runtimeDir string, out io.Writer) (string, error)
- func LoginDeviceIn(ctx context.Context, workspace, runtimeDir string, out io.Writer) (string, error)
- func NewChatGPTClientIn(workspace, runtimeDir string, opts ...option.RequestOption) (*openai.Client, error)
- func SaveTokenIn(workspace, runtimeDir string, token Token) error
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthFilePathIn ¶
AuthFilePathIn returns the workspace-local token file path in runtimeDir.
func LoginBrowserIn ¶
func LoginBrowserIn(ctx context.Context, workspace, runtimeDir string, out io.Writer) (string, error)
LoginBrowserIn completes the local browser OAuth flow and saves the resulting token in runtimeDir.
func LoginDeviceIn ¶
func LoginDeviceIn(ctx context.Context, workspace, runtimeDir string, out io.Writer) (string, error)
LoginDeviceIn completes the headless device OAuth flow and saves the resulting token in runtimeDir.
func NewChatGPTClientIn ¶
func NewChatGPTClientIn(workspace, runtimeDir string, opts ...option.RequestOption) (*openai.Client, error)
NewChatGPTClientIn creates an OpenAI client that sends Responses API requests to ChatGPT Codex using runtimeDir auth.
func SaveTokenIn ¶
SaveTokenIn writes the ChatGPT OAuth token to runtimeDir 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 runtimeDir.