[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"docs-nav-zh":3,"docs-zh-usage-and-balance\u002Fusage":167,"$fSRN_mKjqqQsF02yS_C6c1S2dq-mVBwql42EWzRJe6Bg":1066},[4,52,69,92,142,159,163],{"title":5,"path":6,"stem":7,"children":8,"page":-1},"快速开始","\u002Fgetting-started","1.getting-started",[9,12,30,44,48],{"title":10,"path":6,"stem":11},"关于 SilvaMux","1.getting-started\u002Findex",{"title":13,"path":14,"stem":15,"children":16,"page":-1},"首次调用千木 API","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F1.quick-start\u002Findex",[17,18,22,26],{"title":13,"path":14,"stem":15},{"title":19,"path":20,"stem":21},"项目和账户设置","\u002Fgetting-started\u002Fquick-start\u002Fproject-and-account","1.getting-started\u002F1.quick-start\u002F2.project-and-account",{"title":23,"path":24,"stem":25},"获取 API Key","\u002Fgetting-started\u002Fquick-start\u002Fapi-key","1.getting-started\u002F1.quick-start\u002F3.api-key",{"title":27,"path":28,"stem":29},"第一个请求","\u002Fgetting-started\u002Fquick-start\u002Ffirst-request","1.getting-started\u002F1.quick-start\u002F4.first-request",{"title":31,"path":32,"stem":33,"children":34,"page":43},"模型与体验","\u002Fgetting-started\u002Fmodels-and-experience","1.getting-started\u002F2.models-and-experience",[35,39],{"title":36,"path":37,"stem":38},"模型选择","\u002Fgetting-started\u002Fmodels-and-experience\u002Fmodel-selection","1.getting-started\u002F2.models-and-experience\u002F1.model-selection",{"title":40,"path":41,"stem":42},"在线体验","\u002Fgetting-started\u002Fmodels-and-experience\u002Fplayground","1.getting-started\u002F2.models-and-experience\u002F2.playground",false,{"title":45,"path":46,"stem":47},"限流","\u002Fgetting-started\u002Frate-limits","1.getting-started\u002F3.rate-limits",{"title":49,"path":50,"stem":51},"常见问题","\u002Fgetting-started\u002Ffaq","1.getting-started\u002F4.faq",{"title":53,"path":54,"stem":55,"children":56,"page":43},"产品计费","\u002Fbilling","2.billing",[57,61,65],{"title":58,"path":59,"stem":60},"计费说明","\u002Fbilling\u002Foverview","2.billing\u002F1.overview",{"title":62,"path":63,"stem":64},"在线充值","\u002Fbilling\u002Frecharge","2.billing\u002F2.recharge",{"title":66,"path":67,"stem":68},"账单、用量与导出","\u002Fbilling\u002Fusage-export","2.billing\u002F3.usage-export",{"title":70,"path":71,"stem":72,"children":73,"page":43},"Coding Plan","\u002Fcoding-plan","3.coding-plan",[74,78],{"title":75,"path":76,"stem":77},"Coding Plan 概述","\u002Fcoding-plan\u002Foverview","3.coding-plan\u002F1.overview",{"title":79,"path":80,"stem":81,"children":82,"page":-1},"个人版","\u002Fcoding-plan\u002Fpersonal","3.coding-plan\u002F2.personal\u002Findex",[83,85,89],{"title":84,"path":80,"stem":81},"价格和权益",{"title":86,"path":87,"stem":88},"快速接入","\u002Fcoding-plan\u002Fpersonal\u002Fquick-start","3.coding-plan\u002F2.personal\u002F2.quick-start",{"title":49,"path":90,"stem":91},"\u002Fcoding-plan\u002Fpersonal\u002Ffaq","3.coding-plan\u002F2.personal\u002F3.faq",{"title":93,"path":94,"stem":95,"children":96,"page":43},"模型接口","\u002Fmodels","4.models",[97,130],{"title":98,"path":99,"stem":100,"children":101,"page":43},"文本生成","\u002Fmodels\u002Fchat","4.models\u002F1.chat",[102,106,110,114,118,122,126],{"title":103,"path":104,"stem":105},"概述","\u002Fmodels\u002Fchat\u002Foverview","4.models\u002F1.chat\u002F1.overview",{"title":107,"path":108,"stem":109},"OpenAI 兼容接口","\u002Fmodels\u002Fchat\u002Fopenai","4.models\u002F1.chat\u002F2.openai",{"title":111,"path":112,"stem":113},"Anthropic 兼容","\u002Fmodels\u002Fchat\u002Fanthropic","4.models\u002F1.chat\u002F3.anthropic",{"title":115,"path":116,"stem":117},"Volcengine 兼容","\u002Fmodels\u002Fchat\u002Fvolcengine","4.models\u002F1.chat\u002F4.volcengine",{"title":119,"path":120,"stem":121},"智谱兼容","\u002Fmodels\u002Fchat\u002Fzhipu","4.models\u002F1.chat\u002F5.zhipu",{"title":123,"path":124,"stem":125},"SilvaMux 统一入口","\u002Fmodels\u002Fchat\u002Funified","4.models\u002F1.chat\u002F6.unified",{"title":127,"path":128,"stem":129},"多模态输入","\u002Fmodels\u002Fchat\u002Fmultimodal","4.models\u002F1.chat\u002F7.multimodal",{"title":131,"path":132,"stem":133,"children":134,"page":43},"图片生成","\u002Fmodels\u002Fimages","4.models\u002F2.images",[135,138],{"title":103,"path":136,"stem":137},"\u002Fmodels\u002Fimages\u002Foverview","4.models\u002F2.images\u002F1.overview",{"title":139,"path":140,"stem":141},"图片生成接口","\u002Fmodels\u002Fimages\u002Fgeneration","4.models\u002F2.images\u002F2.generation",{"title":143,"path":144,"stem":145,"children":146,"page":43},"用量与余额","\u002Fusage-and-balance","5.usage-and-balance",[147,151,155],{"title":148,"path":149,"stem":150},"查询余额","\u002Fusage-and-balance\u002Fbalance","5.usage-and-balance\u002F1.balance",{"title":152,"path":153,"stem":154},"查询用量","\u002Fusage-and-balance\u002Fusage","5.usage-and-balance\u002F2.usage",{"title":156,"path":157,"stem":158},"查询单次请求消耗","\u002Fusage-and-balance\u002Frequest-usage","5.usage-and-balance\u002F3.request-usage",{"title":160,"path":161,"stem":162},"错误码参考","\u002Ferrors","6.errors",{"title":164,"path":165,"stem":166},"文档首页","\u002F","index",{"id":168,"title":152,"body":169,"description":1059,"extension":1060,"meta":1061,"navigation":317,"path":153,"rawbody":1062,"requiredFlags":1063,"seo":1064,"stem":154,"__hash__":1065},"docs\u002F5.usage-and-balance\u002F2.usage.md",{"type":170,"value":171,"toc":1051},"minimark",[172,175,179,183,186,197,200,205,209,236,239,612,615,917,971,974,1047],[173,174,152],"h1",{"id":152},[176,177,178],"p",{},"返回指定时间段内、该 API Key 所属项目的消耗汇总：总额与按模型分项。消耗数据自动限定到 Key 所属的项目，不能跨项目查询。",[180,181,182],"h2",{"id":182},"鉴权",[176,184,185],{},"在请求头携带 API Key：",[187,188,193],"pre",{"className":189,"code":191,"language":192},[190],"language-text","Authorization: Bearer sk_live_YOUR_API_KEY\n","text",[194,195,191],"code",{"__ignoreMap":196},"",[180,198,199],{"id":199},"接口",[201,202],"api-endpoint",{"method":203,"path":204},"GET","\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage",[206,207,208],"h3",{"id":208},"参数",[210,211,212,233],"ul",{},[213,214,215,218,219,222,223,226,227,229,230,232],"li",{},[194,216,217],{},"from","、",[194,220,221],{},"to","：必填，RFC3339 时间，左闭右开 ",[194,224,225],{},"[from, to)","，",[194,228,217],{}," 必须早于 ",[194,231,221],{},"。",[213,234,235],{},"时间范围以 UTC 为准。",[206,237,238],{"id":238},"示例",[240,241,242,286,379,457],"code-tabs",{},[243,244,246],"code-tab",{"label":245},"cURL",[187,247,251],{"className":248,"code":249,"language":250,"meta":196,"style":196},"language-bash shiki shiki-themes github-light github-dark","curl \"https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage?from=2026-07-08T00:00:00Z&to=2026-07-09T00:00:00Z\" \\\n  -H \"Authorization: Bearer $SILVAMUX_API_KEY\"\n","bash",[194,252,253,270],{"__ignoreMap":196},[254,255,258,262,266],"span",{"class":256,"line":257},"line",1,[254,259,261],{"class":260},"sScJk","curl",[254,263,265],{"class":264},"sZZnC"," \"https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage?from=2026-07-08T00:00:00Z&to=2026-07-09T00:00:00Z\"",[254,267,269],{"class":268},"sj4cs"," \\\n",[254,271,273,276,279,283],{"class":256,"line":272},2,[254,274,275],{"class":268},"  -H",[254,277,278],{"class":264}," \"Authorization: Bearer ",[254,280,282],{"class":281},"sVt8B","$SILVAMUX_API_KEY",[254,284,285],{"class":264},"\"\n",[243,287,289],{"label":288},"Python",[187,290,294],{"className":291,"code":292,"language":293,"meta":196,"style":196},"language-python shiki shiki-themes github-light github-dark","# pip install requests\nimport os\nimport requests\n\nresp = requests.get(\n    \"https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage\",\n    params={\n        \"from\": \"2026-07-08T00:00:00Z\",\n        \"to\": \"2026-07-09T00:00:00Z\",\n    },\n    headers={\"Authorization\": f\"Bearer {os.environ['SILVAMUX_API_KEY']}\"},\n)\nresp.raise_for_status()\nprint(resp.json()[\"totals\"])\n","python",[194,295,296,301,306,312,319,325,331,337,343,349,355,361,367,373],{"__ignoreMap":196},[254,297,298],{"class":256,"line":257},[254,299,300],{},"# pip install requests\n",[254,302,303],{"class":256,"line":272},[254,304,305],{},"import os\n",[254,307,309],{"class":256,"line":308},3,[254,310,311],{},"import requests\n",[254,313,315],{"class":256,"line":314},4,[254,316,318],{"emptyLinePlaceholder":317},true,"\n",[254,320,322],{"class":256,"line":321},5,[254,323,324],{},"resp = requests.get(\n",[254,326,328],{"class":256,"line":327},6,[254,329,330],{},"    \"https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage\",\n",[254,332,334],{"class":256,"line":333},7,[254,335,336],{},"    params={\n",[254,338,340],{"class":256,"line":339},8,[254,341,342],{},"        \"from\": \"2026-07-08T00:00:00Z\",\n",[254,344,346],{"class":256,"line":345},9,[254,347,348],{},"        \"to\": \"2026-07-09T00:00:00Z\",\n",[254,350,352],{"class":256,"line":351},10,[254,353,354],{},"    },\n",[254,356,358],{"class":256,"line":357},11,[254,359,360],{},"    headers={\"Authorization\": f\"Bearer {os.environ['SILVAMUX_API_KEY']}\"},\n",[254,362,364],{"class":256,"line":363},12,[254,365,366],{},")\n",[254,368,370],{"class":256,"line":369},13,[254,371,372],{},"resp.raise_for_status()\n",[254,374,376],{"class":256,"line":375},14,[254,377,378],{},"print(resp.json()[\"totals\"])\n",[243,380,382],{"label":381},"JavaScript",[187,383,387],{"className":384,"code":385,"language":386,"meta":196,"style":196},"language-javascript shiki shiki-themes github-light github-dark","\u002F\u002F Node 18+（内置 fetch）\nconst from = \"2026-07-08T00:00:00Z\";\nconst to = \"2026-07-09T00:00:00Z\";\nconst query = new URLSearchParams({ from, to });\n\nconst resp = await fetch(\n  `https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage?${query}`,\n  {\n    headers: { Authorization: `Bearer ${process.env.SILVAMUX_API_KEY}` },\n  },\n);\n\nconst data = await resp.json();\nconsole.log(data.totals);\n","javascript",[194,388,389,394,399,404,409,413,418,423,428,433,438,443,447,452],{"__ignoreMap":196},[254,390,391],{"class":256,"line":257},[254,392,393],{},"\u002F\u002F Node 18+（内置 fetch）\n",[254,395,396],{"class":256,"line":272},[254,397,398],{},"const from = \"2026-07-08T00:00:00Z\";\n",[254,400,401],{"class":256,"line":308},[254,402,403],{},"const to = \"2026-07-09T00:00:00Z\";\n",[254,405,406],{"class":256,"line":314},[254,407,408],{},"const query = new URLSearchParams({ from, to });\n",[254,410,411],{"class":256,"line":321},[254,412,318],{"emptyLinePlaceholder":317},[254,414,415],{"class":256,"line":327},[254,416,417],{},"const resp = await fetch(\n",[254,419,420],{"class":256,"line":333},[254,421,422],{},"  `https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage?${query}`,\n",[254,424,425],{"class":256,"line":339},[254,426,427],{},"  {\n",[254,429,430],{"class":256,"line":345},[254,431,432],{},"    headers: { Authorization: `Bearer ${process.env.SILVAMUX_API_KEY}` },\n",[254,434,435],{"class":256,"line":351},[254,436,437],{},"  },\n",[254,439,440],{"class":256,"line":357},[254,441,442],{},");\n",[254,444,445],{"class":256,"line":363},[254,446,318],{"emptyLinePlaceholder":317},[254,448,449],{"class":256,"line":369},[254,450,451],{},"const data = await resp.json();\n",[254,453,454],{"class":256,"line":375},[254,455,456],{},"console.log(data.totals);\n",[243,458,460],{"label":459},"Go",[187,461,465],{"className":462,"code":463,"language":464,"meta":196,"style":196},"language-go shiki shiki-themes github-light github-dark","\u002F\u002F 仅依赖标准库\npackage main\n\nimport (\n    \"fmt\"\n    \"io\"\n    \"net\u002Fhttp\"\n    \"os\"\n)\n\nfunc main() {\n    url := \"https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage?from=2026-07-08T00:00:00Z&to=2026-07-09T00:00:00Z\"\n\n    req, err := http.NewRequest(\"GET\", url, nil)\n    if err != nil {\n        panic(err)\n    }\n    req.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"SILVAMUX_API_KEY\"))\n\n    resp, err := http.DefaultClient.Do(req)\n    if err != nil {\n        panic(err)\n    }\n    defer resp.Body.Close()\n\n    body, _ := io.ReadAll(resp.Body)\n    fmt.Println(string(body))\n}\n","go",[194,466,467,472,477,481,486,491,496,501,506,510,514,519,524,528,533,539,545,551,557,562,568,573,578,583,589,594,600,606],{"__ignoreMap":196},[254,468,469],{"class":256,"line":257},[254,470,471],{},"\u002F\u002F 仅依赖标准库\n",[254,473,474],{"class":256,"line":272},[254,475,476],{},"package main\n",[254,478,479],{"class":256,"line":308},[254,480,318],{"emptyLinePlaceholder":317},[254,482,483],{"class":256,"line":314},[254,484,485],{},"import (\n",[254,487,488],{"class":256,"line":321},[254,489,490],{},"    \"fmt\"\n",[254,492,493],{"class":256,"line":327},[254,494,495],{},"    \"io\"\n",[254,497,498],{"class":256,"line":333},[254,499,500],{},"    \"net\u002Fhttp\"\n",[254,502,503],{"class":256,"line":339},[254,504,505],{},"    \"os\"\n",[254,507,508],{"class":256,"line":345},[254,509,366],{},[254,511,512],{"class":256,"line":351},[254,513,318],{"emptyLinePlaceholder":317},[254,515,516],{"class":256,"line":357},[254,517,518],{},"func main() {\n",[254,520,521],{"class":256,"line":363},[254,522,523],{},"    url := \"https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage?from=2026-07-08T00:00:00Z&to=2026-07-09T00:00:00Z\"\n",[254,525,526],{"class":256,"line":369},[254,527,318],{"emptyLinePlaceholder":317},[254,529,530],{"class":256,"line":375},[254,531,532],{},"    req, err := http.NewRequest(\"GET\", url, nil)\n",[254,534,536],{"class":256,"line":535},15,[254,537,538],{},"    if err != nil {\n",[254,540,542],{"class":256,"line":541},16,[254,543,544],{},"        panic(err)\n",[254,546,548],{"class":256,"line":547},17,[254,549,550],{},"    }\n",[254,552,554],{"class":256,"line":553},18,[254,555,556],{},"    req.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"SILVAMUX_API_KEY\"))\n",[254,558,560],{"class":256,"line":559},19,[254,561,318],{"emptyLinePlaceholder":317},[254,563,565],{"class":256,"line":564},20,[254,566,567],{},"    resp, err := http.DefaultClient.Do(req)\n",[254,569,571],{"class":256,"line":570},21,[254,572,538],{},[254,574,576],{"class":256,"line":575},22,[254,577,544],{},[254,579,581],{"class":256,"line":580},23,[254,582,550],{},[254,584,586],{"class":256,"line":585},24,[254,587,588],{},"    defer resp.Body.Close()\n",[254,590,592],{"class":256,"line":591},25,[254,593,318],{"emptyLinePlaceholder":317},[254,595,597],{"class":256,"line":596},26,[254,598,599],{},"    body, _ := io.ReadAll(resp.Body)\n",[254,601,603],{"class":256,"line":602},27,[254,604,605],{},"    fmt.Println(string(body))\n",[254,607,609],{"class":256,"line":608},28,[254,610,611],{},"}\n",[176,613,614],{},"响应：",[187,616,620],{"className":617,"code":618,"language":619,"meta":196,"style":196},"language-json shiki shiki-themes github-light github-dark","{\n  \"from\": \"2026-07-08T00:00:00Z\",\n  \"to\": \"2026-07-09T00:00:00Z\",\n  \"project_id\": \"PROJ-1\",\n  \"totals\": {\n    \"cost_points\": \"1.5\",\n    \"prompt_tokens\": 100,\n    \"cached_tokens\": 0,\n    \"billable_prompt_tokens\": 100,\n    \"completion_tokens\": 50,\n    \"cache_creation_tokens\": 0,\n    \"total_tokens\": 150,\n    \"generated_artifacts\": 0,\n    \"request_count\": 2\n  },\n  \"by_model\": [\n    {\n      \"model\": \"deepseek-v4-pro@tune\",\n      \"cost_points\": \"1.5\",\n      \"prompt_tokens\": 100,\n      \"cached_tokens\": 0,\n      \"billable_prompt_tokens\": 100,\n      \"completion_tokens\": 50,\n      \"cache_creation_tokens\": 0,\n      \"total_tokens\": 150,\n      \"generated_artifacts\": 0,\n      \"request_count\": 2\n    }\n  ]\n}\n","json",[194,621,622,627,641,653,665,673,685,697,709,720,732,743,755,766,776,780,788,793,805,816,827,838,849,860,871,882,893,902,906,912],{"__ignoreMap":196},[254,623,624],{"class":256,"line":257},[254,625,626],{"class":281},"{\n",[254,628,629,632,635,638],{"class":256,"line":272},[254,630,631],{"class":268},"  \"from\"",[254,633,634],{"class":281},": ",[254,636,637],{"class":264},"\"2026-07-08T00:00:00Z\"",[254,639,640],{"class":281},",\n",[254,642,643,646,648,651],{"class":256,"line":308},[254,644,645],{"class":268},"  \"to\"",[254,647,634],{"class":281},[254,649,650],{"class":264},"\"2026-07-09T00:00:00Z\"",[254,652,640],{"class":281},[254,654,655,658,660,663],{"class":256,"line":314},[254,656,657],{"class":268},"  \"project_id\"",[254,659,634],{"class":281},[254,661,662],{"class":264},"\"PROJ-1\"",[254,664,640],{"class":281},[254,666,667,670],{"class":256,"line":321},[254,668,669],{"class":268},"  \"totals\"",[254,671,672],{"class":281},": {\n",[254,674,675,678,680,683],{"class":256,"line":327},[254,676,677],{"class":268},"    \"cost_points\"",[254,679,634],{"class":281},[254,681,682],{"class":264},"\"1.5\"",[254,684,640],{"class":281},[254,686,687,690,692,695],{"class":256,"line":333},[254,688,689],{"class":268},"    \"prompt_tokens\"",[254,691,634],{"class":281},[254,693,694],{"class":268},"100",[254,696,640],{"class":281},[254,698,699,702,704,707],{"class":256,"line":339},[254,700,701],{"class":268},"    \"cached_tokens\"",[254,703,634],{"class":281},[254,705,706],{"class":268},"0",[254,708,640],{"class":281},[254,710,711,714,716,718],{"class":256,"line":345},[254,712,713],{"class":268},"    \"billable_prompt_tokens\"",[254,715,634],{"class":281},[254,717,694],{"class":268},[254,719,640],{"class":281},[254,721,722,725,727,730],{"class":256,"line":351},[254,723,724],{"class":268},"    \"completion_tokens\"",[254,726,634],{"class":281},[254,728,729],{"class":268},"50",[254,731,640],{"class":281},[254,733,734,737,739,741],{"class":256,"line":357},[254,735,736],{"class":268},"    \"cache_creation_tokens\"",[254,738,634],{"class":281},[254,740,706],{"class":268},[254,742,640],{"class":281},[254,744,745,748,750,753],{"class":256,"line":363},[254,746,747],{"class":268},"    \"total_tokens\"",[254,749,634],{"class":281},[254,751,752],{"class":268},"150",[254,754,640],{"class":281},[254,756,757,760,762,764],{"class":256,"line":369},[254,758,759],{"class":268},"    \"generated_artifacts\"",[254,761,634],{"class":281},[254,763,706],{"class":268},[254,765,640],{"class":281},[254,767,768,771,773],{"class":256,"line":375},[254,769,770],{"class":268},"    \"request_count\"",[254,772,634],{"class":281},[254,774,775],{"class":268},"2\n",[254,777,778],{"class":256,"line":535},[254,779,437],{"class":281},[254,781,782,785],{"class":256,"line":541},[254,783,784],{"class":268},"  \"by_model\"",[254,786,787],{"class":281},": [\n",[254,789,790],{"class":256,"line":547},[254,791,792],{"class":281},"    {\n",[254,794,795,798,800,803],{"class":256,"line":553},[254,796,797],{"class":268},"      \"model\"",[254,799,634],{"class":281},[254,801,802],{"class":264},"\"deepseek-v4-pro@tune\"",[254,804,640],{"class":281},[254,806,807,810,812,814],{"class":256,"line":559},[254,808,809],{"class":268},"      \"cost_points\"",[254,811,634],{"class":281},[254,813,682],{"class":264},[254,815,640],{"class":281},[254,817,818,821,823,825],{"class":256,"line":564},[254,819,820],{"class":268},"      \"prompt_tokens\"",[254,822,634],{"class":281},[254,824,694],{"class":268},[254,826,640],{"class":281},[254,828,829,832,834,836],{"class":256,"line":570},[254,830,831],{"class":268},"      \"cached_tokens\"",[254,833,634],{"class":281},[254,835,706],{"class":268},[254,837,640],{"class":281},[254,839,840,843,845,847],{"class":256,"line":575},[254,841,842],{"class":268},"      \"billable_prompt_tokens\"",[254,844,634],{"class":281},[254,846,694],{"class":268},[254,848,640],{"class":281},[254,850,851,854,856,858],{"class":256,"line":580},[254,852,853],{"class":268},"      \"completion_tokens\"",[254,855,634],{"class":281},[254,857,729],{"class":268},[254,859,640],{"class":281},[254,861,862,865,867,869],{"class":256,"line":585},[254,863,864],{"class":268},"      \"cache_creation_tokens\"",[254,866,634],{"class":281},[254,868,706],{"class":268},[254,870,640],{"class":281},[254,872,873,876,878,880],{"class":256,"line":591},[254,874,875],{"class":268},"      \"total_tokens\"",[254,877,634],{"class":281},[254,879,752],{"class":268},[254,881,640],{"class":281},[254,883,884,887,889,891],{"class":256,"line":596},[254,885,886],{"class":268},"      \"generated_artifacts\"",[254,888,634],{"class":281},[254,890,706],{"class":268},[254,892,640],{"class":281},[254,894,895,898,900],{"class":256,"line":602},[254,896,897],{"class":268},"      \"request_count\"",[254,899,634],{"class":281},[254,901,775],{"class":268},[254,903,904],{"class":256,"line":608},[254,905,550],{"class":281},[254,907,909],{"class":256,"line":908},29,[254,910,911],{"class":281},"  ]\n",[254,913,915],{"class":256,"line":914},30,[254,916,611],{"class":281},[918,919,920,933],"table",{},[921,922,923],"thead",{},[924,925,926,930],"tr",{},[927,928,929],"th",{},"字段",[927,931,932],{},"说明",[934,935,936,947,957],"tbody",{},[924,937,938,944],{},[939,940,941],"td",{},[194,942,943],{},"project_id",[939,945,946],{},"该 API Key 绑定的项目",[924,948,949,954],{},[939,950,951],{},[194,952,953],{},"totals",[939,955,956],{},"时间范围内所有模型的汇总",[924,958,959,964],{},[939,960,961],{},[194,962,963],{},"by_model",[939,965,966,967,970],{},"按模型分项，按 ",[194,968,969],{},"cost_points"," 降序",[180,972,973],{"id":973},"错误处理",[918,975,976,988],{},[921,977,978],{},[924,979,980,983,986],{},[927,981,982],{},"HTTP 状态",[927,984,985],{},"错误码",[927,987,932],{},[934,989,990,1003,1018,1031],{},[924,991,992,995,1000],{},[939,993,994],{},"401",[939,996,997],{},[194,998,999],{},"INVALID_TOKEN",[939,1001,1002],{},"API Key 缺失或无效",[924,1004,1005,1008,1013],{},[939,1006,1007],{},"400",[939,1009,1010],{},[194,1011,1012],{},"INVALID_FROM_DATETIME",[939,1014,1015,1017],{},[194,1016,217],{}," 缺失或格式非 RFC3339",[924,1019,1020,1022,1027],{},[939,1021,1007],{},[939,1023,1024],{},[194,1025,1026],{},"INVALID_TO_DATETIME",[939,1028,1029,1017],{},[194,1030,221],{},[924,1032,1033,1035,1040],{},[939,1034,1007],{},[939,1036,1037],{},[194,1038,1039],{},"INVALID_TIME_RANGE",[939,1041,1042,1044,1045],{},[194,1043,217],{}," 不早于 ",[194,1046,221],{},[1048,1049,1050],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":196,"searchDepth":272,"depth":272,"links":1052},[1053,1054,1058],{"id":182,"depth":272,"text":182},{"id":199,"depth":272,"text":199,"children":1055},[1056,1057],{"id":208,"depth":308,"text":208},{"id":238,"depth":308,"text":238},{"id":973,"depth":272,"text":973},"使用 API Key 查询项目在时间范围内的消耗汇总。","md",{},"---\ntitle: 查询用量\ndescription: 使用 API Key 查询项目在时间范围内的消耗汇总。\n---\n\n# 查询用量\n\n返回指定时间段内、该 API Key 所属项目的消耗汇总：总额与按模型分项。消耗数据自动限定到 Key 所属的项目，不能跨项目查询。\n\n## 鉴权\n\n在请求头携带 API Key：\n\n```\nAuthorization: Bearer sk_live_YOUR_API_KEY\n```\n\n## 接口\n\n::api-endpoint{path=\"\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage\" method=\"GET\"}\n::\n\n### 参数\n\n- `from`、`to`：必填，RFC3339 时间，左闭右开 `[from, to)`，`from` 必须早于 `to`。\n- 时间范围以 UTC 为准。\n\n### 示例\n\n::code-tabs\n:::code-tab{label=\"cURL\"}\n```bash\ncurl \"https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage?from=2026-07-08T00:00:00Z&to=2026-07-09T00:00:00Z\" \\\n  -H \"Authorization: Bearer $SILVAMUX_API_KEY\"\n```\n:::\n:::code-tab{label=\"Python\"}\n```python\n# pip install requests\nimport os\nimport requests\n\nresp = requests.get(\n    \"https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage\",\n    params={\n        \"from\": \"2026-07-08T00:00:00Z\",\n        \"to\": \"2026-07-09T00:00:00Z\",\n    },\n    headers={\"Authorization\": f\"Bearer {os.environ['SILVAMUX_API_KEY']}\"},\n)\nresp.raise_for_status()\nprint(resp.json()[\"totals\"])\n```\n:::\n:::code-tab{label=\"JavaScript\"}\n```javascript\n\u002F\u002F Node 18+（内置 fetch）\nconst from = \"2026-07-08T00:00:00Z\";\nconst to = \"2026-07-09T00:00:00Z\";\nconst query = new URLSearchParams({ from, to });\n\nconst resp = await fetch(\n  `https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage?${query}`,\n  {\n    headers: { Authorization: `Bearer ${process.env.SILVAMUX_API_KEY}` },\n  },\n);\n\nconst data = await resp.json();\nconsole.log(data.totals);\n```\n:::\n:::code-tab{label=\"Go\"}\n```go\n\u002F\u002F 仅依赖标准库\npackage main\n\nimport (\n\t\"fmt\"\n\t\"io\"\n\t\"net\u002Fhttp\"\n\t\"os\"\n)\n\nfunc main() {\n\turl := \"https:\u002F\u002Fwww.silvamux.com\u002Fapi\u002Fbusiness\u002Fv1\u002Fcustomer\u002Fusage?from=2026-07-08T00:00:00Z&to=2026-07-09T00:00:00Z\"\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+os.Getenv(\"SILVAMUX_API_KEY\"))\n\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, _ := io.ReadAll(resp.Body)\n\tfmt.Println(string(body))\n}\n```\n:::\n::\n\n响应：\n\n```json\n{\n  \"from\": \"2026-07-08T00:00:00Z\",\n  \"to\": \"2026-07-09T00:00:00Z\",\n  \"project_id\": \"PROJ-1\",\n  \"totals\": {\n    \"cost_points\": \"1.5\",\n    \"prompt_tokens\": 100,\n    \"cached_tokens\": 0,\n    \"billable_prompt_tokens\": 100,\n    \"completion_tokens\": 50,\n    \"cache_creation_tokens\": 0,\n    \"total_tokens\": 150,\n    \"generated_artifacts\": 0,\n    \"request_count\": 2\n  },\n  \"by_model\": [\n    {\n      \"model\": \"deepseek-v4-pro@tune\",\n      \"cost_points\": \"1.5\",\n      \"prompt_tokens\": 100,\n      \"cached_tokens\": 0,\n      \"billable_prompt_tokens\": 100,\n      \"completion_tokens\": 50,\n      \"cache_creation_tokens\": 0,\n      \"total_tokens\": 150,\n      \"generated_artifacts\": 0,\n      \"request_count\": 2\n    }\n  ]\n}\n```\n\n| 字段 | 说明 |\n|---|---|\n| `project_id` | 该 API Key 绑定的项目 |\n| `totals` | 时间范围内所有模型的汇总 |\n| `by_model` | 按模型分项，按 `cost_points` 降序 |\n\n## 错误处理\n\n| HTTP 状态 | 错误码 | 说明 |\n|---|---|---|\n| 401 | `INVALID_TOKEN` | API Key 缺失或无效 |\n| 400 | `INVALID_FROM_DATETIME` | `from` 缺失或格式非 RFC3339 |\n| 400 | `INVALID_TO_DATETIME` | `to` 缺失或格式非 RFC3339 |\n| 400 | `INVALID_TIME_RANGE` | `from` 不早于 `to` |\n",[],{"title":152,"description":1059},"biVD8Vbj6gWz5-enlHKl5hsICJ17H3DfOYe7SCLXyEk",{"found":317,"operationId":1067,"summary":152,"description":1068,"method":203,"path":204,"publiclyDiscoverable":317,"security":1069,"parameters":1072,"requestBody":1085,"responses":1089},"customer-usage","Return aggregated usage (totals + per-model) for the API key's project over a time range. API key only.",{"schemes":1070,"optional":43},[1071],"apikey",[1073,1077,1080,1083],{"name":1074,"type":1075,"required":317,"description":1076},"Authorization","string · header","Bearer API Key (sk_live_...)",{"name":1078,"type":1075,"required":43,"description":1079},"X-Organization-Id","Not required for API key auth",{"name":217,"type":1081,"required":317,"description":1082},"string · query","RFC3339 start time (inclusive)",{"name":221,"type":1081,"required":317,"description":1084},"RFC3339 end time (exclusive)",{"present":43,"required":43,"description":196,"contentType":196,"type":1086,"fields":1087,"variants":1088},"any",[],[],[1090,1172],{"status":1091,"description":1092,"contentType":1093,"type":1094,"fields":1095},"200","OK","application\u002Fjson","BillingUsageReportResponse",[1096,1100,1103,1107,1110,1113,1116,1119,1123,1126,1129,1132,1135,1138,1141,1144,1146,1148,1150,1152,1154,1156,1158,1160,1162,1164,1166,1168,1170],{"name":1097,"type":1098,"required":43,"description":1099},"$schema","string (uri)","A URL to the JSON Schema for this object.",{"name":963,"type":1101,"required":317,"description":1102},"array\u003CUsageReportModelBreakdown>","Per-model breakdown, ordered by cost_points desc",{"name":1104,"type":1105,"required":317,"description":1106},"by_model.billable_prompt_tokens","integer (int64)","Summed billable prompt tokens",{"name":1108,"type":1105,"required":317,"description":1109},"by_model.cache_creation_tokens","Summed cache creation tokens",{"name":1111,"type":1105,"required":317,"description":1112},"by_model.cache_explicit_read_tokens","Summed explicit cache read tokens",{"name":1114,"type":1105,"required":317,"description":1115},"by_model.cached_tokens","Summed cached tokens",{"name":1117,"type":1105,"required":317,"description":1118},"by_model.completion_tokens","Summed completion tokens",{"name":1120,"type":1121,"required":317,"description":1122},"by_model.cost_points","string","Total cost in points (after discount)",{"name":1124,"type":1105,"required":317,"description":1125},"by_model.generated_artifacts","Summed generated artifacts",{"name":1127,"type":1121,"required":317,"description":1128},"by_model.model","Aggregation key: user-supplied request_model, falling back to the configured model ID for legacy rows",{"name":1130,"type":1121,"required":317,"description":1131},"by_model.original_cost","Total cost in points before discount",{"name":1133,"type":1105,"required":317,"description":1134},"by_model.prompt_tokens","Summed prompt tokens",{"name":1136,"type":1105,"required":317,"description":1137},"by_model.request_count","Number of billed requests",{"name":1139,"type":1105,"required":317,"description":1140},"by_model.total_tokens","Summed total tokens",{"name":217,"type":1142,"required":317,"description":1143},"string (date-time)","Report start (RFC3339, inclusive)",{"name":943,"type":1121,"required":317,"description":1145},"Project filter ('' means org-wide)",{"name":221,"type":1142,"required":317,"description":1147},"Report end (RFC3339, exclusive)",{"name":953,"type":1149,"required":317,"description":196},"UsageReportTotals",{"name":1151,"type":1105,"required":317,"description":196},"totals.billable_prompt_tokens",{"name":1153,"type":1105,"required":317,"description":196},"totals.cache_creation_tokens",{"name":1155,"type":1105,"required":317,"description":196},"totals.cache_explicit_read_tokens",{"name":1157,"type":1105,"required":317,"description":196},"totals.cached_tokens",{"name":1159,"type":1105,"required":317,"description":196},"totals.completion_tokens",{"name":1161,"type":1121,"required":317,"description":1122},"totals.cost_points",{"name":1163,"type":1105,"required":317,"description":196},"totals.generated_artifacts",{"name":1165,"type":1121,"required":317,"description":1131},"totals.original_cost",{"name":1167,"type":1105,"required":317,"description":196},"totals.prompt_tokens",{"name":1169,"type":1105,"required":317,"description":196},"totals.request_count",{"name":1171,"type":1105,"required":317,"description":196},"totals.total_tokens",{"status":1173,"description":1174,"contentType":1175,"type":1176,"fields":1177},"default","Error","application\u002Fproblem+json","ErrorModel",[1178,1179,1182,1186,1189,1192,1195,1198,1201,1204],{"name":1097,"type":1098,"required":43,"description":1099},{"name":1180,"type":1121,"required":43,"description":1181},"detail","A human-readable explanation specific to this occurrence of the problem.",{"name":1183,"type":1184,"required":43,"description":1185},"errors","array\u003CErrorDetail>","Optional list of individual error details",{"name":1187,"type":1121,"required":43,"description":1188},"errors.location","Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'",{"name":1190,"type":1121,"required":43,"description":1191},"errors.message","Error message text",{"name":1193,"type":1086,"required":43,"description":1194},"errors.value","The value at the given location",{"name":1196,"type":1098,"required":43,"description":1197},"instance","A URI reference that identifies the specific occurrence of the problem.",{"name":1199,"type":1105,"required":43,"description":1200},"status","HTTP status code",{"name":1202,"type":1121,"required":43,"description":1203},"title","A short, human-readable summary of the problem type. This value should not change between occurrences of the error.",{"name":1205,"type":1098,"required":43,"description":1206,"defaultValue":1207},"type","A URI reference to human-readable documentation for the error.","about:blank"]