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