curl https://api.stepfun.ai/v1/token/count \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $STEP_API_KEY" \ -d '{ "model": "step-5-preview", "messages": [ { "role": "system", "content": "You are an AI assistant provided by StepFun. You excel at conversations in Chinese, English, and other languages. While keeping user data safe, you should answer quickly and accurately, and reject any content related to pornography, drugs, gambling, violence, or terrorism." }, { "role": "user", "content": "Hi, please introduce StepFun'\''s AI!" } ] }'
{ "data": { "total_tokens": 85 }}
curl https://api.stepfun.ai/v1/token/count \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $STEP_API_KEY" \ -d '{ "model": "step-5-preview", "messages": [ { "role": "system", "content": "You are an AI assistant provided by StepFun. You excel at Chinese, English, and many other languages, and you can describe user-provided images precisely. Keep user data safe, answer quickly and accurately, and refuse content related to pornography, drugs, gambling, violence, or terrorism." }, { "role": "user", "content": [ { "type": "text", "text": "Describe this picture in elegant language." }, { "type": "image_url", "image_url": { "url": "https://www.stepfun.com/assets/section-1-CTe4nZiO.webp" } } ] } ] }'
{ "data": { "total_tokens": 497 }}
# Load an image into memory (demo only; read from a file as needed)image_base64="data:image/webp;base64,"$(curl -s "https://www.stepfun.com/assets/section-1-CTe4nZiO.webp" | base64)curl https://api.stepfun.ai/v1/token/count \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $STEP_API_KEY" \ -d "{ \"model\": \"step-5-preview\", \"messages\": [ { \"role\": \"system\", \"content\": \"You are an AI assistant provided by StepFun. You excel at Chinese, English, and many other languages, and you can describe user-provided images precisely. Keep user data safe, answer quickly and accurately, and refuse content related to pornography, drugs, gambling, violence, or terrorism.\" }, { \"role\": \"user\", \"content\": [ { \"type\": \"text\", \"text\": \"Describe this image in elegant language.\" }, { \"type\": \"image_url\", \"image_url\": { \"url\": \"${image_base64}\" } } ] } ] }"
{ "data": { "total_tokens": 497 }}
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"StepFun Documentation","colors":{"primary":"#00A9FF","light":"#62D3FF","dark":"#00A9FF"},"logo":{"light":"https://mintcdn.com/stepfun2/eWvXirWayONQ7ys_/images/brand/stepfun-logo-v2-light.png?fit=max\u0026auto=format\u0026n=eWvXirWayONQ7ys_\u0026q=85\u0026s=7429958a20f7dbfac80be59824beb913","dark":"https://mintcdn.com/stepfun2/eWvXirWayONQ7ys_/images/brand/stepfun-logo-v2-dark.png?fit=max\u0026auto=format\u0026n=eWvXirWayONQ7ys_\u0026q=85\u0026s=8ddcc5aca47afb77831432995301fd4a","href":"https://platform.stepfun.ai"},"favicon":"https://mintcdn.com/stepfun2/eWvXirWayONQ7ys_/images/brand/stepfun-favicon-v2.svg?fit=max\u0026auto=format\u0026n=eWvXirWayONQ7ys_\u0026q=85\u0026s=cc27f5cd152ddf49557a7be5007ded70","appearance":{"default":"light","strict":true},"background":{"color":{"light":"#F8F8F6","dark":"#111315"}},"fonts":{"heading":{"family":"Step Serif Core","weight":700,"source":"theme/stepfun/fonts/step-serif-bold-core.woff2","format":"woff2"},"body":{"family":"Step Sans Core","weight":400,"source":"theme/stepfun/fonts/step-sans-regular-core.woff2","format":"woff2"}},"styling":{"eyebrows":"breadcrumbs","codeblocks":{"theme":{"light":"light-plus","dark":"dark-plus"}},"latex":false},"contextual":{"options":["copy"],"display":"header"},"interaction":{"drilldown":false},"navigation":{"languages":[{"language":"en","navbar":{"links":[{"href":"https://platform.stepfun.ai/interface-key","label":"API Key"},{"href":"https://platform.stepfun.ai/account-info","label":"Account"}]},"href":"en/welcome"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"stepfun2","hasAudioNarration":false,"actualSubdomain":"stepfun2","customDomains":["platform.stepfun.ai"],"gitSource":{"type":"github","owner":"stepfun-ai","repo":"stepfun-docs-en","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6afb0cc9426e047513be4beb","clientVersion":"0.0.4160","searchFilterCounts":[{"language":"en","tag":"Developer Guides","count":30},{"language":"en","tag":"Step Code","count":24},{"language":"en","tag":"API Reference","count":21},{"language":"en","tag":"Integrations","count":18},{"language":"en","tag":"Audio","count":17},{"language":"en","tag":"Models","count":16},{"language":"en","tag":"Step Plan","count":10},{"language":"en","tag":"Platform Guides","count":9},{"language":"en","tag":"Customization","count":6},{"language":"en","tag":"Guides","count":5}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"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":[{"filePath":"custom.css","href":"/docs/_mintlify/custom/stepfun2/687e2eaf806e14b6/custom.css"},{"filePath":"theme/stepfun/fonts.css","href":"/docs/_mintlify/custom/stepfun2/6b947437f2a35382/theme/stepfun/fonts.css"},{"filePath":"theme/stepfun/styles.css","content":"html[lang]{--step-site-font-heading: \"Step Serif\", \"Songti SC\", serif;--step-site-font-body: \"Step Sans\", \"PingFang SC\", \"Microsoft YaHei\", sans-serif;--step-font-mono: \"Step Mono\", \"SFMono-Regular\", Consolas, \"Step Sans\", monospace;--step-background: #f8f8f6;--step-paper: #f7f7f5;--step-surface: #ffffff;--step-ink: #1a1a1a;--step-muted: #656565;--step-rule: 221 221 217;--step-line: #ddddd9;--step-accent: #00a9ff;--step-signal: var(--step-accent);--step-wash: #eaf2f6;--step-beige: #f3ebe1;--step-mist: #d8e2ec;--step-code-bar: #f0f0ef;--step-api-border-light: 0 169 255;--step-api-border-dark: 98 211 255;--step-api-fg-light: 26 26 26;--step-api-fg-dark: 235 237 239;--step-api-heading-light: 26 26 26;--step-api-heading-dark: 243 245 247;--step-api-muted-light: 101 101 101;--step-api-muted-dark: 174 182 191;--step-api-card-border-light: #ddddd9;--step-api-card-border-dark: #353a40;--step-api-card-fill-light: #ffffff;--step-api-card-fill-dark: #191c20;--step-api-hero-bg-light: #edf1f3;--step-api-hero-bg-dark: #202b33;--step-api-card-shadow-light: none;--step-api-card-shadow-dark: none;--step-api-soft-ring-light: none;--step-api-soft-ring-dark: none;--step-overview-border-light: #ddddd9;--step-overview-border-dark: #353a40;--step-overview-surface-light: #ffffff;--step-overview-surface-dark: #191c20;--step-overview-muted-light: #eaf2f6;--step-overview-muted-dark: #23333d;--step-overview-shadow-light: none;--step-overview-shadow-dark: none;--step-overview-text-muted-light: #656565;--step-overview-text-muted-dark: #aeb6bf;--step-overview-heading-light: #1a1a1a;--step-overview-heading-dark: #f3f5f7}html.dark{color-scheme:dark;--step-background: #111315;--step-paper: #111315;--step-surface: #191c20;--step-ink: #f3f5f7;--step-muted: #aeb6bf;--step-rule: 53 58 64;--step-line: #353a40;--step-accent: #62d3ff;--step-wash: #23333d;--step-beige: #292720;--step-mist: #233747;--step-code-bar: #252526}html body{background:var(--step-background);color:var(--step-ink);font-family:var(--step-site-font-body);-webkit-font-smoothing:antialiased}html #background-color{background:var(--step-background)}html #navbar,html #navbar-transition{background:var(--step-paper);border-color:var(--step-line)}html #navbar{border-bottom:1px solid var(--step-line)}html [id=\"localization-select-trigger\"]{display:none!important}html #search-bar-entry{background:var(--step-surface);border:1px solid var(--step-line);border-radius:6px;box-shadow:none}html #sidebar{background:var(--step-paper);border-right:1px solid var(--step-line)}html #sidebar a{border-radius:4px;transition:background-color 150ms ease, color 150ms ease}html #sidebar a:hover{background:var(--step-wash)}html #sidebar a[aria-current=\"page\"],html #sidebar a[data-state=\"active\"]{background:var(--step-wash);color:var(--step-accent);box-shadow:inset 2px 0 var(--step-signal)}html #content-container{color:var(--step-ink)}html #content-container :is(h1,h2,h3,h4){color:var(--step-ink);font-family:var(--step-site-font-heading);font-weight:700;letter-spacing:-0.025em;line-height:1.45;overflow-wrap:anywhere}html #content-container #page-title{font-size:clamp(2rem, 3.3vw, 2.8rem);line-height:1.25;text-wrap:balance;margin-bottom:0.6rem}html #content-container #header{padding-bottom:1.4rem;border-bottom:1px solid var(--step-line);margin-bottom:2rem}html #content-container :is(p,li,[data-as=\"p\"]){line-height:1.85}html #content-container :is(pre,code,kbd),html #content-container [data-component-part=\"field-name\"]{font-family:var(--step-font-mono)}html #content-container pre{font-size:0.84rem;line-height:1.8;tab-size:2}html #content-container :not(pre)>code{border-radius:3px}html #content-container :is(.code-block,.code-group){border:1px solid var(--step-line);border-radius:6px;box-shadow:none}html #content-container [data-component-part=\"code-group-tab-bar\"]{background:var(--step-code-bar);border-bottom:1px solid var(--step-line)}html #content-container [data-component-part=\"tabs-list\"]{gap:3rem;padding:0 0 1.5px;border:0!important;border-radius:0;background:transparent;overflow-x:auto;box-shadow:inset 0 -1px 0 var(--step-line)}html #content-container [data-component-part=\"tab-button\"]{flex-shrink:0;padding:0.7rem 0.1rem;border-radius:0;color:var(--step-muted);font-family:var(--step-site-font-body);box-shadow:none;white-space:nowrap}html #content-container [data-component-part=\"tab-button\"][data-active=\"true\"]{background:transparent;color:var(--step-accent);border-bottom:2px solid var(--step-signal)!important;box-shadow:none;transform:none}html #content-container :is(.card,.api-hero,.api-card,.api-related-link,.api-meta-strip__item,.api-workflow-list__item,.step-overview-card,.step-overview-board__hero,.step-plan-tool-card){border-color:var(--step-line);border-radius:6px;box-shadow:none}html #content-container :is(.card,.step-plan-tool-card){background:var(--step-surface)}html #content-container :is(a.card,.api-card--link,.step-overview-card--linked,.step-plan-tool-card--link):hover{border-color:var(--step-accent);background:var(--step-wash);box-shadow:none}html #content-container table{border-color:var(--step-line);border-radius:4px;background:var(--step-surface);box-shadow:none}html #content-container table :is(th,td){padding:0.625rem 0.75rem}html #content-container table thead th{background:var(--step-wash);color:var(--step-ink);border-color:var(--step-line);font-family:var(--step-site-font-body);text-transform:none;letter-spacing:0}html #content-container table td{position:relative;border-color:var(--step-line)}html #content-container .callout{--step-callout-accent: var(--step-signal);border:1px solid var(--step-line);border-left:3px solid var(--step-callout-accent);border-radius:5px;background:color-mix(in srgb, var(--step-mist) 40%, var(--step-paper))!important;padding:1rem 1.2rem;gap:0.8rem;box-shadow:none;color:var(--step-ink)}html #content-container .callout[data-callout-type=\"info\"]{--step-callout-accent: var(--step-muted);background:var(--step-paper)!important}html #content-container .callout[data-callout-type=\"tip\"]{background:var(--step-beige)!important}html #content-container .callout:is([data-callout-type=\"warning\"],[data-callout-type=\"danger\"],[data-callout-type=\"error\"],[data-callout-type=\"caution\"]){--step-callout-accent: #f9b845;background:var(--step-beige)!important}html #content-container [data-component-part=\"callout-content\"],html #content-container [data-component-part=\"callout-icon\"] svg{color:var(--step-ink)}html #content-container [data-component-part=\"callout-icon\"]{flex:none}html #content-container [data-component-part=\"callout-content\"]{overflow-wrap:anywhere}html #content-container [data-component-part=\"callout-content\"] a{text-decoration:underline;text-underline-offset:3px}html #content-container li:has(>br):has(>code:first-child+code)>code:first-child,html #content-container li>span[data-as=\"p\"]:has(>br):has(>code:first-child+code)>code:first-child,html #content-container li:has(>details):has(>code:first-child+code)>code:first-child,html #content-container li:has(>details)>span[data-as=\"p\"]:has(>code:first-child+code)>code:first-child{color:var(--step-ink);background-color:var(--step-mist);border-radius:3px;font-weight:600}html #content-container blockquote{background:var(--step-beige);border-left:2px solid var(--step-accent);border-radius:0 4px 4px 0;color:var(--step-muted)}html #content-container #content>h2{border-color:var(--step-line)}html #content-container #content>h2::before{width:0.3rem;border-radius:0;background:var(--step-signal);box-shadow:none}html #content-container .sf-qcards{grid-template-columns:repeat(3, minmax(0, 1fr));gap:12px;counter-reset:entry}html #content-container .sf-qcard{position:relative;min-width:0;padding:1.2rem;border:1px solid var(--step-line);border-radius:5px;background:var(--step-surface);color:var(--step-ink);counter-increment:entry}html #content-container .sf-qcard::after{content:\"0\" counter(entry) \" ↗\";position:absolute;top:1.2rem;right:1.2rem;font:0.7rem var(--step-font-mono);color:var(--step-muted)}html #content-container .sf-qcard:first-child{background:var(--step-mist)}html #content-container .sf-qcard:hover{border-color:var(--step-accent);transform:translateY(-2px)}html #content-container .sf-qcard h4{font-family:var(--step-site-font-body);font-size:0.95rem}html #content-container .sf-qcard p{color:var(--step-muted);opacity:1;font-size:0.78rem;line-height:1.7}html #content-container :is(.step-overview-section__eyebrow,.step-overview-card__family,.step-overview-card__link-label){color:var(--step-accent)}html #content-container .step-overview-card__title{font-family:var(--step-site-font-heading);font-size:1.55rem;color:var(--step-ink)}html #content-container :is(.step-overview-card__metric,.step-overview-card__tag){border-radius:4px;background:var(--step-wash);color:var(--step-accent);box-shadow:none}html :is(a,button,input,select,summary,[role=\"tab\"]):focus-visible{outline:2px solid var(--step-accent);outline-offset:4px}html #content-container #content>h2{display:flex;align-items:baseline;gap:0.65rem;margin-block:2.5rem 1.1rem;padding-bottom:0.65rem;border-bottom:1px solid var(--step-line)}html #content-container #content>h2::before{content:\"\";flex:none;height:1.2rem}html #table-of-contents a{color:var(--step-muted)}@media (max-width: 1023px){html #content-container .sf-qcards{grid-template-columns:repeat(2, minmax(0, 1fr))}}@media (max-width: 640px){html #content-container #page-title{font-size:1.9rem}html #content-container .sf-qcards{grid-template-columns:minmax(0, 1fr)}html #content-container :is(.code-block,.code-group,.tabs){min-width:0;max-width:100%}html #content-container table{display:block;max-width:100%;overflow-x:auto}}@media (prefers-reduced-motion: reduce){html #content-container .sf-qcard,html #sidebar a{transition:none;transform:none}}"}],"page":{"pagePath":"en/api-reference/token-count","slug":"/en/api-reference/token-count","pageMetadata":{"title":"Token Count","description":null,"href":"/en/api-reference/token-count"},"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`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Expandable,Heading,Tab,Tabs}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Expandable)_missingMdxReference(`Expandable`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Calculate the token count for a conversation. The request format is similar to the Chat Completion API.`}),`\n`,_jsx(Heading,{level:`2`,id:`endpoint`,children:`Endpoint`}),`\n`,_jsx(_components.p,{children:_jsx(_components.code,{children:`POST https://api.stepfun.ai/v1/token/count`})}),`\n`,_jsx(Heading,{level:`2`,id:`request-parameters`,children:`Request parameters`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`model`}),` `,_jsx(_components.code,{children:`string`}),` `,_jsx(_components.em,{children:_jsx(_components.strong,{children:`required`})}),_jsx(`br`,{}),`Model name to use.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`messages`}),` `,_jsx(_components.code,{children:`object array`}),` `,_jsx(_components.em,{children:_jsx(_components.strong,{children:`required`})}),_jsx(`br`,{}),`Conversation so far, including user and assistant messages.`]}),`\n`]}),`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`System message `,_jsx(_components.code,{children:`object`})]}),`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`role`}),` `,_jsx(_components.code,{children:`string`}),_jsx(`br`,{}),`Always `,_jsx(_components.code,{children:`system`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`content`}),` `,_jsx(_components.code,{children:`string`}),_jsx(`br`,{}),`System message text.`]}),`\n`]})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`User message `,_jsx(_components.code,{children:`object`})]}),`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`role`}),` `,_jsx(_components.code,{children:`string`}),_jsx(`br`,{}),`Always `,_jsx(_components.code,{children:`user`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`content`}),` `,_jsx(_components.code,{children:`string or object array`}),_jsx(`br`,{}),`User message content: either a `,_jsx(_components.code,{children:`multipart`}),` list or a plain text string.`]}),`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Plain text`}),` `,_jsx(_components.code,{children:`string`}),_jsx(`br`,{}),`Directly pass a string as the message content.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`multipart`}),` list `,_jsx(_components.code,{children:`object array`}),_jsx(`br`,{}),`Structured multimodal message.`]}),`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Text message `,_jsx(_components.code,{children:`object`})]}),`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`type`}),` `,_jsx(_components.code,{children:`string`}),_jsx(`br`,{}),`Always `,_jsx(_components.code,{children:`text`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`text`}),` `,_jsx(_components.code,{children:`string`}),_jsx(`br`,{}),`Text content.`]}),`\n`]})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Image message `,_jsx(_components.code,{children:`object`})]}),`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`type`}),` `,_jsx(_components.code,{children:`string`}),_jsx(`br`,{}),`Always `,_jsx(_components.code,{children:`image_url`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`image_url`}),` `,_jsx(_components.code,{children:`object`})]}),`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`url`}),` `,_jsx(_components.code,{children:`string`}),_jsx(`br`,{}),`Image URL or base64 string.\n`,_jsx(`p`,{children:`URLs support only http and https.`}),`\n`,_jsxs(`p`,{children:[`Base64 example: `,_jsx(_components.code,{children:\"data:image/jpeg;base64,${base64_string}\"}),` (replace jpeg with your format and the encoded data).`]}),`\n`,_jsx(`p`,{children:`Supported image formats: jpg/jpeg, png, webp, static gif.`})]}),`\n`]})}),`\n`]}),`\n`]})}),`\n`]}),`\n`]})}),`\n`]}),`\n`]})}),`\n`]}),`\n`]})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Assistant message `,_jsx(_components.code,{children:`object`})]}),`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`role`}),` `,_jsx(_components.code,{children:`string`}),_jsx(`br`,{}),`Always `,_jsx(_components.code,{children:`assistant`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`content`}),` `,_jsx(_components.code,{children:`string | null`}),_jsx(`br`,{}),`Assistant message text.`]}),`\n`]})}),`\n`]}),`\n`]})}),`\n`,_jsx(Heading,{level:`2`,id:`response`,children:`Response`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`data`}),` `,_jsx(_components.code,{children:`object`}),_jsx(`br`,{}),`Token count result.`,`\n`,_jsx(Expandable,{children:_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`total_tokens`}),` `,_jsx(_components.code,{children:`int`}),_jsx(`br`,{}),`Total tokens in the request.`]}),`\n`]})}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`examples`,children:`Examples`}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`Text chat`,id:`text-chat`,children:[_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes light-plus dark-plus`,style:{backgroundColor:`#FFFFFF`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#000000`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#795E26`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` https://api.stepfun.ai/v1/token/count`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#001080`,\"--shiki-dark\":`#9CDCFE`},children:`$STEP_API_KEY`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"model\": \"step-5-preview\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"messages\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"role\": \"system\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"content\": \"You are an AI assistant provided by StepFun. You excel at conversations in Chinese, English, and other languages. While keeping user data safe, you should answer quickly and accurately, and reject any content related to pornography, drugs, gambling, violence, or terrorism.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"role\": \"user\",`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"content\": \"Hi, please introduce StepFun'`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\'`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`'s AI!\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes light-plus dark-plus`,style:{backgroundColor:`#FFFFFF`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#000000`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0451A5`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0451A5`,\"--shiki-dark\":`#9CDCFE`},children:` \"total_tokens\"`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#098658`,\"--shiki-dark\":`#B5CEA8`},children:`85`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),_jsxs(Tab,{title:`Mixed media`,id:`mixed-media`,children:[_jsx(CodeBlock,{filename:``,numberOfLines:`27`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes light-plus dark-plus`,style:{backgroundColor:`#FFFFFF`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#000000`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`27`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#795E26`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` https://api.stepfun.ai/v1/token/count`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#001080`,\"--shiki-dark\":`#9CDCFE`},children:`$STEP_API_KEY`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"model\": \"step-5-preview\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"messages\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"role\": \"system\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"content\": \"You are an AI assistant provided by StepFun. You excel at Chinese, English, and many other languages, and you can describe user-provided images precisely. Keep user data safe, answer quickly and accurately, and refuse content related to pornography, drugs, gambling, violence, or terrorism.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"role\": \"user\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"content\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"type\": \"text\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"text\": \"Describe this picture in elegant language.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"type\": \"image_url\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"image_url\": {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"url\": \"https://www.stepfun.com/assets/section-1-CTe4nZiO.webp\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})}),_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes light-plus dark-plus`,style:{backgroundColor:`#FFFFFF`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#000000`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0451A5`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0451A5`,\"--shiki-dark\":`#9CDCFE`},children:` \"total_tokens\"`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#098658`,\"--shiki-dark\":`#B5CEA8`},children:`497`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]}),_jsxs(Tab,{title:`Base64 image`,id:`base64-image`,children:[_jsx(CodeBlock,{filename:``,numberOfLines:`30`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes light-plus dark-plus`,style:{backgroundColor:`#FFFFFF`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#000000`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`30`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#008000`,\"--shiki-dark\":`#6A9955`},children:`# Load an image into memory (demo only; read from a file as needed)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#001080`,\"--shiki-dark\":`#9CDCFE`},children:`image_base64`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`\"data:image/webp;base64,\"`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`$(`}),_jsx(_components.span,{style:{color:`#795E26`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -s`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"https://www.stepfun.com/assets/section-1-CTe4nZiO.webp\"`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:` | `}),_jsx(_components.span,{style:{color:`#795E26`,\"--shiki-dark\":`#DCDCAA`},children:`base64`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#795E26`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` https://api.stepfun.ai/v1/token/count`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#001080`,\"--shiki-dark\":`#9CDCFE`},children:`$STEP_API_KEY`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0000FF`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` \"{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`model`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`step-5-preview`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`messages`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`role`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`system`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`content`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`You are an AI assistant provided by StepFun. You excel at Chinese, English, and many other languages, and you can describe user-provided images precisely. Keep user data safe, answer quickly and accurately, and refuse content related to pornography, drugs, gambling, violence, or terrorism.`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`role`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`user`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`content`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`type`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`text`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`text`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`Describe this image in elegant language.`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`type`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`image_url`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`image_url`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`url`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`: `}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:\"${\"}),_jsx(_components.span,{style:{color:`#001080`,\"--shiki-dark\":`#9CDCFE`},children:`image_base64`}),_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:`}`}),_jsx(_components.span,{style:{color:`#EE0000`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A31515`,\"--shiki-dark\":`#CE9178`},children:` }\"`})}),`\n`]})})}),_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes light-plus dark-plus`,style:{backgroundColor:`#FFFFFF`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#000000`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0451A5`,\"--shiki-dark\":`#9CDCFE`},children:` \"data\"`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0451A5`,\"--shiki-dark\":`#9CDCFE`},children:` \"total_tokens\"`}),_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#098658`,\"--shiki-dark\":`#B5CEA8`},children:`497`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#000000`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})})]})]})]})}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":{"codeStyling":{"theme":{"light":"light-plus","dark":"dark-plus"}},"config":{},"pageMetadata":{"title":"Token Count","description":null,"href":"/en/api-reference/token-count"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Endpoint","slug":"endpoint","depth":2,"children":[]},{"title":"Request parameters","slug":"request-parameters","depth":2,"children":[]},{"title":"Response","slug":"response","depth":2,"children":[]},{"title":"Examples","slug":"examples","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"stepfun2","siteName":"StepFun Documentation","title":"Token Count - StepFun Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/en/api-reference/token-count","matchLevel":0}}},"lastModified":"2026-11-05T10:45:11.436Z","originalFileLocation":"en/api-reference/token-count.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"light\";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=\"application-name\" content=\"StepFun Documentation\">\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/stepfun2/EUXTALjpOUbsFGdr/_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/stepfun2/EUXTALjpOUbsFGdr/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/stepfun2/EUXTALjpOUbsFGdr/_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/stepfun2/EUXTALjpOUbsFGdr/_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/stepfun2/EUXTALjpOUbsFGdr/_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/stepfun2/EUXTALjpOUbsFGdr/_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/stepfun2/EUXTALjpOUbsFGdr/_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/stepfun2/EUXTALjpOUbsFGdr/_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/stepfun2/EUXTALjpOUbsFGdr/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Token Count - StepFun Documentation\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"StepFun Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://platform.stepfun.ai/docs/en/api-reference/token-count\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://stepfun2.mintlify.site/docs/_mintlify/api/og/v2?division=Token+Count\u0026amp;title=Token+Count\u0026amp;theme=4d1c14c68b634e75705390c9\u0026amp;signature=102b2f169d0f6265a6217be011a323e36ed648f430520bb91101f95001915210\">\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=\"Token Count - StepFun Documentation\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://stepfun2.mintlify.site/docs/_mintlify/api/og/v2?division=Token+Count\u0026amp;title=Token+Count\u0026amp;theme=4d1c14c68b634e75705390c9\u0026amp;signature=102b2f169d0f6265a6217be011a323e36ed648f430520bb91101f95001915210\">\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/stepfun2/EUXTALjpOUbsFGdr/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"StepFun Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#00A9FF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://platform.stepfun.ai/docs/en/api-reference/token-count\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/en/api-reference/token-count.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://platform.stepfun.ai/#organization\",\"name\":\"StepFun Documentation\",\"url\":\"https://platform.stepfun.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/stepfun2/eWvXirWayONQ7ys_/images/brand/stepfun-logo-v2-light.png?fit=max\u0026auto=format\u0026n=eWvXirWayONQ7ys_\u0026q=85\u0026s=7429958a20f7dbfac80be59824beb913\"}},{\"@type\":\"WebSite\",\"@id\":\"https://platform.stepfun.ai/docs#website\",\"name\":\"StepFun Documentation\",\"url\":\"https://platform.stepfun.ai/docs\",\"publisher\":{\"@id\":\"https://platform.stepfun.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://platform.stepfun.ai/docs/en/api-reference/token-count#webpage\",\"url\":\"https://platform.stepfun.ai/docs/en/api-reference/token-count\",\"name\":\"Token Count\",\"dateModified\":\"2026-11-05T10:45:11.436Z\",\"isPartOf\":{\"@id\":\"https://platform.stepfun.ai/docs#website\"},\"breadcrumb\":{\"@id\":\"https://platform.stepfun.ai/docs/en/api-reference/token-count#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://platform.stepfun.ai/docs/en/api-reference/token-count#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"StepFun Documentation\",\"item\":\"https://platform.stepfun.ai/docs\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Token Count\",\"item\":\"https://platform.stepfun.ai/docs/en/api-reference/token-count\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://platform.stepfun.ai/docs/en/api-reference/token-count#article\",\"headline\":\"Token Count\",\"name\":\"Token Count\",\"url\":\"https://platform.stepfun.ai/docs/en/api-reference/token-count\",\"mainEntityOfPage\":{\"@id\":\"https://platform.stepfun.ai/docs/en/api-reference/token-count#webpage\"},\"dateModified\":\"2026-11-05T10:45:11.436Z\",\"publisher\":{\"@id\":\"https://platform.stepfun.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://platform.stepfun.ai/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"StepFun Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"StepFun Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/docs/en/api-reference/token-count.md","siteName":"StepFun Documentation","nav":{"global":null,"languages":[{"language":"en","navbar":{"links":[{"href":"https://platform.stepfun.ai/interface-key","label":"API Key"},{"href":"https://platform.stepfun.ai/account-info","label":"Account"}]},"tabs":[{"tab":"Home","pages":[{"title":"Home","href":"/en/welcome"}]},{"tab":"Models","pages":[{"title":"Models","href":"/en/guides/models/overview"}]},{"tab":"Platform Guides","pages":[{"title":"Platform Guides","href":"/en/quickstart/overview"}]},{"tab":"Developer Guides","pages":[{"title":"Developer Guides","href":"/en/guides/developer/integrations/cherry-studio"}]},{"tab":"Step Code","pages":[{"title":"Step Code","href":"/en/step-code/overview"}]},{"tab":"Step Plan","pages":[{"title":"Step Plan","href":"/en/step-plan/overview"}]},{"tab":"API Reference","groups":[{"group":"Chat","pages":[{"title":"Chat Completions API","href":"/en/api-reference/chat/chat-completion-create"},{"title":"Messages API","href":"/en/api-reference/chat/messages-create"},{"title":"Responses API","href":"/en/api-reference/responses/responses-create"}]},{"group":"Realtime","pages":[{"title":"Bidirectional Realtime Voice","href":"/en/api-reference/realtime/chat"}]},{"group":"Audio","pages":[{"group":"Text-to-Speech (TTS)","pages":[{"title":"Text-to-Speech","href":"/en/api-reference/audio/create-audio"},{"title":"Streaming Text-to-Speech","href":"/en/api-reference/audio/ws-audio"},{"title":"Get system voices","href":"/en/api-reference/audio/system-voices"},{"title":"List cloned voices","href":"/en/api-reference/audio/list-voice"}]},{"title":"Audio Generation","href":"/en/api-reference/audio/generate"},{"title":"Music Generation","href":"/en/api-reference/audio/music"},{"group":"Voice Cloning","pages":[{"title":"Preview cloned voice","href":"/en/api-reference/audio/voices-preview"},{"title":"Create cloned voice","href":"/en/api-reference/audio/create-voice"}]},{"group":"Speech Recognition (ASR)","pages":[{"title":"Speech Recognition (Streaming Output)","href":"/en/api-reference/audio/asr-sse"},{"title":"Streaming Speech Recognition (Bidirectional Streaming)","href":"/en/api-reference/audio/asr-stream"}]}]},{"group":"Models","pages":[{"title":"List models","href":"/en/api-reference/models/list"},{"title":"Get a single model","href":"/en/api-reference/models/retrieve"},{"title":"Model object","href":"/en/api-reference/models/object"}]},{"group":"Account","pages":[{"title":"Get account details","href":"/en/api-reference/accounts/get"}]},{"group":"Tool Call","pages":[{"title":"Tool Call","description":null,"href":"/en/api-reference/tool-call"}]},{"group":"Token Count","pages":[{"title":"Token Count","href":"/en/api-reference/token-count"}]},{"group":"Error Codes","pages":[{"title":"Error Codes","description":null,"href":"/en/api-reference/error-codes"}]}]}]}]},"basePath":"","title":"Token Count - StepFun Documentation","buildId":"dpl_5Wnaxc3m8t3HZwdvwe36fSBdcT12","deploymentId":"dpl_5Wnaxc3m8t3HZwdvwe36fSBdcT12","dynamics":[],"chunks":[]}