oai

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 20 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 AuthFilePath

func AuthFilePath(workspace string) (string, error)

AuthFilePath returns the workspace-local token file path.

func AuthFilePathIn

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

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

func LoginBrowser

func LoginBrowser(ctx context.Context, workspace string, out io.Writer) (string, error)

LoginBrowser completes the local browser OAuth flow and saves the resulting token.

func LoginBrowserIn

func LoginBrowserIn(ctx context.Context, workspace, workDir string, out io.Writer) (string, error)

LoginBrowserIn completes the local browser OAuth flow and saves the resulting token in workDir.

func LoginDevice

func LoginDevice(ctx context.Context, workspace string, out io.Writer) (string, error)

LoginDevice completes the headless device OAuth flow and saves the resulting token.

func LoginDeviceIn

func LoginDeviceIn(ctx context.Context, workspace, workDir string, out io.Writer) (string, error)

LoginDeviceIn completes the headless device OAuth flow and saves the resulting token in workDir.

func NewChatGPTClient

func NewChatGPTClient(workspace string, opts ...option.RequestOption) (*openai.Client, error)

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 SaveToken

func SaveToken(workspace string, token Token) error

SaveToken writes the ChatGPT OAuth token with owner-only permissions.

func SaveTokenIn

func SaveTokenIn(workspace, workDir string, token Token) error

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 LoadToken

func LoadToken(workspace string) (Token, error)

LoadToken reads the persisted ChatGPT OAuth token.

func LoadTokenIn

func LoadTokenIn(workspace, workDir string) (Token, error)

LoadTokenIn reads the persisted ChatGPT OAuth token from workDir.

Jump to

Keyboard shortcuts

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