Overview
Balance API Query the current user's account balance, can use and.
as (mm, image/video/audio) and Model (llm, Model); as (USD) and (CNY)., query in thewallets localized example text.
endpoint-endpointPath: /api/v2/open/balance
- RequestMethod: `GET`
- Authentication: Bearer Token (API Key)
Request Parameters
Headers
| Parameterlocalized example text | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer {API_KEY} |
Query Parameters
no## Response Format
Successlocalized example text```json { "code": 0, "msg": "success", "data": { "userId": "user@example.com", "balance": "100.50", "frozenBalance": "5.00", "currency": "USD", "wallets": [ { "currency": "USD", "balance": "100.50", "frozenBalance": "5.00", "wallet": "mm" }, { "currency": "CNY", "balance": "500.00", "frozenBalance": "0", "wallet": "mm" }, { "currency": "USD", "balance": "270", "frozenBalance": "0", "wallet": "llm" } ] } }
### fieldDescription| fieldlocalized example text| Type | Description |
|--------|------|------|
| userId | string | ID|
| balance | string | can use (field, Note)|
| frozenBalance | string | (field)|
| currency | string | as`USD` (field)|
| wallets | array | localized example text|
| wallets[].currency | string |:`USD` ()/`CNY` ()|
| wallets[].balance | string | can use|
| wallets[].frozenBalance | string | (`llm` as`0`) |
| wallets[].wallet | string | Type:`mm` ()/`llm` (Model)|
### Errorlocalized example text```json
{
"code": 10005,
"msg": "API Key no",
"data": null
}{
"code": 90003,
"msg": "query Failure",
"data": null
}Request Example
cURL
curl -X GET "https://mm-internal-cn.leonecloud.com/api/v2/open/balance" \
-H "Authorization: Bearer your_api_key_here"Python
import requests
url = "https://mm-internal-cn.leonecloud.com/api/v2/open/balance"
headers = {
"Authorization": "Bearer your_api_key_here"
}
data = requests.get(url, headers=headers).json()["data"]
for wallet in data["wallets"]:
print(wallet["wallet"], wallet["currency"], wallet["balance"])JavaScript
fetch('https://mm-internal-cn.leonecloud.com/api/v2/open/balance', {
method: 'GET',
headers: {
'Authorization': 'Bearer your_api_key_here'
}
}).then(response => response.json()).then(({ data }) => {
data.wallets.forEach(w => console.log(w.wallet, w.currency, w.balance));
});use Scenario
- query: in API first, Query Account Balance,
- localized example text: query, when and when
- localized example text: in task complete after query,## Note1. localized example text
wallets:localized example textbalance/frozenBalance/currencyas field, return, Model., field will return0/USD, inwalletsin - can:,, Model, and,.localized example text
wallet+currency3.wallets; not will in in the array ( will 0 return ).with whenwalletsas, return0 balancefirst can use,, nofrozenBalance- not complete task:taskSuccess after, taskFailure can use
- recommendedin API first query, Insufficient balancetaskFailure## Model (LLM)
- Model (LLM)Capability,
walletsin willwalletasllm, Model can use; not return. - Model
balance,; Model with,frozenBalanceas0. - Model and first「localized example text」/「localized example text」, in in.
Error CodesDescription
| Error Codes | Description | localized example text |
|---|---|---|
| 10005 | API Key invalid or missing | Authorization Format and API Key |
| 10004 | no | localized example text |
| 90003 | query Failure | after or Technical Support |