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