Documentation
¶
Overview ¶
Package api provides an HTTP client for the Kimi Code Console backend.
Package api provides Kimi Code Console API service wrappers.
Package api contains request/response types for the Kimi Code Console API.
Index ¶
Constants ¶
const (
BaseURL = "https://www.kimi.com"
)
BaseURL is the Kimi Code Console API endpoint.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Balance ¶
type Balance struct {
ID string `json:"id"`
Feature string `json:"feature"`
Type string `json:"type"`
Unit string `json:"unit"`
AmountUsedRatio float64 `json:"amountUsedRatio"`
ExpireTime string `json:"expireTime"`
}
Balance shows usage ratio for a feature.
type BillingCycle ¶
BillingCycle describes how often a plan renews.
type Capability ¶
type Capability struct {
Feature string `json:"feature"`
Constraint Constraint `json:"constraint"`
}
Capability describes a feature and its constraint.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for the Kimi Code Console backend.
func NewClient ¶
NewClient creates a Client using the provided config, environment variables or JWT claims.
func (*Client) GetSubscription ¶
func (c *Client) GetSubscription(ctx context.Context) (*GetSubscriptionResponse, error)
GetSubscription fetches subscription, balances and capabilities.
type Constraint ¶
type Constraint struct {
Parallelism int `json:"parallelism"`
}
Constraint holds resource limits for a capability.
type GetSubscriptionResponse ¶
type GetSubscriptionResponse struct {
Subscription Subscription `json:"subscription"`
Balances []Balance `json:"balances"`
Subscribed bool `json:"subscribed"`
PurchaseSubscription Subscription `json:"purchaseSubscription"`
Capabilities []Capability `json:"capabilities"`
}
GetSubscriptionResponse is the response body for GetSubscription.
type GetUsagesRequest ¶
type GetUsagesRequest struct {
Scope []string `json:"scope"`
}
GetUsagesRequest is the request body for GetUsages.
type GetUsagesResponse ¶
type GetUsagesResponse struct {
Usages []Usage `json:"usages"`
}
GetUsagesResponse is the response body for GetUsages.
type Goods ¶
type Goods struct {
ID string `json:"id"`
Title string `json:"title"`
DurationDays int `json:"durationDays"`
UseRegion string `json:"useRegion"`
CreateTime string `json:"createTime"`
UpdateTime string `json:"updateTime"`
MembershipLevel string `json:"membershipLevel"`
Amounts []Amount `json:"amounts"`
BillingCycle BillingCycle `json:"billingCycle"`
}
Goods describes a subscription plan.
type LimitWindow ¶
LimitWindow describes the duration of a rate limit window.
type Subscription ¶
type Subscription struct {
SubscriptionID string `json:"subscriptionId"`
Goods Goods `json:"goods"`
SubscriptionTime string `json:"subscriptionTime"`
CurrentStartTime string `json:"currentStartTime"`
CurrentEndTime string `json:"currentEndTime"`
NextBillingTime string `json:"nextBillingTime"`
Status string `json:"status"`
PaymentChannel string `json:"paymentChannel"`
Type string `json:"type"`
Active bool `json:"active"`
}
Subscription contains current plan details.
type Usage ¶
type Usage struct {
Scope string `json:"scope"`
Detail UsageDetail `json:"detail"`
Limits []UsageLimit `json:"limits"`
}
Usage represents usage for a single feature scope.
type UsageDetail ¶
type UsageDetail struct {
Limit string `json:"limit"`
Remaining string `json:"remaining"`
ResetTime string `json:"resetTime"`
}
UsageDetail contains limit, remaining quota and reset time.
type UsageLimit ¶
type UsageLimit struct {
Window LimitWindow `json:"window"`
Detail UsageDetail `json:"detail"`
}
UsageLimit represents a rate limit window and its detail.