oai

package
v0.0.45 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package oai provides ChatGPT OAuth-backed OpenAI clients for rocketclaw.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthFilePathIn

func AuthFilePathIn(workspace, runtimeDir string) (string, error)

AuthFilePathIn returns the workspace-local token file path in runtimeDir.

func HasTokenIn added in v0.0.42

func HasTokenIn(workspace, runtimeDir, provider string) (bool, error)

HasTokenIn reports whether the provider has a persisted ChatGPT OAuth token.

func LoginBrowserIn

func LoginBrowserIn(ctx context.Context, workspace, runtimeDir, provider 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, provider 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, provider string, opts ...option.RequestOption) (*openai.Client, error)

NewChatGPTClientIn creates an OpenAI client that sends Responses API requests to ChatGPT Codex using runtimeDir auth.

func RemoveTokenIn added in v0.0.42

func RemoveTokenIn(workspace, runtimeDir, provider string) error

RemoveTokenIn removes only the provider's persisted ChatGPT OAuth token.

func SaveTokenIn

func SaveTokenIn(workspace, runtimeDir, provider string, token Token) error

SaveTokenIn writes the provider's ChatGPT OAuth token.

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 AcquireBrowserToken added in v0.0.42

func AcquireBrowserToken(ctx context.Context, out io.Writer) (Token, error)

AcquireBrowserToken completes the local browser OAuth flow without persisting the token.

func AcquireDeviceToken added in v0.0.42

func AcquireDeviceToken(ctx context.Context, out io.Writer) (Token, error)

AcquireDeviceToken completes the headless device OAuth flow without persisting the token.

func LoadTokenIn

func LoadTokenIn(workspace, runtimeDir, provider string) (Token, error)

LoadTokenIn reads the provider's persisted ChatGPT OAuth token from runtimeDir.

Jump to

Keyboard shortcuts

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