Raw credit balance in microcredits. Divide by 1,000,000 to convert to
millions. The existing numeric value and precision are unchanged.
string
Legacy balance in millions without a suffix (e.g. "1.23", "1.00"). Nonzero
inputs retain two decimal places; zero returns "0". This existing field is
unchanged for independently deployed clients. Its two-decimal precision can
round small nonzero balances to "0.00". For precision-sensitive displays,
derive millions from availableBalance and retain sufficient decimal places:
a raw balance of 1000 is 0.001M credits, not zero.
boolean
true when the user’s (or org’s) subscription is currently active, even if
its available balance is zero or negative. Subscription status and available
balance are separate checks.
boolean
true when the returned balance belongs to an organization the user is a
member of, rather than the user’s personal account.
A confirmed inactive subscription returns HTTP 200 with availableBalance: 0
and hasActiveSubscription: false. If the balance or subscription status cannot
be verified, the endpoint returns HTTP 503 with error code
SERVICE_UNAVAILABLE instead of reporting an inactive subscription or zero
balance.On a temporary failure, preserve the last successfully retrieved balance, mark
it as unavailable or stale, and retry with backoff. Do not treat a failed lookup
as proof that the user has no credits or needs a subscription. Check the HTTP
status before consuming the balance fields.
Status
Reason
401
Missing or invalid API key
404
Account or organization not found
429
API key rate limit exceeded
503
Balance or subscription status temporarily unavailable
500
Server error
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Magica","colors":{"primary":"#6366f1","light":"#818cf8","dark":"#4f46e5"},"logo":{"light":"https://mintcdn.com/galaxyai-f8150d75/DBhRDarFZNKVqMQi/logo/logo_light_theme.svg?fit=max\u0026auto=format\u0026n=DBhRDarFZNKVqMQi\u0026q=85\u0026s=6f2c433ff16ffb278918ac9ebdf0de20","dark":"https://mintcdn.com/galaxyai-f8150d75/DBhRDarFZNKVqMQi/logo/logo_dark_theme.svg?fit=max\u0026auto=format\u0026n=DBhRDarFZNKVqMQi\u0026q=85\u0026s=12e176141e9a0793a64292bb91603779"},"favicon":"https://mintcdn.com/galaxyai-f8150d75/quUbr73Mwh3x8_L4/logo/icon.png?fit=max\u0026auto=format\u0026n=quUbr73Mwh3x8_L4\u0026q=85\u0026s=6cf007f3a7707b6edab45417ca58af6b","api":{"openapi":["openapi.json"],"mdx":{"server":"https://inference.magica.com"}},"appearance":{"default":"light"},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","grok","aistudio"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"galaxyai-f8150d75","hasAudioNarration":false,"actualSubdomain":"galaxyai-f8150d75","customDomains":["magica.com"],"gitSource":{"type":"github","owner":"galaxyai-team","repo":"app.galaxy.ai","deployBranch":"main","contentDirectory":"api-docs","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6af6ceeb5955afd619ba7e54","clientVersion":"0.0.4128","searchFilterCounts":[{"language":"default","tag":"API Reference","count":21},{"language":"default","tag":"Get Started","count":6},{"language":"default","tag":"LLM Gateway","count":5},{"language":"default","tag":"Standalone Model Runs","count":5},{"language":"default","tag":"Models","count":5},{"language":"default","tag":"Introduction","count":4},{"language":"default","tag":"MCP Server","count":4},{"language":"default","tag":"Generated Media","count":3},{"language":"default","tag":"Overview","count":2},{"language":"default","tag":"Credits","count":1}]},"assistantConfig":{"enableStarterQuestions":false},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","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":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","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":"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":"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":"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":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","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":"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":"workos-sso-scim","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},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","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}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"api-reference/credits/balance","slug":"/api-reference/credits/balance","pageMetadata":{"title":"Get credit balance","api":"GET /v1/credits/balance","description":"Return the authenticated user's current credit balance.","authMethod":"bearer","href":"/api-reference/credits/balance"},"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: \"Return the authenticated user’s current credit balance.\"\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={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,ParamField,ResponseField,Tab,Table,Tabs,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!ParamField)_missingMdxReference(`ParamField`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Returns the current credit balance for the authenticated user (or the user’s active organization, if applicable).`}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Pair this with `,_jsx(_components.a,{href:`/api-reference/nodes/estimate-credits`,children:_jsx(_components.code,{children:`POST /v1/nodes/estimate-credits`})}),` to confirm\nthere’s enough balance before kicking off an expensive run.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`authorizations`,children:`Authorizations`}),`\n`,_jsx(ParamField,{header:`Authorization`,type:`string`,required:true,id:`param-authorization`,children:_jsxs(_components.p,{children:[`Bearer API key. Format: `,_jsx(_components.code,{children:`Bearer gx_your_api_key`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`response`,children:`Response`}),`\n`,_jsx(ResponseField,{name:`availableBalance`,type:`number`,id:`param-available-balance`,children:_jsxs(_components.p,{children:[`Raw credit balance in `,_jsx(_components.strong,{children:`microcredits`}),`. Divide by 1,000,000 to convert to\nmillions. The existing numeric value and precision are unchanged.`]})}),`\n`,_jsx(ResponseField,{name:`formatted`,type:`string`,id:`param-formatted`,children:_jsxs(_components.p,{children:[`Legacy balance in millions without a suffix (e.g. `,_jsx(_components.code,{children:`\"1.23\"`}),`, `,_jsx(_components.code,{children:`\"1.00\"`}),`). Nonzero\ninputs retain two decimal places; zero returns `,_jsx(_components.code,{children:`\"0\"`}),`. This existing field is\nunchanged for independently deployed clients. Its two-decimal precision can\nround small nonzero balances to `,_jsx(_components.code,{children:`\"0.00\"`}),`. For precision-sensitive displays,\nderive millions from `,_jsx(_components.code,{children:`availableBalance`}),` and retain sufficient decimal places:\na raw balance of 1000 is `,_jsx(_components.code,{children:`0.001M credits`}),`, not zero.`]})}),`\n`,_jsx(ResponseField,{name:`hasActiveSubscription`,type:`boolean`,id:`param-has-active-subscription`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`true`}),` when the user’s (or org’s) subscription is currently active, even if\nits available balance is zero or negative. Subscription status and available\nbalance are separate checks.`]})}),`\n`,_jsx(ResponseField,{name:`isOrganization`,type:`boolean`,id:`param-is-organization`,children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`true`}),` when the returned balance belongs to an organization the user is a\nmember of, rather than the user’s personal account.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`request`,children:`Request`}),`\n`,_jsxs(Tabs,{children:[_jsx(Tab,{title:`cURL`,id:`curl`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`2`,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:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --fail-with-body`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://inference.magica.com/v1/credits/balance`}),_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:`$MAGICA_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`})]}),`\n`]})})})}),_jsx(Tab,{title:`Node.js`,id:`node-js`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`7`,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:`7`,children:[_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:` res`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://inference.magica.com/v1/credits/balance\"`}),_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:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`Authorization:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`process`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`MAGICA_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},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:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`!`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`ok`}),_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:` throw`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` Error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`Credit balance request failed: HTTP \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`res`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},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\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`availableBalance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`formatted`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`hasActiveSubscription`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` res`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})})}),_jsx(Tab,{title:`Python`,id:`python`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`11`,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:`11`,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\":`#D4D4D4`},children:` os, requests`})]}),`\n`,_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:` decimal `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Decimal`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`res `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.get(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://inference.magica.com/v1/credits/balance\"`}),_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:` headers`}),_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:`\"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'MAGICA_API_KEY'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},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:`res.raise_for_status()`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`payload `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` res.json()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`balance_m `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Decimal(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(payload[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"availableBalance\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`])) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`/`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Decimal(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1000000\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`balance_m`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`:f}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`M credits\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# e.g. \"26.17M credits\" or \"0.001M credits\"`})]}),`\n`]})})})})]}),`\n`,_jsx(Heading,{level:`2`,id:`response-example`,children:`Response example`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`json`,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:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`6`,children:[_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"availableBalance\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`26170000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"formatted\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"26.17\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"hasActiveSubscription\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"isOrganization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`errors`,children:`Errors`}),`\n`,_jsxs(_components.p,{children:[`A confirmed inactive subscription returns HTTP `,_jsx(_components.code,{children:`200`}),` with `,_jsx(_components.code,{children:`availableBalance: 0`}),`\nand `,_jsx(_components.code,{children:`hasActiveSubscription: false`}),`. If the balance or subscription status cannot\nbe verified, the endpoint returns HTTP `,_jsx(_components.code,{children:`503`}),` with error code\n`,_jsx(_components.code,{children:`SERVICE_UNAVAILABLE`}),` instead of reporting an inactive subscription or zero\nbalance.`]}),`\n`,_jsx(_components.p,{children:`On a temporary failure, preserve the last successfully retrieved balance, mark\nit as unavailable or stale, and retry with backoff. Do not treat a failed lookup\nas proof that the user has no credits or needs a subscription. Check the HTTP\nstatus before consuming the balance fields.`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Status`}),_jsx(_components.th,{children:`Reason`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`401`})}),_jsx(_components.td,{children:`Missing or invalid API key`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`404`})}),_jsx(_components.td,{children:`Account or organization not found`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`429`})}),_jsx(_components.td,{children:`API key rate limit exceeded`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`503`})}),_jsx(_components.td,{children:`Balance or subscription status temporarily unavailable`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:_jsx(_components.code,{children:`500`})}),_jsx(_components.td,{children:`Server error`})]})]})]})]})}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":"Get credit balance","api":"GET /v1/credits/balance","description":"Return the authenticated user's current credit balance.","authMethod":"bearer","href":"/api-reference/credits/balance"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Authorizations","slug":"authorizations","depth":2,"children":[]},{"title":"Response","slug":"response","depth":2,"children":[]},{"title":"Request","slug":"request","depth":2,"children":[]},{"title":"Response example","slug":"response-example","depth":2,"children":[]},{"title":"Errors","slug":"errors","depth":2,"children":[]}],"codeExamples":{},"endpoint":{"title":"Get credit balance","path":"/v1/credits/balance","servers":[{"url":"https://inference.magica.com"}],"method":"get","request":{"security":[{"title":"Bearer Auth","parameters":{"header":{"Authorization":{"type":"http","scheme":"bearer","description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token."}},"query":{},"cookie":{}}}],"parameters":{"query":{},"header":{"Authorization":{"schema":[{"type":"string","description":"Bearer API key. Format: `Bearer gx_your_api_key` .","required":true}]}},"cookie":{},"path":{}},"body":{}},"response":{"200":{"application/json":{"schemaArray":[{"type":"object","properties":{"availableBalance":[{"type":"number","description":"Raw credit balance in microcredits . Divide by 1,000,000 to convert to millions. The existing numeric value and precision are unchanged."}],"formatted":[{"type":"string","description":"Legacy balance in millions without a suffix (e.g. `\"1.23\"` , `\"1.00\"` ). Nonzero inputs retain two decimal places; zero returns `\"0\"` . This existing field is unchanged for independently deployed clients. Its two-decimal precision can round small nonzero balances to `\"0.00\"` . For precision-sensitive displays, derive millions from `availableBalance` and retain sufficient decimal places: a raw balance of 1000 is `0.001M credits` , not zero."}],"hasActiveSubscription":[{"type":"boolean","description":"`true` when the user’s (or org’s) subscription is currently active, even if its available balance is zero or negative. Subscription status and available balance are separate checks."}],"isOrganization":[{"type":"boolean","description":"`true` when the returned balance belongs to an organization the user is a member of, rather than the user’s personal account."}]}}],"examples":{"example":{"value":{"availableBalance":123,"formatted":"\u003cstring>","hasActiveSubscription":true,"isOrganization":true}}}}}},"deprecated":false}},"jsLinks":[],"subdomain":"galaxyai-f8150d75","siteName":"Magica","title":"Get credit balance - Magica","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-13T08:41:48.638Z","originalFileLocation":"api-reference/credits/balance.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=\"light\"}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=\"Return the authenticated user\u0026#x27;s current credit balance.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Magica\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_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=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Get credit balance - Magica\">\u003cmeta data-mint-head property=\"og:description\" content=\"Return the authenticated user\u0026#x27;s current credit balance.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Magica\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://magica.com/docs/api-reference/credits/balance\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://galaxyai-f8150d75.mintlify.site/docs/_mintlify/api/og/v2?division=Credits\u0026amp;title=Get+credit+balance\u0026amp;description=Return+the+authenticated+user%27s+current+credit+balance.\u0026amp;theme=6ffc046dec82632af34e4ff6\u0026amp;signature=54e8a530bbd0ca9576660acf9bedbb113f7a258fcd8f21af5339c366aaebc716\">\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=\"Get credit balance - Magica\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Return the authenticated user\u0026#x27;s current credit balance.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://galaxyai-f8150d75.mintlify.site/docs/_mintlify/api/og/v2?division=Credits\u0026amp;title=Get+credit+balance\u0026amp;description=Return+the+authenticated+user%27s+current+credit+balance.\u0026amp;theme=6ffc046dec82632af34e4ff6\u0026amp;signature=54e8a530bbd0ca9576660acf9bedbb113f7a258fcd8f21af5339c366aaebc716\">\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=\"/docs/mintlify-assets/_mintlify/favicons/galaxyai-f8150d75/YAaK7oqNGFqz20z7/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Magica\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#6366f1\">\u003clink data-mint-head rel=\"canonical\" href=\"https://magica.com/docs/api-reference/credits/balance\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/api-reference/credits/balance.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://magica.com/#organization\",\"name\":\"Magica\",\"url\":\"https://magica.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/galaxyai-f8150d75/DBhRDarFZNKVqMQi/logo/logo_light_theme.svg?fit=max\u0026auto=format\u0026n=DBhRDarFZNKVqMQi\u0026q=85\u0026s=6f2c433ff16ffb278918ac9ebdf0de20\"}},{\"@type\":\"WebSite\",\"@id\":\"https://magica.com/docs#website\",\"name\":\"Magica\",\"url\":\"https://magica.com/docs\",\"publisher\":{\"@id\":\"https://magica.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://magica.com/docs/api-reference/credits/balance#webpage\",\"url\":\"https://magica.com/docs/api-reference/credits/balance\",\"name\":\"Get credit balance\",\"description\":\"Return the authenticated user's current credit balance.\",\"dateModified\":\"2026-11-13T08:41:48.638Z\",\"isPartOf\":{\"@id\":\"https://magica.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://magica.com/docs/api-reference/credits/balance#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://magica.com/docs/api-reference/credits/balance#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Magica\",\"item\":\"https://magica.com/docs\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get credit balance\",\"item\":\"https://magica.com/docs/api-reference/credits/balance\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://magica.com/docs/api-reference/credits/balance#apireference\",\"headline\":\"Get credit balance\",\"name\":\"Get credit balance\",\"description\":\"Return the authenticated user's current credit balance.\",\"url\":\"https://magica.com/docs/api-reference/credits/balance\",\"mainEntityOfPage\":{\"@id\":\"https://magica.com/docs/api-reference/credits/balance#webpage\"},\"dateModified\":\"2026-11-13T08:41:48.638Z\",\"publisher\":{\"@id\":\"https://magica.com/#organization\"},\"isPartOf\":{\"@id\":\"https://magica.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Magica\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Magica\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/docs/api-reference/credits/balance.md","siteName":"Magica","nav":{"global":null,"tabs":[{"tab":"Introduction","pages":[{"title":"Introduction","href":"/introduction/overview"}]},{"tab":"API Reference","groups":[{"group":"Overview","pages":[{"title":"Authentication","href":"/authentication"},{"title":"Webhooks","href":"/webhooks"}]},{"group":"Models","pages":[{"title":"List all models","api":"GET /v1/models","href":"/api-reference/nodes/list-models"},{"title":"Get public model catalog","openapi":"GET /v1/models/catalog","href":"/api-reference/nodes/model-catalog"},{"title":"Search models","api":"GET /v1/models/search","href":"/api-reference/nodes/search"},{"title":"Get model input schema","api":"GET /v1/models/{modelId}/schema","href":"/api-reference/nodes/model-schema"},{"title":"Get model pricing","openapi":"GET /v1/models/{modelId}/pricing","href":"/api-reference/nodes/model-pricing"}]},{"group":"Standalone Model Runs","pages":[{"title":"Run a model","openapi":"POST /v1/nodes/{nodeType}/run","href":"/api-reference/nodes/run"},{"title":"Estimate node credits","api":"POST /v1/nodes/estimate-credits","href":"/api-reference/nodes/estimate-credits"},{"title":"Get model run","openapi":"GET /v1/nodes/runs/{runId}","href":"/api-reference/nodes/get-model-run"},{"title":"List deprecated models","openapi":"GET /v1/nodes/deprecated-models","href":"/api-reference/nodes/deprecated-models"},{"title":"Get deprecated model runs","openapi":"GET /v1/nodes/deprecated-models/{nodeType}/runs","href":"/api-reference/nodes/deprecated-model-runs"}]},{"group":"LLM Gateway","pages":[{"title":"LLM Gateway","href":"/api-reference/llm/overview"},{"title":"Create a chat completion","api":"POST /v1/chat/completions","href":"/api-reference/llm/chat-completions"},{"title":"Create a Messages response","api":"POST /v1/messages","href":"/api-reference/llm/messages"},{"title":"Create a response","api":"POST /v1/responses","href":"/api-reference/llm/responses"},{"title":"List language models","api":"GET /v1/llm/models.json","description":"List available language models, capabilities, limits, and pricing.","href":"/api-reference/llm/models-catalog"}]},{"group":"Credits","pages":[{"title":"Get credit balance","api":"GET /v1/credits/balance","href":"/api-reference/credits/balance"}]},{"group":"Generated Media","pages":[{"title":"Upload media","openapi":"POST /v1/uploads","description":"Import a URL, data URI, or raw base64 media source into permanent storage for the authenticated API key owner.","href":"/api-reference/media-library/upload"},{"title":"List media generations","openapi":"GET /v1/media-library/list","href":"/api-reference/media-library/list"},{"title":"Get media library stats","openapi":"GET /v1/media-library/stats","href":"/api-reference/media-library/stats"}]}]},{"tab":"MCP Server","pages":[{"title":"MCP Server","href":"/mcp-server/overview"}]}]},"basePath":"","title":"Get credit balance - Magica","buildId":"dpl_4UDxC3erAcBDHX8QT9FjyxxnLZSQ","deploymentId":"dpl_4UDxC3erAcBDHX8QT9FjyxxnLZSQ","dynamics":["c2aa737661","2b790eda92","b0f84f53ff"],"chunks":["OpenApiReferenceProvider-CpJ44y6j.js","utils-DRi8JwoB.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-D6b6ny2H.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-CgBjVdxd.js","snippetPresets-u4Are-mZ.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-DTFiS5AN.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-DuAEpWYt.js","shallow-BzqLj4xC.js","getApiPlaygroundDisplay-CKb7GIdu.js","CodeSnippet-BaOQDoQh.js","CodeSnippets-CNRiM0PE.js","Page-BlovTRO5.js","getPastedJson-qjrnOjTO.js","icon-Dt4VFpdV.js","MethodPill-c-UgMFw3.js","DuplicateIcon-BRwru6S6.js","createIcon-DBGdUgXw.js","DynamicMarkdown-B7gJlzwx.js","SectionHeading-CCarmMPF.js","axios-vUo_bRtp.js"]}