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