| summary | Moonshot provider data sources: official API key + balance endpoint. | |||
|---|---|---|---|---|
| read_when |
|
Moonshot is API-only. CodexBar calls the official Moonshot balance endpoint and shows the available USD balance for the selected region.
This provider is intentionally separate from Kimi K2, which points at the third-party kimi-k2.ai service instead of Moonshot's official platform.
Official docs: https://platform.moonshot.ai/docs/api/balance
- API key stored in
~/.codexbar/config.jsonor supplied viaMOONSHOT_API_KEY/MOONSHOT_KEY. CodexBar stores the key in config after you paste it in Preferences → Providers → Moonshot. - Region stored in
~/.codexbar/config.json(providerConfig.moonshot.region) or supplied viaMOONSHOT_REGION. Supported values:internationalandchina. Default:international. - Balance endpoint
- International:
GET https://api.moonshot.ai/v1/users/me/balance - China:
GET https://api.moonshot.cn/v1/users/me/balance - Request headers:
Authorization: Bearer <api key>,Accept: application/json
- International:
Moonshot documents a stable JSON object:
{
"code": 0,
"data": {
"available_balance": 49.58,
"voucher_balance": 50.0,
"cash_balance": -0.42
}
}CodexBar displays:
Balance: $X.XXNo limit setcash_balancedeficits as... in deficitwhen the cash portion is negative
There is no session window, weekly window, or reset timestamp for Moonshot.
Sources/CodexBarCore/Providers/Moonshot/MoonshotProviderDescriptor.swiftSources/CodexBarCore/Providers/Moonshot/MoonshotUsageFetcher.swiftSources/CodexBarCore/Providers/Moonshot/MoonshotSettingsReader.swiftSources/CodexBar/Providers/Moonshot/MoonshotProviderImplementation.swiftSources/CodexBar/Providers/Moonshot/MoonshotSettingsStore.swift