kimi

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package kimi provides token refresh for Kimi (Moonshot AI) credentials used by the scheduler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceFlowClient

type DeviceFlowClient struct {
	// contains filtered or unexported fields
}

DeviceFlowClient is a minimal Kimi OAuth client used for refresh-token exchange.

func NewDeviceFlowClientWithDeviceIDAndProxyURL

func NewDeviceFlowClientWithDeviceIDAndProxyURL(cfg *config.Config, deviceID string, proxyURL string) *DeviceFlowClient

NewDeviceFlowClientWithDeviceIDAndProxyURL creates a new refresh client with proxy override. proxyURL takes precedence over cfg.ProxyURL when non-empty.

func (*DeviceFlowClient) RefreshToken

func (c *DeviceFlowClient) RefreshToken(ctx context.Context, refreshToken string) (*KimiTokenData, error)

RefreshToken exchanges a refresh token for a new access token.

type KimiTokenData

type KimiTokenData struct {
	// AccessToken is the OAuth2 access token.
	AccessToken string `json:"access_token"`
	// RefreshToken is the OAuth2 refresh token.
	RefreshToken string `json:"refresh_token"`
	// TokenType is the type of token, typically "Bearer".
	TokenType string `json:"token_type"`
	// ExpiresAt is the Unix timestamp when the token expires.
	ExpiresAt int64 `json:"expires_at"`
	// Scope is the OAuth2 scope granted to the token.
	Scope string `json:"scope"`
}

KimiTokenData holds the raw OAuth token response from Kimi.

Jump to

Keyboard shortcuts

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