Attribute LLM spend to each end-customer so you know the margin behind every account.
Know exactly what each customer costs you in LLM spend by tagging requests with their ID.
1
Tag every request with a customer identifier
Pass your customer’s identifier as a metadata key using X-Toolken-Metadata-Customer-Id. The header suffix maps directly to the customer_id metadata key in the dashboard. Use whatever ID you already have — a user ID, an org slug, or an account number.
from openai import OpenAIclient = OpenAI( base_url="https://gateway.toolken.ai/v1", api_key="sk-...", # your provider key, forwarded untouched default_headers={ "X-Toolken-Key": "tk_live_...", "X-Toolken-Metadata-Customer-Id": "cust_acme", },)client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "Generate a project summary."}],)
Go to the cost view in the dashboard. Use the “Group by” control to select Customer. Each customer ID appears as a row showing cost, token usage, and request count.
Cost grouped by customer
Set customer via metadata (precedence)
You can set the customer dimension in more than one way on the same request. If you send multiple, the highest-priority one wins:
Priority
Method
1 (highest)
"customer_id" key inside the provider request body metadata object
2
X-Toolken-Metadata: {"customer_id":"<id>"}
3 (lowest)
X-Toolken-Metadata-Customer-Id: <id>
Pick one method and stay consistent. The priority only matters when you accidentally set it multiple ways.
Cost per customer per agent
Add X-Toolken-Metadata-Agent alongside X-Toolken-Metadata-Customer-Id to get a two-dimensional view. You can then answer questions like “how much did cust_acme spend on the report-generator agent this month?”.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Toolken","colors":{"primary":"#0284C7","light":"#38BDF8","dark":"#0369A1"},"logo":{"light":"https://mintcdn.com/toolken/W5qvj0-D7NNQnmAM/logo/light.svg?fit=max\u0026auto=format\u0026n=W5qvj0-D7NNQnmAM\u0026q=85\u0026s=6a9e3b5eefee65dc22c623cf9394d27b","dark":"https://mintcdn.com/toolken/W5qvj0-D7NNQnmAM/logo/dark.svg?fit=max\u0026auto=format\u0026n=W5qvj0-D7NNQnmAM\u0026q=85\u0026s=da530602263711b01fe950606a76b1c8"},"favicon":"https://mintcdn.com/toolken/W5qvj0-D7NNQnmAM/favicon.svg?fit=max\u0026auto=format\u0026n=W5qvj0-D7NNQnmAM\u0026q=85\u0026s=4263914b7b530c4f80c557438d2e1eea","navbar":{"links":[],"primary":{"type":"button","label":"Dashboard","href":"https://app.toolken.ai"}},"footer":{"socials":{"github":"https://github.com/ToolKen-ai"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"toolken","hasAudioNarration":false,"actualSubdomain":"toolken","customDomains":["docs.toolken.ai"],"gitSource":{"type":"github","owner":"toolken-ai","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a59848460d612d1286216b8","collectionId":"c8a18e13-645e-47ef-8d19-971b3490038a","schemaVersion":"v3"},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6a59848460d612d1286216b8:success","clientVersion":"0.0.3933","searchFilterCounts":[{"language":"default","tag":"Documentation","count":27},{"language":"default","tag":"API Reference","count":11},{"language":"default","tag":"Integrations","count":11},{"language":"default","tag":"FAQ","count":8},{"language":"default","tag":"AI Gateway","count":6},{"language":"default","tag":"Observability","count":4},{"language":"default","tag":"Getting Started","count":4},{"language":"default","tag":"Coding tools","count":4},{"language":"default","tag":"Agent frameworks","count":4},{"language":"default","tag":"Use cases","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"use-cases/per-customer-cost","slug":"/use-cases/per-customer-cost","pageMetadata":{"title":"Per-Customer Cost","description":"Attribute LLM spend to each end-customer so you know the margin behind every account.","icon":"user-check","href":"/use-cases/per-customer-cost"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Attribute LLM spend to each end-customer so you know the margin behind every account.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{Accordion,AccordionGroup,Card,CardGroup,CodeBlock,CodeGroup,Frame,Heading,OptimizedImage,Step,Steps,Table}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!AccordionGroup)_missingMdxReference(`AccordionGroup`,true);if(!Card)_missingMdxReference(`Card`,true);if(!CardGroup)_missingMdxReference(`CardGroup`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Frame)_missingMdxReference(`Frame`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Know exactly what each customer costs you in LLM spend by tagging requests with their ID.`})}),`\n`,_jsxs(Steps,{children:[_jsxs(Step,{title:`Tag every request with a customer identifier`,children:[_jsxs(_components.p,{children:[`Pass your customer’s identifier as a metadata key using `,_jsx(_components.code,{children:`X-Toolken-Metadata-Customer-Id`}),`. The header suffix maps directly to the `,_jsx(_components.code,{children:`customer_id`}),` metadata key in the dashboard. Use whatever ID you already have — a user ID, an org slug, or an account number.`]}),_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`14`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` base_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://gateway.toolken.ai/v1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"sk-...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# your provider key, forwarded untouched`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` default_headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Toolken-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tk_live_...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Toolken-Metadata-Customer-Id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cust_acme\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client.chat.completions.create(`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-4o-mini\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Generate a project summary.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`Node`,numberOfLines:`14`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"openai\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` baseURL:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://gateway.toolken.ai/v1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`OPENAI_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// forwarded untouched`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` defaultHeaders:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Toolken-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"tk_live_...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Toolken-Metadata-Customer-Id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"cust_acme\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`completions`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"gpt-4o-mini\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [{ `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Generate a project summary.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),_jsx(CodeBlock,{filename:`curl`,numberOfLines:`6`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://gateway.toolken.ai/v1/chat/completions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$OPENAI_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Toolken-Key: tk_live_...\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Toolken-Metadata-Customer-Id: cust_acme\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{\"model\":\"gpt-4o-mini\",\"messages\":[{\"role\":\"user\",\"content\":\"Generate a project summary.\"}]}'`})]}),`\n`]})})})]})]}),_jsxs(Step,{title:`Open the dashboard and group by Customer`,children:[_jsxs(_components.p,{children:[`Go to the cost view in the dashboard. Use the “Group by” control to select `,_jsx(_components.strong,{children:`Customer`}),`. Each customer ID appears as a row showing cost, token usage, and request count.`]}),_jsx(Frame,{caption:`Cost grouped by customer`,children:_jsx(OptimizedImage,{src:`https://mintcdn.com/toolken/B9FQGhQVN-q79Dqo/images/cost-by-customer.png?fit=max\u0026auto=format\u0026n=B9FQGhQVN-q79Dqo\u0026q=85\u0026s=df578bc8bb29b74d86113ed1a2d76887`,alt:`Dashboard showing cost broken down by customer`,\"data-og-width\":`1440`,width:`1440`,\"data-og-height\":`900`,height:`900`,\"data-path\":`images/cost-by-customer.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/toolken/B9FQGhQVN-q79Dqo/images/cost-by-customer.png?w=280\u0026fit=max\u0026auto=format\u0026n=B9FQGhQVN-q79Dqo\u0026q=85\u0026s=016ef93caca041996860f447e8360655 280w, https://mintcdn.com/toolken/B9FQGhQVN-q79Dqo/images/cost-by-customer.png?w=560\u0026fit=max\u0026auto=format\u0026n=B9FQGhQVN-q79Dqo\u0026q=85\u0026s=156249afe8caa769f2a66933936f75fe 560w, https://mintcdn.com/toolken/B9FQGhQVN-q79Dqo/images/cost-by-customer.png?w=840\u0026fit=max\u0026auto=format\u0026n=B9FQGhQVN-q79Dqo\u0026q=85\u0026s=3be903bc197e8e2d4b77376dc50e3789 840w, https://mintcdn.com/toolken/B9FQGhQVN-q79Dqo/images/cost-by-customer.png?w=1100\u0026fit=max\u0026auto=format\u0026n=B9FQGhQVN-q79Dqo\u0026q=85\u0026s=f295c93a6832fd38ca6d8fd216145648 1100w, https://mintcdn.com/toolken/B9FQGhQVN-q79Dqo/images/cost-by-customer.png?w=1650\u0026fit=max\u0026auto=format\u0026n=B9FQGhQVN-q79Dqo\u0026q=85\u0026s=723de9dd946afa678fb9315578825711 1650w, https://mintcdn.com/toolken/B9FQGhQVN-q79Dqo/images/cost-by-customer.png?w=2500\u0026fit=max\u0026auto=format\u0026n=B9FQGhQVN-q79Dqo\u0026q=85\u0026s=6c7a07ea5a9d6c5680a23e491907744b 2500w`})})]})]}),`\n`,_jsxs(AccordionGroup,{children:[_jsxs(Accordion,{title:`Set customer via metadata (precedence)`,id:`set-customer-via-metadata-precedence`,children:[_jsx(_components.p,{children:`You can set the customer dimension in more than one way on the same request. If you send multiple, the highest-priority one wins:`}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Priority`}),_jsx(_components.th,{children:`Method`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`1 (highest)`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`\"customer_id\"`}),` key inside the provider request body `,_jsx(_components.code,{children:`metadata`}),` object`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`X-Toolken-Metadata: {\"customer_id\":\"\u003cid>\"}`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`3 (lowest)`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`X-Toolken-Metadata-Customer-Id: \u003cid>`})})]})]})]}),_jsx(_components.p,{children:`Pick one method and stay consistent. The priority only matters when you accidentally set it multiple ways.`})]}),_jsxs(Accordion,{title:`Cost per customer per agent`,id:`cost-per-customer-per-agent`,children:[_jsxs(_components.p,{children:[`Add `,_jsx(_components.code,{children:`X-Toolken-Metadata-Agent`}),` alongside `,_jsx(_components.code,{children:`X-Toolken-Metadata-Customer-Id`}),` to get a two-dimensional view. You can then answer questions like “how much did `,_jsx(_components.code,{children:`cust_acme`}),` spend on the `,_jsx(_components.code,{children:`report-generator`}),` agent this month?”.`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`default_headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Toolken-Key\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"tk_live_...\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Toolken-Metadata-Customer-Id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"cust_acme\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"X-Toolken-Metadata-Agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"report-generator\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsxs(_components.p,{children:[`Group by `,_jsx(_components.strong,{children:`Customer`}),` then by `,_jsx(_components.strong,{children:`Agent`}),` in the dashboard to see the breakdown.`]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`next`,children:`Next`}),`\n`,_jsxs(CardGroup,{cols:2,children:[_jsx(Card,{title:`Cost Per Agent`,icon:`robot`,href:`/use-cases/cost-per-agent`,children:`Break down spend by agent or workflow.`}),_jsx(Card,{title:`Cost by Environment`,icon:`server`,href:`/use-cases/cost-by-environment`,children:`Separate production and staging spend.`})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Per-Customer Cost","description":"Attribute LLM spend to each end-customer so you know the margin behind every account.","icon":"user-check","href":"/use-cases/per-customer-cost"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Next","slug":"next","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"toolken","siteName":"Toolken","title":"Per-Customer Cost - Toolken","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-07-17T01:25:37.154Z","originalFileLocation":"use-cases/per-customer-cost.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Attribute LLM spend to each end-customer so you know the margin behind every account.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Toolken\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Per-Customer Cost - Toolken\">\u003cmeta data-mint-head property=\"og:description\" content=\"Attribute LLM spend to each end-customer so you know the margin behind every account.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Toolken\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.toolken.ai/use-cases/per-customer-cost\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://toolken.mintlify.app/_mintlify/api/og/v2?division=Use+cases\u0026amp;title=Per-Customer+Cost\u0026amp;description=Attribute+LLM+spend+to+each+end-customer+so+you+know+the+margin+behind+every+account.\u0026amp;theme=9d978157379e2c9575c0fa8e\u0026amp;signature=c9364a05ecac53abb3924f705a5f59b24c78b700e6fad05382ad3eeba7d80069\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Per-Customer Cost - Toolken\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Attribute LLM spend to each end-customer so you know the margin behind every account.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://toolken.mintlify.app/_mintlify/api/og/v2?division=Use+cases\u0026amp;title=Per-Customer+Cost\u0026amp;description=Attribute+LLM+spend+to+each+end-customer+so+you+know+the+margin+behind+every+account.\u0026amp;theme=9d978157379e2c9575c0fa8e\u0026amp;signature=c9364a05ecac53abb3924f705a5f59b24c78b700e6fad05382ad3eeba7d80069\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/toolken/0ytcJzijFVxK1wJa/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Toolken\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0284C7\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.toolken.ai/use-cases/per-customer-cost\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/use-cases/per-customer-cost.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.toolken.ai/#organization\",\"name\":\"Toolken\",\"url\":\"https://docs.toolken.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/toolken/W5qvj0-D7NNQnmAM/logo/light.svg?fit=max\u0026auto=format\u0026n=W5qvj0-D7NNQnmAM\u0026q=85\u0026s=6a9e3b5eefee65dc22c623cf9394d27b\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.toolken.ai#website\",\"name\":\"Toolken\",\"url\":\"https://docs.toolken.ai\",\"publisher\":{\"@id\":\"https://docs.toolken.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.toolken.ai/use-cases/per-customer-cost#webpage\",\"url\":\"https://docs.toolken.ai/use-cases/per-customer-cost\",\"name\":\"Per-Customer Cost\",\"description\":\"Attribute LLM spend to each end-customer so you know the margin behind every account.\",\"dateModified\":\"2026-07-17T01:25:37.154Z\",\"isPartOf\":{\"@id\":\"https://docs.toolken.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.toolken.ai/use-cases/per-customer-cost#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.toolken.ai/use-cases/per-customer-cost#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Use cases\",\"item\":\"https://docs.toolken.ai/use-cases/cost-per-agent\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Per-Customer Cost\",\"item\":\"https://docs.toolken.ai/use-cases/per-customer-cost\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.toolken.ai/use-cases/per-customer-cost#article\",\"headline\":\"Per-Customer Cost\",\"name\":\"Per-Customer Cost\",\"description\":\"Attribute LLM spend to each end-customer so you know the margin behind every account.\",\"url\":\"https://docs.toolken.ai/use-cases/per-customer-cost\",\"mainEntityOfPage\":{\"@id\":\"https://docs.toolken.ai/use-cases/per-customer-cost#webpage\"},\"dateModified\":\"2026-07-17T01:25:37.154Z\",\"publisher\":{\"@id\":\"https://docs.toolken.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.toolken.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Toolken\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Toolken","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Getting Started","pages":[{"title":"Introduction","icon":"bolt","href":""},{"title":"Quickstart","icon":"rocket","href":"/get-started/quickstart"},{"title":"How Toolken Works","icon":"diagram-project","href":"/get-started/how-toolken-works"},{"title":"Authentication","icon":"key","href":"/get-started/authentication"}]},{"group":"Observability","pages":[{"title":"Overview","icon":"chart-bar","href":"/features/observability/overview"},{"title":"Custom Properties","icon":"tag","href":"/features/observability/custom-properties"},{"title":"Dimensions \u0026 Filtering","icon":"filter","href":"/features/observability/dimensions"},{"title":"Dashboard","icon":"gauge","href":"/features/observability/dashboard"}]},{"group":"Providers \u0026 Routing","pages":[{"title":"Providers \u0026 Routing","icon":"route","href":"/features/providers-routing/overview"},{"title":"Choosing a Provider","icon":"sliders","href":"/features/providers-routing/choose-provider"},{"title":"Anthropic \u0026 Gemini","icon":"sparkles","href":"/features/providers-routing/anthropic-gemini"}]},{"group":"Rate Limits","pages":[{"title":"Rate Limits","icon":"gauge-high","href":"/features/budgets-rate-limits/rate-limits"}]},{"group":"Integrations","pages":[{"group":"Agent frameworks","pages":[{"title":"OpenClaw","icon":"claw-marks","href":"/integrations/openclaw"},{"title":"Hermes","icon":"bolt","href":"/integrations/hermes"},{"title":"CrewAI","icon":"users-gear","href":"/integrations/crewai"},{"title":"LangGraph","icon":"diagram-project","href":"/integrations/langgraph"}]},{"group":"Coding tools","pages":[{"title":"Claude Code","icon":"terminal","href":"/integrations/claude-code"},{"title":"Codex","icon":"code","href":"/integrations/codex"},{"title":"Continue","icon":"puzzle-piece","href":"/integrations/continue"},{"title":"Cursor","icon":"arrow-pointer","href":"/integrations/cursor"}]},{"group":"SDKs","pages":[{"title":"OpenAI SDK","icon":"wand-magic-sparkles","href":"/integrations/openai-sdk"},{"title":"Anthropic SDK","icon":"message","href":"/integrations/anthropic-sdk"},{"title":"Gemini SDK","icon":"sparkles","href":"/integrations/gemini-sdk"}]}]},{"group":"Use cases","pages":[{"title":"Cost Per Agent","description":"Tag each agent's requests so you can see exactly what each agent spends.","icon":"robot","href":"/use-cases/cost-per-agent"},{"title":"Per-Customer Cost","icon":"user-check","href":"/use-cases/per-customer-cost"},{"title":"Compare Providers by Cost","description":"Send the same prompt to different providers through one URL and see which one is cheapest.","icon":"scale-balanced","href":"/use-cases/compare-providers-by-cost"},{"title":"Cost by Environment","icon":"server","href":"/use-cases/cost-by-environment"}]}]},{"anchor":"API Reference","icon":"code","pages":[{"title":"API Reference","href":"/api-reference/overview"}]},{"anchor":"FAQ","icon":"circle-question","pages":[{"title":"FAQ","href":"/faq/general"}]}]},"title":"Per-Customer Cost - Toolken","buildId":"dpl_GnxaU9nEer7XK27kw3dpfPrs9geh","deploymentId":"dpl_GnxaU9nEer7XK27kw3dpfPrs9geh","dynamics":["07c022d89b","a74be98ba7"],"chunks":["Frame-C1EX3v38.js","DynamicMarkdown-BPGty-u8.js","zoom-image-lightbox-Cv5hibpS.js","PlusIcon-owOTCErD.js","lightbox-handle-r17bVUz3.js"]}