{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"HaiRoute Doc","description":"HaiRoute API documentation for LLM models and services","colors":{"primary":"#D27387","light":"#E7A0AF","dark":"#D27387"},"logo":{"light":"https://mintcdn.com/hai-token/DFzuPoXOzfYgcv_p/images/logo/light.svg?fit=max\u0026auto=format\u0026n=DFzuPoXOzfYgcv_p\u0026q=85\u0026s=3670802ebfcfac683e0d91aa182cee09","dark":"https://mintcdn.com/hai-token/DFzuPoXOzfYgcv_p/images/logo/dark.svg?fit=max\u0026auto=format\u0026n=DFzuPoXOzfYgcv_p\u0026q=85\u0026s=ea139cf27edec66b2432346ea9f459b8","href":"https://hairoute.ai"},"favicon":"https://mintcdn.com/hai-token/roChSmiiQuAOXxeY/images/logo/favicon.svg?fit=max\u0026auto=format\u0026n=roChSmiiQuAOXxeY\u0026q=85\u0026s=4c89c3d880a270256186776f71530da0","api":{"playground":{"display":"interactive","proxy":true}},"appearance":{"default":"light"},"navbar":{},"footer":{"socials":{"linkedin":"https://www.linkedin.com/company/haipay-global","github":"https://github.com/HaipayGroup"}},"search":{"prompt":"Search HaiRoute docs..."},"seo":{"metatags":{"og:site_name":"HaiRoute Documentation","og:image":"https://hairoute.ai/og-default.png","twitter:card":"summary_large_image","twitter:site":"@HaiRoute_official","canonical":"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor"],"display":"header"},"styling":{"latex":false},"navigation":{"languages":[{"language":"zh","navbar":{"links":[{"href":"https://hairoute.ai/zh","label":"首页"},{"href":"https://hairoute.ai/zh/models","label":"模型"},{"href":"https://hairoute.ai/zh/enterprise","label":"企业"},{"href":"/docs/zh/quickstart/integration-guide","label":"文档"}]},"href":"docs/zh/quickstart/integration-guide"},{"language":"en","navbar":{"links":[{"href":"https://hairoute.ai/en","label":"Home"},{"href":"https://hairoute.ai/en/models","label":"Model"},{"href":"https://hairoute.ai/en/enterprise","label":"Enterprise"},{"href":"/docs/en/quickstart/integration-guide","label":"Docs"}]},"href":"docs/en/quickstart/integration-guide"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"hai-token","hasAudioNarration":false,"actualSubdomain":"hai-token","customDomains":["docs.hairoute.ai"],"gitSource":{"type":"github","owner":"haipaygroup","repo":"haitokendocs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ab3b6107bc26a37a1a129f1","clientVersion":"0.0.4087","searchFilterCounts":[{"language":"en","tag":"API documentation","count":17},{"language":"en","tag":"AI model interface","count":17},{"language":"zh","tag":"API文档","count":17},{"language":"zh","tag":"AI模型接口","count":17},{"language":"en","tag":"AI tool integration","count":11},{"language":"zh","tag":"AI工具接入","count":11},{"language":"en","tag":"Video","count":9},{"language":"zh","tag":"视频","count":9},{"language":"en","tag":"Images","count":4},{"language":"zh","tag":"图片","count":4},{"language":"en","tag":"Chat","count":3},{"language":"zh","tag":"聊天","count":3},{"language":"en","tag":"Other","count":2},{"language":"en","tag":"Quick start","count":2},{"language":"zh","tag":"其它","count":2},{"language":"zh","tag":"快速开始","count":2},{"language":"en","tag":"Models","count":1},{"language":"zh","tag":"模型","count":1}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","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":"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":"llms-txt-v2","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":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":"html:not(.dark) #background-color{background-color:#FAF9F5}html:not(.dark) body{color:#1B0B09}html:not(.dark) #page-title{color:#1B0B09}html.dark #background-color{background-color:#17100E}html:not(.dark) [class*=\"from-background-light\"][class*=\"top-0\"]{background-image:linear-gradient(to bottom, #FAF9F5 0%, rgba(250, 249, 245, 0) 100%)!important}html.dark [class*=\"from-background-dark\"][class*=\"top-0\"]{background-image:linear-gradient(to bottom, #17100E 0%, rgba(23, 16, 14, 0) 100%)!important}"}],"page":{"pagePath":"docs/en/api-reference/chat/claude-format","slug":"/docs/en/api-reference/chat/claude-format","pageMetadata":{"title":"Claude format","description":"Create Claude messages compatible with the Anthropic Messages protocol, supporting streaming and non-streaming responses","openapi":"en/api-reference/chat/claude/openapi.json POST /v1/messages","href":"/docs/en/api-reference/chat/claude-format"},"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: \"Create Claude messages compatible with the Anthropic Messages protocol, supporting streaming and non-streaming responses\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Note}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`This endpoint is compatible with the Anthropic Claude Messages protocol for creating conversation messages.`}),`\n`,_jsx(Heading,{level:`2`,id:`features`,children:`Features`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Supports both streaming (SSE) and non-streaming response modes`}),`\n`,_jsx(_components.li,{children:`Supports multimodal content (text, images, etc.)`}),`\n`,_jsx(_components.li,{children:`Supports tool use`}),`\n`,_jsx(_components.li,{children:`Supports thinking/reasoning mode configuration`}),`\n`,_jsx(_components.li,{children:`Supports cache control optimization`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`use-cases`,children:`Use cases`}),`\n`,_jsx(_components.p,{children:`Suitable for scenarios requiring interaction with Claude models, including:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Single-turn or multi-turn conversations`}),`\n`,_jsx(_components.li,{children:`Structured output (JSON Schema)`}),`\n`,_jsx(_components.li,{children:`Tool calling and function execution`}),`\n`,_jsx(_components.li,{children:`Code execution and container reuse`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`authentication`,children:`Authentication`}),`\n`,_jsxs(_components.p,{children:[`Include the `,_jsx(_components.code,{children:`Authorization`}),` header in the format `,_jsx(_components.code,{children:`Bearer YOUR_API_KEY`}),`.`]}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`The Claude format endpoint also requires the `,_jsx(_components.code,{children:`anthropic-version`}),` header, e.g. `,_jsx(_components.code,{children:`2023-06-01`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`quick-example`,children:`Quick example`}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`18`,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:`18`,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:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.hairoute.ai/v1/messages\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer YOUR_API_KEY\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"application/json\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"anthropic-version\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"2023-06-01\"`})]}),`\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:`data `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"claude-sonnet-4-0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"max_tokens\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"messages\"`}),_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:` {`}),_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:`\"Hello, please introduce yourself\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\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:` requests.post(url, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`json`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`data, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`headers)`})]}),`\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:`(response.json())`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Node.js`,numberOfLines:`18`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`18`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://api.hairoute.ai/v1/messages'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Authorization'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Bearer YOUR_API_KEY'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/json'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'anthropic-version'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '2023-06-01'`})]}),`\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\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` JSON`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`stringify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'claude-sonnet-4-0'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` max_tokens:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1024`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`role:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'user'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Hello, please introduce yourself'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`cURL`,numberOfLines:`12`,language:`text`,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:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`curl -X POST 'https://api.hairoute.ai/v1/messages' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -H 'Authorization: Bearer YOUR_API_KEY' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -H 'Content-Type: application/json' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -H 'anthropic-version: 2023-06-01' \\\\`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` -d '{`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"model\": \"claude-sonnet-4-0\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"max_tokens\": 1024,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` \"messages\": [`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` {\"role\": \"user\", \"content\": \"Hello, please introduce yourself\"}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` }'`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})})]})]})}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":"Claude format","description":"Create Claude messages compatible with the Anthropic Messages protocol, supporting streaming and non-streaming responses","openapi":"en/api-reference/chat/claude/openapi.json POST /v1/messages","href":"/docs/en/api-reference/chat/claude-format"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Features","slug":"features","depth":2,"children":[]},{"title":"Use cases","slug":"use-cases","depth":2,"children":[]},{"title":"Authentication","slug":"authentication","depth":2,"children":[]},{"title":"Quick example","slug":"quick-example","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/hai-token/d18a3efa7e831bd2/custom.js"],"openApiReferenceData":{"operation":{"summary":"Create Message","deprecated":false,"description":"Create Claude messages compatible with the Anthropic Messages protocol, supporting streaming and non-streaming responses","tags":[],"parameters":["8001edf0-5e5f-4b2b-81fc-2ec74a2ee6be","3f656a07-572f-4ab7-921e-4d6c7177ddbf"],"requestBody":"e5e191e3-ca6e-4b0c-8030-8b9ef5f8d6ad","responses":{"200":"a9365bc7-8197-4946-a55f-db32ea8d4bae"},"security":[],"method":"post","type":"path","servers":[],"path":"/v1/messages","baseUrlOptions":[],"title":"Create Message","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"8001edf0-5e5f-4b2b-81fc-2ec74a2ee6be":{"name":"anthropic-version","in":"header","description":"","required":true,"schema":{"type":"string","example":"2023-06-01","isRequired":true,"uniqueKey":"","typeLabel":"string"}},"3f656a07-572f-4ab7-921e-4d6c7177ddbf":{"name":"X-Api-Key","in":"header","description":"","required":true,"schema":{"type":"string","example":"YOUR_API_KEY","isRequired":true,"uniqueKey":"","typeLabel":"string"}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"max_tokens":{"type":"integer","description":"Maximum number of output tokens (required)","isRequired":true,"uniqueKey":"max_tokens","typeLabel":"integer"},"model":{"type":"string","description":"Model name, e.g. claude-sonnet-4-0, claude-opus-4-0, etc.","isRequired":true,"uniqueKey":"model","typeLabel":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","description":"Message role: \"user\", \"assistant\", or \"system\"","enum":["USER","ASSISTANT","SYSTEM"],"uniqueKey":"messages.items.[INDEX].role","typeLabel":"enum\u003cstring>"},"content":{"type":"object","properties":{},"description":"Message content, can be a String or List of polymorphic content blocks","uniqueKey":"messages.items.[INDEX].content","typeLabel":"object"}},"description":"Claude message object\nThe content field can be a String or List (multimodal content blocks)","uniqueKey":"messages.items.[INDEX]","typeLabel":"object"},"description":"List of messages","isRequired":true,"uniqueKey":"messages","typeLabel":"object[]"},"top_p":{"type":"number","description":"Nucleus sampling, 0-1","uniqueKey":"top_p","typeLabel":"number"},"top_k":{"type":"integer","description":"Top-K sampling","uniqueKey":"top_k","typeLabel":"integer"},"stop_sequences":{"type":"array","items":{"type":"string","uniqueKey":"stop_sequences.items.[INDEX]","typeLabel":"string"},"description":"Stop sequences","uniqueKey":"stop_sequences","typeLabel":"string[]"},"tool_choice":{"type":"object","properties":{},"description":"Tool choice configuration, can be a String or ClaudeToolChoice object","uniqueKey":"tool_choice","typeLabel":"object"},"cache_control":{"type":"object","properties":{"type":{"type":"string","description":"Cache type, always \"ephemeral\"","uniqueKey":"cache_control.type","typeLabel":"string"},"ttl":{"type":"string","description":"Cache time-to-live (TTL)\nPossible values: \"5m\" (5 minutes) or \"1h\" (1 hour)\nDefault: \"5m\"","uniqueKey":"cache_control.ttl","typeLabel":"string"}},"description":"Top-level cache control configuration\nAutomatically applies a cache_control marker to the last cacheable block in the request","uniqueKey":"cache_control","typeLabel":"object"},"inference_geo":{"type":"string","description":"Inference geographic region\nSpecifies the geographic region for inference processing. If not specified, uses the workspace's default_inference_geo","uniqueKey":"inference_geo","typeLabel":"string"},"output_config":{"type":"object","properties":{"effort":{"type":"string","description":"Reasoning effort level\nPossible values: \"low\" / \"medium\" / \"high\" / \"xhigh\" / \"max\"","uniqueKey":"output_config.effort","typeLabel":"string"},"format":{"type":"object","properties":{"schema":{"type":"array","items":{"type":"array","items":{"type":"array","items":{"type":"object","properties":{},"uniqueKey":"output_config.format.schema.items.[INDEX].items.[INDEX].items.[INDEX]","typeLabel":"object"},"uniqueKey":"output_config.format.schema.items.[INDEX].items.[INDEX]","typeLabel":"object[]"},"uniqueKey":"output_config.format.schema.items.[INDEX]","typeLabel":"object[][]"},"description":"JSON Schema definition","uniqueKey":"output_config.format.schema","typeLabel":"object[][][]"},"type":{"type":"string","description":"Format type, always \"json_schema\"","uniqueKey":"output_config.format.type","typeLabel":"string"}},"description":"JSON output format configuration (structured output)\nUsed to specify the JSON Schema for Claude's output","uniqueKey":"output_config.format","typeLabel":"object"}},"description":"Output configuration\nConfigures model output format options, such as effort level and structured output format","uniqueKey":"output_config","typeLabel":"object"},"service_tier":{"type":"string","description":"Service tier\nDetermines whether to use priority capacity (if available) or standard capacity\nPossible values: \"auto\" / \"standard_only\"","uniqueKey":"service_tier","typeLabel":"string"},"system":{"type":"object","properties":{},"description":"System instruction, can be a String or List\u003cClaudeSystemBlock>","uniqueKey":"system","typeLabel":"object"},"temperature":{"type":"number","description":"Sampling temperature, 0.0-1.0","uniqueKey":"temperature","typeLabel":"number"},"stream":{"type":"boolean","description":"Whether to enable streaming output","uniqueKey":"stream","typeLabel":"boolean"},"thinking":{"type":"object","properties":{"budget_tokens":{"type":"integer","description":"Thinking budget token count (required only when type=\"enabled\")","uniqueKey":"thinking.budget_tokens","typeLabel":"integer"},"type":{"type":"string","description":"Thinking mode type: enabled / disabled / adaptive","uniqueKey":"thinking.type","typeLabel":"string"},"display":{"type":"string","description":"Controls how thinking content is displayed in the response: \"summarized\" or \"omitted\"\nWhen set to summarized, thinking is restored to normal. When set to omitted, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to summarized.","uniqueKey":"thinking.display","typeLabel":"string"}},"description":"Thinking/reasoning mode configuration","uniqueKey":"thinking","typeLabel":"object"},"tools":{"type":"array","items":{"type":"object","properties":{"input_schema":{"type":"array","items":{"type":"array","items":{"type":"array","items":{"type":"object","properties":{},"uniqueKey":"tools.items.[INDEX].input_schema.items.[INDEX].items.[INDEX].items.[INDEX]","typeLabel":"object"},"uniqueKey":"tools.items.[INDEX].input_schema.items.[INDEX].items.[INDEX]","typeLabel":"object[]"},"uniqueKey":"tools.items.[INDEX].input_schema.items.[INDEX]","typeLabel":"object[][]"},"description":"Tool input parameter definition in JSON Schema format","uniqueKey":"tools.items.[INDEX].input_schema","typeLabel":"object[][][]"},"allowed_callers":{"type":"array","items":{"type":"string","uniqueKey":"tools.items.[INDEX].allowed_callers.items.[INDEX]","typeLabel":"string"},"description":"List of allowed callers\nPossible values: \"direct\" / \"code_execution_20250825\" / \"code_execution_20260120\"","uniqueKey":"tools.items.[INDEX].allowed_callers","typeLabel":"string[]"},"cache_control":{"type":"object","properties":{"type":{"type":"string","description":"Cache type, always \"ephemeral\"","uniqueKey":"tools.items.[INDEX].cache_control.type","typeLabel":"string"},"ttl":{"type":"string","description":"Cache time-to-live (TTL)\nPossible values: \"5m\" (5 minutes) or \"1h\" (1 hour)\nDefault: \"5m\"","uniqueKey":"tools.items.[INDEX].cache_control.ttl","typeLabel":"string"}},"description":"Cache control configuration","uniqueKey":"tools.items.[INDEX].cache_control","typeLabel":"object"},"defer_loading":{"type":"boolean","description":"Whether to defer loading\nWhen set to true, the tool is not included in the initial system prompt,\nand is only loaded when a tool_reference is returned via tool_search","uniqueKey":"tools.items.[INDEX].defer_loading","typeLabel":"boolean"},"eager_input_streaming":{"type":"boolean","description":"Whether to enable eager input streaming\nWhen true, tool input parameters are streamed incrementally and types are dynamically inferred\nWhen false, the complete JSON output is buffered even if fine-grained tool streaming is enabled\nWhen null (default), the default behavior based on the beta header is used","uniqueKey":"tools.items.[INDEX].eager_input_streaming","typeLabel":"boolean"},"input_examples":{"type":"array","items":{"type":"object","properties":{"key":{"type":"object","properties":{},"uniqueKey":"tools.items.[INDEX].input_examples.items.[INDEX].key","typeLabel":"object"}},"uniqueKey":"tools.items.[INDEX].input_examples.items.[INDEX]","typeLabel":"object"},"description":"List of tool input examples\nHelps the model understand how to use the tool","uniqueKey":"tools.items.[INDEX].input_examples","typeLabel":"object[]"},"name":{"type":"string","description":"Tool name","uniqueKey":"tools.items.[INDEX].name","typeLabel":"string"},"description":{"type":"string","description":"Tool description","uniqueKey":"tools.items.[INDEX].description","typeLabel":"string"},"type":{"type":"string","description":"Tool type, only client tools need to be set to \"custom\"\nServer-side tools have their own type identifiers (e.g. \"bash_20250124\", \"web_search_20250305\", etc.)","uniqueKey":"tools.items.[INDEX].type","typeLabel":"string"},"strict":{"type":"boolean","description":"Strict mode\nWhen set to true, guarantees schema validation of tool name and input","uniqueKey":"tools.items.[INDEX].strict","typeLabel":"boolean"}},"description":"Claude tool definition (Tool / ToolUnion)\nUses input_schema instead of OpenAI's function.parameters\nReference: https://platform.claude.com/docs/en/api/messages/create","uniqueKey":"tools.items.[INDEX]","typeLabel":"object"},"description":"List of tool definitions","uniqueKey":"tools","typeLabel":"object[]"},"metadata":{"type":"object","properties":{"user_id":{"type":"string","description":"","uniqueKey":"metadata.user_id","typeLabel":"string"}},"description":"Metadata","uniqueKey":"metadata","typeLabel":"object"},"container":{"type":"string","description":"Container identifier, used for cross-request container reuse (code execution tool)","uniqueKey":"container","typeLabel":"string"}},"required":["max_tokens","model","messages"],"description":"","uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"max_tokens":123,"model":"\u003cstring>","messages":[{"content":{}}],"top_p":123,"top_k":123,"stop_sequences":["\u003cstring>"],"tool_choice":{},"cache_control":{"type":"\u003cstring>","ttl":"\u003cstring>"},"inference_geo":"\u003cstring>","output_config":{"effort":"\u003cstring>","format":{"schema":[[[{}]]],"type":"\u003cstring>"}},"service_tier":"\u003cstring>","system":{},"temperature":123,"stream":true,"thinking":{"budget_tokens":123,"type":"\u003cstring>","display":"\u003cstring>"},"tools":[{"input_schema":[[[{}]]],"allowed_callers":["\u003cstring>"],"cache_control":{"type":"\u003cstring>","ttl":"\u003cstring>"},"defer_loading":true,"eager_input_streaming":true,"input_examples":[{"key":{}}],"name":"\u003cstring>","description":"\u003cstring>","type":"\u003cstring>","strict":true}],"metadata":{"user_id":"\u003cstring>"},"container":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"a9365bc7-8197-4946-a55f-db32ea8d4bae":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"stop_reason":{"type":"string","description":"Stop reason: end_turn / max_tokens / stop_sequence / tool_use / pause_turn / refusal\nAlways output in the message_start event (even when null)","uniqueKey":"stop_reason","typeLabel":"string"},"stop_sequence":{"type":"string","description":"Stop sequence that was matched (can be null)\nAlways output in the message_start event (even when null)","uniqueKey":"stop_sequence","typeLabel":"string"},"stop_details":{"type":"object","properties":{"type":{"type":"string","description":"Object type, always \"refusal\"","uniqueKey":"stop_details.type","typeLabel":"string"},"category":{"type":"string","description":"Policy category that triggered the refusal\nPossible values: \"cyber\" / \"bio\" / \"reasoning_extraction\"\nNull when the refusal does not correspond to a named category","uniqueKey":"stop_details.category","typeLabel":"string"},"explanation":{"type":"string","description":"Human-readable explanation of the refusal\nThis text is not guaranteed to be stable. Null when no explanation is available for the category","uniqueKey":"stop_details.explanation","typeLabel":"string"}},"description":"Refusal stop details\nStructured information returned when the model refuses due to safety policy","uniqueKey":"stop_details","typeLabel":"object"},"id":{"type":"string","description":"Message ID (msg_ prefix)","uniqueKey":"id","typeLabel":"string"},"type":{"type":"string","description":"Object type, always \"message\"","uniqueKey":"type","typeLabel":"string"},"role":{"type":"string","description":"Role, always \"assistant\"","uniqueKey":"role","typeLabel":"string"},"content":{"type":"array","items":{"type":"object","properties":{},"description":"Claude response polymorphic content block\nUses Jackson @JsonTypeInfo to distinguish subtypes by the type field","uniqueKey":"content.items.[INDEX]","typeLabel":"object"},"description":"List of response content blocks","uniqueKey":"content","typeLabel":"object[]"},"model":{"type":"string","description":"Model name (the actual model that completed the task)","uniqueKey":"model","typeLabel":"string"},"container":{"type":"object","properties":{"expires_at":{"type":"string","description":"Container expiration time (ISO 8601 format)","uniqueKey":"container.expires_at","typeLabel":"string"},"id":{"type":"string","description":"Container identifier","uniqueKey":"container.id","typeLabel":"string"}},"description":"Container information\nContainer identifier for the code execution tool, used for cross-request reuse","uniqueKey":"container","typeLabel":"object"},"usage":{"type":"object","properties":{"input_tokens":{"type":"integer","description":"","uniqueKey":"usage.input_tokens","typeLabel":"integer"},"output_tokens":{"type":"integer","description":"","uniqueKey":"usage.output_tokens","typeLabel":"integer"},"cache_creation_input_tokens":{"type":"integer","description":"","uniqueKey":"usage.cache_creation_input_tokens","typeLabel":"integer"},"cache_read_input_tokens":{"type":"integer","description":"","uniqueKey":"usage.cache_read_input_tokens","typeLabel":"integer"},"cache_creation":{"type":"object","properties":{"ephemeral_5m_input_tokens":{"type":"integer","description":"Number of input tokens used to create 5-minute cache entries","uniqueKey":"usage.cache_creation.ephemeral_5m_input_tokens","typeLabel":"integer"},"ephemeral_1h_input_tokens":{"type":"integer","description":"Number of input tokens used to create 1-hour cache entries","uniqueKey":"usage.cache_creation.ephemeral_1h_input_tokens","typeLabel":"integer"}},"description":"Cache creation details, categorized by TTL","uniqueKey":"usage.cache_creation","typeLabel":"object"},"inference_geo":{"type":"string","description":"Inference geographic region","uniqueKey":"usage.inference_geo","typeLabel":"string"},"output_tokens_details":{"type":"object","properties":{"thinking_tokens":{"type":"integer","description":"Number of output tokens generated by the model as internal reasoning\nIncludes thinking block delimiter tokens\nAlways ≤ output_tokens; output_tokens - thinking_tokens ≈ non-reasoning output","uniqueKey":"usage.output_tokens_details.thinking_tokens","typeLabel":"integer"}},"description":"Output token details, broken down by category (read-only, for observability)","uniqueKey":"usage.output_tokens_details","typeLabel":"object"},"server_tool_use":{"type":"object","properties":{"web_search_requests":{"type":"integer","description":"Number of web search tool requests","uniqueKey":"usage.server_tool_use.web_search_requests","typeLabel":"integer"},"web_fetch_requests":{"type":"integer","description":"Number of web fetch tool requests","uniqueKey":"usage.server_tool_use.web_fetch_requests","typeLabel":"integer"}},"description":"Server-side tool usage statistics","uniqueKey":"usage.server_tool_use","typeLabel":"object"},"service_tier":{"type":"string","description":"Service tier\nPossible values: \"standard\" / \"priority\" / \"batch\"","uniqueKey":"usage.service_tier","typeLabel":"string"}},"description":"Usage statistics","uniqueKey":"usage","typeLabel":"object"}},"description":"Claude Messages API non-streaming response\nReference: https://platform.claude.com/docs/en/api/messages/create","uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"stop_reason":"\u003cstring>","stop_sequence":"\u003cstring>","stop_details":{"type":"\u003cstring>","category":"\u003cstring>","explanation":"\u003cstring>"},"id":"\u003cstring>","type":"\u003cstring>","role":"\u003cstring>","content":[{}],"model":"\u003cstring>","container":{"expires_at":"\u003cstring>","id":"\u003cstring>"},"usage":{"input_tokens":123,"output_tokens":123,"cache_creation_input_tokens":123,"cache_read_input_tokens":123,"cache_creation":{"ephemeral_5m_input_tokens":123,"ephemeral_1h_input_tokens":123},"inference_geo":"\u003cstring>","output_tokens_details":{"thinking_tokens":123},"server_tool_use":{"web_search_requests":123,"web_fetch_requests":123},"service_tier":"\u003cstring>"}}}},"exampleType":"generated"}},"headers":{},"exampleType":"generated"}},"security":{},"servers":{}},"originalFileLocation":"docs/en/api-reference/chat/claude/openapi.json"},"subdomain":"hai-token","siteName":"HaiRoute Doc","title":"Claude format - HaiRoute Doc","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"zh":{"href":"/docs/zh/api-reference/chat/claude-format","matchLevel":1},"en":{"href":"/docs/en/api-reference/chat/claude-format","matchLevel":0}}},"lastModified":"2026-09-10T12:00:08.006Z","originalFileLocation":"docs/en/api-reference/chat/claude-format.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Create Claude messages compatible with the Anthropic Messages protocol, supporting streaming and non-streaming responses\">\u003cmeta data-mint-head name=\"application-name\" content=\"HaiRoute Doc\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/hai-token/ojcWBNnkbICDtPOo/_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/hai-token/ojcWBNnkbICDtPOo/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/hai-token/ojcWBNnkbICDtPOo/_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/hai-token/ojcWBNnkbICDtPOo/_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/hai-token/ojcWBNnkbICDtPOo/_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/hai-token/ojcWBNnkbICDtPOo/_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/hai-token/ojcWBNnkbICDtPOo/_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/hai-token/ojcWBNnkbICDtPOo/_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/hai-token/ojcWBNnkbICDtPOo/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Claude format - HaiRoute Doc\">\u003cmeta data-mint-head property=\"og:description\" content=\"Create Claude messages compatible with the Anthropic Messages protocol, supporting streaming and non-streaming responses\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"HaiRoute Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://hairoute.ai/og-default.png\">\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=\"Claude format - HaiRoute Doc\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Create Claude messages compatible with the Anthropic Messages protocol, supporting streaming and non-streaming responses\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://hairoute.ai/og-default.png\">\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/hai-token/ojcWBNnkbICDtPOo/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"HaiRoute Doc\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#D27387\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/en/api-reference/chat/claude-format.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh\" href=\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/zh/api-reference/chat/claude-format\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/zh/api-reference/chat/claude-format\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.hairoute.ai/#organization\",\"name\":\"HaiRoute Doc\",\"url\":\"https://docs.hairoute.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/hai-token/DFzuPoXOzfYgcv_p/images/logo/light.svg?fit=max\u0026auto=format\u0026n=DFzuPoXOzfYgcv_p\u0026q=85\u0026s=3670802ebfcfac683e0d91aa182cee09\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide#website\",\"name\":\"HaiRoute Doc\",\"url\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide\",\"publisher\":{\"@id\":\"https://docs.hairoute.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format#webpage\",\"url\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format\",\"name\":\"Claude format\",\"description\":\"Create Claude messages compatible with the Anthropic Messages protocol, supporting streaming and non-streaming responses\",\"dateModified\":\"2026-09-10T12:00:08.006Z\",\"isPartOf\":{\"@id\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide#website\"},\"breadcrumb\":{\"@id\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API documentation\",\"item\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/openai-format\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI model interface\",\"item\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/openai-format\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Chat\",\"item\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/openai-format\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Claude format\",\"item\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format#apireference\",\"headline\":\"Claude format\",\"name\":\"Claude format\",\"description\":\"Create Claude messages compatible with the Anthropic Messages protocol, supporting streaming and non-streaming responses\",\"url\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format\",\"mainEntityOfPage\":{\"@id\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide/docs/en/api-reference/chat/claude-format#webpage\"},\"image\":\"https://hairoute.ai/og-default.png\",\"dateModified\":\"2026-09-10T12:00:08.006Z\",\"publisher\":{\"@id\":\"https://docs.hairoute.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.hairoute.ai/docs/zh/quickstart/integration-guide#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"HaiRoute Doc\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"HaiRoute Doc","nav":{"global":null,"languages":[{"language":"zh","navbar":{"links":[{"href":"https://hairoute.ai/zh","label":"首页"},{"href":"https://hairoute.ai/zh/models","label":"模型"},{"href":"https://hairoute.ai/zh/enterprise","label":"企业"},{"href":"/docs/zh/quickstart/integration-guide","label":"文档"}]},"pages":[{"title":"zh","href":"/docs/zh/api-reference/chat/claude-format"}]},{"language":"en","navbar":{"links":[{"href":"https://hairoute.ai/en","label":"Home"},{"href":"https://hairoute.ai/en/models","label":"Model"},{"href":"https://hairoute.ai/en/enterprise","label":"Enterprise"},{"href":"/docs/en/quickstart/integration-guide","label":"Docs"}]},"groups":[{"group":"Quick start","pages":[{"title":"Integration guide","href":"/docs/en/quickstart/integration-guide"},{"title":"Get API Key","href":"/docs/en/quickstart/get-api-key"}]},{"group":"API documentation","pages":[{"group":"AI model interface","pages":[{"group":"Chat","pages":[{"title":"OpenAI format","description":"Create chat completions compatible with the OpenAI Chat Completions protocol, supporting streaming and non-streaming responses","openapi":"en/api-reference/chat/openai/openapi.json POST /v1/chat/completions","href":"/docs/en/api-reference/chat/openai-format"},{"title":"Claude format","openapi":"en/api-reference/chat/claude/openapi.json POST /v1/messages","href":"/docs/en/api-reference/chat/claude-format"},{"title":"Responses format","description":"Create chat completions compatible with the OpenAI Responses protocol, supporting streaming and non-streaming responses","openapi":"en/api-reference/chat/responses/responses-openapi.json POST /v1/responses","href":"/docs/en/api-reference/chat/responses-format"}]},{"group":"Models","pages":[{"title":"Model list","openapi":"en/api-reference/models/openapi.json GET /v1/models","href":"/docs/en/api-reference/models/list-models"}]},{"group":"Images","pages":[{"title":"OpenAI image generation","openapi":"en/api-reference/images/openai/generation/openapi.json POST /v1/images/generations","href":"/docs/en/api-reference/images/openai/generation"},{"title":"OpenAI image edit","openapi":"en/api-reference/images/openai/edit/openapi.json POST /v1/images/edits","href":"/docs/en/api-reference/images/openai/edit"},{"title":"Seedream image generation","openapi":"en/api-reference/images/seedream/generation/openapi.json POST /v1/images/generations","href":"/docs/en/api-reference/images/seedream/generation"},{"title":"Gemini native image generation","openapi":"en/api-reference/images/gemini/generation/openapi.json POST /v1/models/{model}:generateContent","href":"/docs/en/api-reference/images/gemini/generation"}]},{"group":"Video","pages":[{"title":"Common video generation","openapi":"en/api-reference/video/generation/openapi.json POST /v1/video/generations","href":"/docs/en/api-reference/video/generation"},{"title":"Query video generation task","openapi":"en/api-reference/video/generation/openapi.json GET /v1/video/generations/{taskId}","href":"/docs/en/api-reference/video/generation-status"},{"title":"Seedance Video Generation","openapi":"en/api-reference/video/seedance/openapi.json POST /v1/seedance/video/generations","href":"/docs/en/api-reference/video/seedance"},{"title":"Seedance query video task","openapi":"en/api-reference/video/seedance/openapi.json GET /v1/seedance/video/generations/{taskId}","href":"/docs/en/api-reference/video/seedance-status"},{"title":"Wan 2.7 Video Generation","openapi":"en/api-reference/video/wan/openapi.json POST /v1/alibaba/video/generations","href":"/docs/en/api-reference/video/wan"},{"title":"Wan 3.0 Video Generation","openapi":"en/api-reference/video/wan3/openapi.json POST /v1/alibaba/video/generations","href":"/docs/en/api-reference/video/wan3"},{"title":"Wan query video task","openapi":"en/api-reference/video/wan/openapi.json GET /v1/alibaba/video/generations/{taskId}","href":"/docs/en/api-reference/video/wan-status"},{"title":"HappyHorse Video Generation","openapi":"en/api-reference/video/happyHorse/openapi.json POST /v1/alibaba/video/generations","href":"/docs/en/api-reference/video/happyHorse"},{"title":"HappyHorse query video task","openapi":"en/api-reference/video/happyHorse/openapi.json GET /v1/alibaba/video/generations/{taskId}","href":"/docs/en/api-reference/video/happy-horse-status"}]}]}]},{"group":"AI tool integration","pages":[{"title":"Claude Code","href":"/docs/en/tools/claude-code"},{"title":"CodeX/ChatGPT","href":"/docs/en/tools/codex"},{"title":"Copilot","href":"/docs/en/tools/copilot"},{"title":"Cursor","href":"/docs/en/tools/cursor"},{"title":"DeepChat","href":"/docs/en/tools/deepchat"},{"title":"Open Code","href":"/docs/en/tools/open-code"},{"title":"OpenClaw","href":"/docs/en/tools/openclaw"},{"title":"Trae Work","href":"/docs/en/tools/trae-work"},{"title":"VS Code","href":"/docs/en/tools/vscode"},{"title":"WorkBuddy","href":"/docs/en/tools/workbuddy"},{"title":"ZCode","href":"/docs/en/tools/zcode"}]},{"group":"Other","pages":[{"title":"Rate Limits","href":"/docs/en/others/rate-limits"},{"title":"VPN and proxy connectivity","href":"/docs/en/others/vpn-proxy"}]}]}]},"basePath":"","title":"Claude format - HaiRoute Doc","buildId":"dpl_FWZhTb2vab28gFGFH4ojka6qEznQ","deploymentId":"dpl_FWZhTb2vab28gFGFH4ojka6qEznQ","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-CBsVopKK.js","utils-DZAk68jJ.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-D32AYZrP.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-D_A5_cny.js","snippetPresets-xNRfS9th.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-BIB25-tq.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-CydJ4w4j.js","shallow-CYPBeQSG.js","getApiPlaygroundDisplay-A5xJVBOu.js","CodeSnippet-BVRTgi3m.js","CodeSnippets-DjD6BSlt.js","Page-Dr40SSJq.js","getPastedJson-D4V4JyrR.js","icon-uhcnG22T.js","MethodPill-CM-ZQdGH.js","DuplicateIcon-B_WnOiNf.js","createIcon-CJsb8utt.js","DynamicMarkdown-D-2HDKEp.js","SectionHeading-KP5xmMgQ.js","axios-vUo_bRtp.js","Markdown-D_k0dg6k.js","clsx-DK3K4Z1S.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-DE3EVdvd.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-fN9H9n9g.js"]}