It takes one of routehub.REASONING_EFFORTS: "none", "minimal", "low", "medium", "high" or "xhigh".
Provider
What RouteHub sends
OpenAI-compatible providers
reasoning_effort as given
Claude before 4.7
A thinking budget: 1,024 tokens for minimal and low, 2,048 for medium, 4,096 for high, 8,192 for xhigh. max_tokens is raised above the budget when needed.
Claude 4.7 and later reject temperature, top_p and top_k on every call. RouteHub raises UnsupportedParamsError, or drops them when you pass drop_params=True.
reasoning_content (text) and thinking_blocks (Claude’s signed blocks) exist on the message only when the provider returned reasoning, so read them with getattr. DeepSeek’s reasoning_content comes through the same way.In a Claude tool loop with thinking, send thinking_blocks back on the assistant message, as Anthropic requires. Appending message.model_dump(exclude_none=True) does this for you. See Tool calling.
Thinking tokens are reported in usage.completion_tokens_details.reasoning_tokens and counted in completion_tokens, as OpenAI does:
details = response.usage.completion_tokens_detailsprint(details.reasoning_tokens if details else 0)
Gemini’s OpenAI-compatible endpoint bills reasoning in total_tokens only, so RouteHub fills in the difference. An answer that spent its whole max_tokens budget thinking comes back with finish_reason == "length", empty content, and a usage block that adds up.
Pass drop_params=True to drop reasoning_effort on models that don’t support reasoning instead of failing.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"swarms","colors":{"primary":"#DC2626","light":"#FFFFFF","dark":"#000000"},"logo":{"light":"https://mintcdn.com/kyegomez-swarms-97/2Wfh9aBTbMWV_Lyz/logo/light.svg?fit=max\u0026auto=format\u0026n=2Wfh9aBTbMWV_Lyz\u0026q=85\u0026s=e3d664b8b8f6928c836776b54704d076","dark":"https://mintcdn.com/kyegomez-swarms-97/2Wfh9aBTbMWV_Lyz/logo/dark.svg?fit=max\u0026auto=format\u0026n=2Wfh9aBTbMWV_Lyz\u0026q=85\u0026s=d1f710292b2b40794b44a3168a6b09dc"},"favicon":"https://mintcdn.com/kyegomez-swarms-97/UEClO9jJGrigmMUe/logo.svg?fit=max\u0026auto=format\u0026n=UEClO9jJGrigmMUe\u0026q=85\u0026s=07dcb5f5b9bca5ec8fd6475dcc9b5484","navbar":{"primary":{"type":"github","href":"https://github.com/kyegomez/swarms"}},"footer":{"socials":{"twitter":"https://twitter.com/swarms_corp","github":"https://github.com/kyegomez/swarms","website":"https://swarms.ai","linkedin":"https://www.linkedin.com/company/the-swarm-corporation","discord":"https://discord.gg/EamjgSaEQf","youtube":"https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ","medium":"https://medium.com/@kyeg"}},"contextual":{"options":["copy","view","chatgpt","claude","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"kyegomez-swarms-97","hasAudioNarration":false,"actualSubdomain":"kyegomez-swarms-97","customDomains":["docs.swarms.world"],"gitSource":{"type":"github","owner":"the-swarm-corporation","repo":"swarms-framework-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ade23e790f989adb24e9f4e","collectionId":"815788a1-2aa9-45ee-8bd7-09e5e07a13da","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ade23e790f989adb24e9f4e"},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6ade27d790f989adb24ebb0c","clientVersion":"0.0.3965","searchFilterCounts":[{"language":"default","tag":"Examples","count":111},{"language":"default","tag":"Documentation","count":58},{"language":"default","tag":"API Reference","count":54},{"language":"default","tag":"Multi-Agent Harnesses","count":37},{"language":"default","tag":"RouteHub","count":17},{"language":"default","tag":"MCP Tool Integrations","count":15},{"language":"default","tag":"Community","count":13},{"language":"default","tag":"Model Providers","count":13},{"language":"default","tag":"Multi-Agent Architectures","count":12},{"language":"default","tag":"Integrations","count":12}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-v7-file-tree","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-nav-generations","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-agent-model-picker","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"isAtlas":false,"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"routehub/reasoning","slug":"/routehub/reasoning","pageMetadata":{"title":"Reasoning","description":"Control thinking with reasoning_effort across OpenAI, Claude, Gemini and DeepSeek, and read reasoning output and tokens","href":"/routehub/reasoning"},"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: \"Control thinking with reasoning_effort across OpenAI, Claude, Gemini and DeepSeek, and read reasoning output and tokens\"\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`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`set-the-reasoning-effort`,children:`Set the reasoning effort`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`reasoning_effort`}),` works the same way on every provider that supports reasoning:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,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:`10`,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:` routehub`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` routehub.completion(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Plan a zero-downtime database migration.\"`}),_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:` reasoning_effort`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"medium\"`}),_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:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`message `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message`})]}),`\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:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`getattr`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(message, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"reasoning_content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`None`}),_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:`(message.content)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`It takes one of `,_jsx(_components.code,{children:`routehub.REASONING_EFFORTS`}),`: `,_jsx(_components.code,{children:`\"none\"`}),`, `,_jsx(_components.code,{children:`\"minimal\"`}),`, `,_jsx(_components.code,{children:`\"low\"`}),`, `,_jsx(_components.code,{children:`\"medium\"`}),`, `,_jsx(_components.code,{children:`\"high\"`}),` or `,_jsx(_components.code,{children:`\"xhigh\"`}),`.`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Provider`}),_jsx(_components.th,{children:`What RouteHub sends`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`OpenAI-compatible providers`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`reasoning_effort`}),` as given`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Claude before 4.7`}),_jsxs(_components.td,{children:[`A thinking budget: 1,024 tokens for minimal and low, 2,048 for medium, 4,096 for high, 8,192 for xhigh. `,_jsx(_components.code,{children:`max_tokens`}),` is raised above the budget when needed.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Claude 4.7 and later (Opus 4.7, Claude 5 models)`}),_jsx(_components.td,{children:`Adaptive thinking at that effort`})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`configure-claude’s-thinking-directly`,children:`Configure Claude’s thinking directly`}),`\n`,_jsxs(_components.p,{children:[`Pass `,_jsx(_components.code,{children:`thinking=`}),` to set Claude’s thinking yourself. It wins over `,_jsx(_components.code,{children:`reasoning_effort`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` routehub.completion(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`messages,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` thinking`}),_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:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"enabled\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"budget_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2048`}),_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`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Claude 4.7 and later reject `,_jsx(_components.code,{children:`temperature`}),`, `,_jsx(_components.code,{children:`top_p`}),` and `,_jsx(_components.code,{children:`top_k`}),` on every call. RouteHub raises `,_jsx(_components.code,{children:`UnsupportedParamsError`}),`, or drops them when you pass `,_jsx(_components.code,{children:`drop_params=True`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`read-reasoning-output`,children:`Read reasoning output`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`reasoning_content`}),` (text) and `,_jsx(_components.code,{children:`thinking_blocks`}),` (Claude’s signed blocks) exist on the message only when the provider returned reasoning, so read them with `,_jsx(_components.code,{children:`getattr`}),`. DeepSeek’s `,_jsx(_components.code,{children:`reasoning_content`}),` comes through the same way.`]}),`\n`,_jsxs(_components.p,{children:[`In a Claude tool loop with thinking, send `,_jsx(_components.code,{children:`thinking_blocks`}),` back on the assistant message, as Anthropic requires. Appending `,_jsx(_components.code,{children:`message.model_dump(exclude_none=True)`}),` does this for you. See `,_jsx(_components.a,{href:`/routehub/tool-calling`,children:`Tool calling`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`count-reasoning-tokens`,children:`Count reasoning tokens`}),`\n`,_jsxs(_components.p,{children:[`Thinking tokens are reported in `,_jsx(_components.code,{children:`usage.completion_tokens_details.reasoning_tokens`}),` and counted in `,_jsx(_components.code,{children:`completion_tokens`}),`, as OpenAI does:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,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:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`details `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.usage.completion_tokens_details`})]}),`\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:`(details.reasoning_tokens `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` details `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Gemini’s OpenAI-compatible endpoint bills reasoning in `,_jsx(_components.code,{children:`total_tokens`}),` only, so RouteHub fills in the difference. An answer that spent its whole `,_jsx(_components.code,{children:`max_tokens`}),` budget thinking comes back with `,_jsx(_components.code,{children:`finish_reason == \"length\"`}),`, empty content, and a usage block that adds up.`]}),`\n`,_jsx(Heading,{level:`2`,id:`check-reasoning-support`,children:`Check reasoning support`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,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:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`routehub.supports_reasoning(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-6\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# True`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`routehub.get_reasoning_efforts() `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# (\"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\")`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Pass `,_jsx(_components.code,{children:`drop_params=True`}),` to drop `,_jsx(_components.code,{children:`reasoning_effort`}),` on models that don’t support reasoning instead of failing.`]})]})}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":"Reasoning","description":"Control thinking with reasoning_effort across OpenAI, Claude, Gemini and DeepSeek, and read reasoning output and tokens","href":"/routehub/reasoning"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Set the reasoning effort","slug":"set-the-reasoning-effort","depth":2,"children":[]},{"title":"Configure Claude’s thinking directly","slug":"configure-claude’s-thinking-directly","depth":2,"children":[]},{"title":"Read reasoning output","slug":"read-reasoning-output","depth":2,"children":[]},{"title":"Count reasoning tokens","slug":"count-reasoning-tokens","depth":2,"children":[]},{"title":"Check reasoning support","slug":"check-reasoning-support","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"kyegomez-swarms-97","siteName":"swarms","title":"Reasoning - swarms","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-25T15:44:50.116Z","originalFileLocation":"routehub/reasoning.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Control thinking with reasoning_effort across OpenAI, Claude, Gemini and DeepSeek, and read reasoning output and tokens\">\u003cmeta data-mint-head name=\"application-name\" content=\"swarms\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Reasoning - swarms\">\u003cmeta data-mint-head property=\"og:description\" content=\"Control thinking with reasoning_effort across OpenAI, Claude, Gemini and DeepSeek, and read reasoning output and tokens\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"swarms\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.swarms.world/routehub/reasoning\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://kyegomez-swarms-97.mintlify.app/_mintlify/api/og/v2?division=Guides\u0026amp;title=Reasoning\u0026amp;description=Control+thinking+with+reasoning_effort+across+OpenAI%2C+Claude%2C+Gemini+and+DeepSeek%2C+and+read+reasoning+output+and+tokens\u0026amp;theme=5153e5700b995bc72eadb0da\u0026amp;signature=7e3a9bf87ae55fa3cddc099257a5c0803cfba97cb9fb78b1b9ebb3c62f33ef46\">\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=\"Reasoning - swarms\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Control thinking with reasoning_effort across OpenAI, Claude, Gemini and DeepSeek, and read reasoning output and tokens\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://kyegomez-swarms-97.mintlify.app/_mintlify/api/og/v2?division=Guides\u0026amp;title=Reasoning\u0026amp;description=Control+thinking+with+reasoning_effort+across+OpenAI%2C+Claude%2C+Gemini+and+DeepSeek%2C+and+read+reasoning+output+and+tokens\u0026amp;theme=5153e5700b995bc72eadb0da\u0026amp;signature=7e3a9bf87ae55fa3cddc099257a5c0803cfba97cb9fb78b1b9ebb3c62f33ef46\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/kyegomez-swarms-97/Ctj8KAbEFcaygyNp/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"swarms\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#DC2626\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.swarms.world/routehub/reasoning\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/routehub/reasoning.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.swarms.world/#organization\",\"name\":\"swarms\",\"url\":\"https://docs.swarms.world\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/kyegomez-swarms-97/2Wfh9aBTbMWV_Lyz/logo/light.svg?fit=max\u0026auto=format\u0026n=2Wfh9aBTbMWV_Lyz\u0026q=85\u0026s=e3d664b8b8f6928c836776b54704d076\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.swarms.world#website\",\"name\":\"swarms\",\"url\":\"https://docs.swarms.world\",\"publisher\":{\"@id\":\"https://docs.swarms.world/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.swarms.world/routehub/reasoning#webpage\",\"url\":\"https://docs.swarms.world/routehub/reasoning\",\"name\":\"Reasoning\",\"description\":\"Control thinking with reasoning_effort across OpenAI, Claude, Gemini and DeepSeek, and read reasoning output and tokens\",\"dateModified\":\"2026-10-25T15:44:50.116Z\",\"isPartOf\":{\"@id\":\"https://docs.swarms.world#website\"},\"breadcrumb\":{\"@id\":\"https://docs.swarms.world/routehub/reasoning#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.swarms.world/routehub/reasoning#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guides\",\"item\":\"https://docs.swarms.world/routehub/streaming-and-async\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Reasoning\",\"item\":\"https://docs.swarms.world/routehub/reasoning\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.swarms.world/routehub/reasoning#article\",\"headline\":\"Reasoning\",\"name\":\"Reasoning\",\"description\":\"Control thinking with reasoning_effort across OpenAI, Claude, Gemini and DeepSeek, and read reasoning output and tokens\",\"url\":\"https://docs.swarms.world/routehub/reasoning\",\"mainEntityOfPage\":{\"@id\":\"https://docs.swarms.world/routehub/reasoning#webpage\"},\"dateModified\":\"2026-10-25T15:44:50.116Z\",\"publisher\":{\"@id\":\"https://docs.swarms.world/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.swarms.world#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"swarms\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"swarms","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/introduction"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api/agent"}]},{"tab":"RouteHub","groups":[{"group":"Getting Started","pages":[{"title":"RouteHub overview","sidebarTitle":"Overview","href":"/routehub/overview"},{"title":"Install RouteHub","sidebarTitle":"Installation","href":"/routehub/installation"},{"title":"RouteHub quickstart","sidebarTitle":"Quickstart","href":"/routehub/quickstart"},{"title":"Providers","href":"/routehub/providers"}]},{"group":"Guides","pages":[{"title":"Streaming and async","href":"/routehub/streaming-and-async"},{"title":"Tool calling","href":"/routehub/tool-calling"},{"title":"Structured output","description":"Get JSON that matches a pydantic model or JSON schema from any provider","href":"/routehub/structured-output"},{"title":"Reasoning","href":"/routehub/reasoning"},{"title":"Prompt caching","description":"Cache long system prompts and tools on Claude with cache_control and read cached-token usage","href":"/routehub/prompt-caching"},{"title":"Embeddings and the Responses API","sidebarTitle":"Embeddings and Responses","href":"/routehub/embeddings-and-responses"},{"title":"Batches","href":"/routehub/batches"},{"title":"Testing without a provider","sidebarTitle":"Testing","href":"/routehub/testing"}]},{"group":"Reference","pages":[{"title":"RouteHub API reference","sidebarTitle":"API reference","href":"/routehub/api-reference"},{"title":"Configuration","href":"/routehub/configuration"},{"title":"Error handling","href":"/routehub/error-handling"},{"title":"Model catalog and token counting","sidebarTitle":"Model catalog","href":"/routehub/model-catalog"},{"title":"Migrating from litellm","href":"/routehub/migrating-from-litellm"}]}]},{"tab":"Swarms API","pages":[{"title":"Swarms API","href":"/swarms-api/overview"}]},{"tab":"Examples","pages":[{"title":"Examples","href":"/examples/overview"}]},{"tab":"Community","pages":[{"title":"Community","href":"/community/contributing"}]}]},"title":"Reasoning - swarms","buildId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","deploymentId":"dpl_849ArpqvBiCczQiT1Y1stNGpbqHT","dynamics":[],"chunks":[]}