Documentation
¶
Index ¶
- func ParseAPIError(err error) (statusCode int, body string, ok bool)
- type Client
- func (c *Client) APIType() []utils.APIType
- func (c *Client) Chat(req *api.Request) (*http.Response, error)
- func (c *Client) FetchQuota(ctx context.Context, credentialID, accessToken string) (*codexutils.Quota, error)
- func (c *Client) HandlerType() utils.HandlerType
- func (c *Client) RefreshAccessToken(ctx context.Context, refreshToken string) (*codexutils.CodexTokenData, bool, error)
- func (c *Client) ReplaceModel(body []byte, model string) []byte
- func (c *Client) SetSettingsProvider(provider settings.Provider)
- type RTResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// OnQuota 响应头配额回调,Responses 每次收到响应后自动解析并调用
OnQuota func(ctx context.Context, credentialID string, q *codexutils.Quota)
// contains filtered or unexported fields
}
func (*Client) Chat ¶
Chat 向上游 Codex API 发送请求,返回原始 *http.Response(调用方负责关闭 Body) headers 应已包含认证头(Authorization, Chatgpt-Account-Id 等),由调用方负责组合 OnBeforeRequest 最终强制 User-Agent 等默认头
func (*Client) FetchQuota ¶
func (*Client) HandlerType ¶
func (c *Client) HandlerType() utils.HandlerType
func (*Client) RefreshAccessToken ¶
func (c *Client) RefreshAccessToken(ctx context.Context, refreshToken string) (*codexutils.CodexTokenData, bool, error)
func (*Client) SetSettingsProvider ¶
Click to show internal directories.
Click to hide internal directories.