Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.
import osfrom openai import OpenAIclient = OpenAI( api_key=os.environ["MOONSHOT_API_KEY"], base_url="https://api.moonshot.ai/v1",)response = client.responses.create( model="kimi-k3.1-pro", instructions="You are Kimi, an AI assistant provided by Moonshot AI.", input="Explain context caching in one sentence.",)print(response.output_text)
import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.MOONSHOT_API_KEY, baseURL: "https://api.moonshot.ai/v1",});const response = await client.responses.create({ model: "kimi-k3.1-pro", instructions: "You are Kimi, an AI assistant provided by Moonshot AI.", input: "Explain context caching in one sentence.",});console.log(response.output_text);
curl https://api.moonshot.ai/v1/responses \ --header "Content-Type: application/json" \ --header "Authorization: Bearer $MOONSHOT_API_KEY" \ --data '{ "model": "kimi-k3.1-pro", "instructions": "You are Kimi, an AI assistant provided by Moonshot AI.", "input": "Explain context caching in one sentence." }'
Tool Use
tools supports four tool types: function, namespace, custom (only apply_patch), and web_search. Other types are not supported. The first three run on your side: the model returns a call request, you execute it and send the result back. web_search runs on the server side, with nothing for you to handle.Function callingPass functions defined with JSON Schema through tools, and the model decides when to call them:
{ "model": "kimi-k3.1-pro", "input": "What is the weather in Beijing today?", "tools": [ { "type": "function", "name": "get_weather", "description": "Get the weather for a city", "parameters": { "type": "object", "properties": { "city": {"type": "string", "description": "City name"} }, "required": ["city"] } } ]}
When the model decides to call a function, output contains a function_call item whose arguments is a JSON string:
After running it locally, append the previous output to input as is, followed by a function_call_output item (its call_id must match the function_call), and send the next request:
Web searchAdd {"type": "web_search"} to tools. The server first decides from the input whether a search is needed, then runs it and injects the results into the model context, and the model answers from those results:
{ "model": "kimi-k3.1-pro", "input": "What are the top news stories today?", "tools": [ {"type": "web_search"} ]}
When a search ran, a web_search_call item appears at the front of output. Add web_search_call.action.sources to include to get the web pages the search hit:
Each executed search is billed per call ($0.005 per call, same price for image search); no charge applies if the model does not trigger a search. See WebSearch Pricing for details.
Context Caching (Cache Write)
The Kimi API automatically enables context caching for repeated request prefixes; cached portions are billed at a lower price and respond faster. Use prompt_cache_options to control cache write behavior:
Parameter
Type
Description
prompt_cache_options
object
Context cache write options. When omitted, cache write is enabled by default (5m tier)
prompt_cache_options.mode
"implicit"
Cache write mode. Only implicit is supported: automatically writes the request prefix to the cache
prompt_cache_options.ttl
"5m" | "1h"
Lifetime of the written cache. Only 5m and 1h are supported (default 5m); the two tiers are independent
When prompt_cache_options is omitted, cache write is automatically enabled (5m tier). The top-level prompt_cache_options in the response echoes the options actually applied by the server; refer to the returned value.Behavior
The cache is isolated per organization (org); caches are never shared across organizations.
When a request with the same prefix hits the cache within its lifetime, the cache entry is refreshed with its original TTL. Cache hits are billed only at the cache read price, with no additional cache write charge.
Cache writes are billed by TTL; see Pricing for details.
Manual cache clearing is not supported; cached prefixes expire automatically after at least 5 minutes of inactivity.
Explicit cache breakpoints are not supported: the request is rejected (HTTP 400) if prompt_cache_breakpoint appears in content.
Usage fieldsusage.input_tokens is always the total number of input tokens. Its internal breakdown is returned in input_tokens_details:
Field
Description
usage.input_tokens_details.cached_tokens
Tokens served from the cache (cache read)
usage.input_tokens_details.cache_write_tokens
Tokens written to the cache by this request (cache write)
cached_tokens, cache_write_tokens, and the uncached remainder are mutually exclusive and sum to input_tokens; the uncached remainder = input_tokens − cached_tokens − cache_write_tokens.
The Authorization header expects a Bearer token. Use an MOONSHOT_API_KEY as the token. This is a server-side secret key. Generate one on the API keys page in your dashboard.
Headers
X-Msh-Request-Nonce
string
A client-generated random nonce (a UUID v4 is recommended). Sending it enables Request Signature: the Kimi API returns Msh-Request-Timestamp and Msh-Request-Signature in the response headers, which can later be used to prove that the request was handled by the Kimi API. Exactly one non-empty header value is allowed; if the value is invalid, the request proceeds normally but the headers above are not returned. See Verify Request Signature.
Minimum string length: 1
Example:
"7d929748-0ae6-41c2-ab5d-a186498ad721"
Body
application/json
model
string
required
ID of the model to use. This endpoint currently supports kimi-k3.1-pro, kimi-k3.1-pro-highspeed, and kimi-k3.
Input for this request. A string is equivalent to a single user message. An array holds ordered typed items and may contain conversation history, tool calls, and tool results.
instructions
string
Top-level system instructions, applied ahead of every input item.
stream
boolean
default:false
When true, the response is delivered as a stream of SSE events.
max_output_tokens
integer
Maximum number of tokens to generate for this response. For Kimi K3-series models (kimi-k3.1-pro, kimi-k3.1-pro-highspeed, and kimi-k3) it defaults to 131072 and can be set up to 1048576. This refers to the length of tokens you expect us to return, not the total length of input plus output. When the limit is reached, status is incomplete and incomplete_details.reason is max_output_tokens.
A tool definition, discriminated by type. Supported types are function, custom (only apply_patch), namespace, and web_search; other tool types are not supported.
Function tool
Custom tool
Namespace tool
Web search tool
Show child attributes
tool_choice
enum<string>
Controls tool-calling behavior. With auto, the model decides whether to call a tool.
Available options:
auto
include
enum<string>[]
Additional fields to return. Only effective when the web_search tool is used. web_search_call.action.sources returns the web pages the search hit; web_search_call.results returns image search results.
Available options:
web_search_call.results,
web_search_call.action.sources
prompt_cache_key
string
Context cache identifier. Reusing the same value across a session improves cache hit rate.
prompt_cache_options
object
Context cache write options. When omitted, cache write is enabled by default (5m tier): the system automatically writes the request prefix to the 5m cache tier
Show child attributes
safety_identifier
string
A stable identifier used to help detect users of your application that may be violating usage policies. The ID should be a string that uniquely identifies each user. It is recommended to hash the username or email address to avoid sending any identifying information
Response
The response was created
A single model response.
id
string
Unique identifier of the response.
Example:
"resp_68f0c1c2d3e4f5a6b7c8d9e0"
object
enum<string>
Available options:
response
created_at
integer
Unix timestamp of when the response was created.
completed_at
integer | null
Unix timestamp of when the response finished. Present when status is completed or incomplete; null when status is in_progress or failed.
status
enum<string>
Response status. The opening snapshot of a stream is in_progress.
A tool definition, discriminated by type. Supported types are function, custom (only apply_patch), namespace, and web_search; other tool types are not supported.
Function tool
Custom tool
Namespace tool
Web search tool
Show child attributes
tool_choice
enum<string> | null
Controls tool-calling behavior. With auto, the model decides whether to call a tool.
Available options:
auto
max_output_tokens
integer | null
temperature
number | null
top_p
number | null
metadata
object | null
parallel_tool_calls
boolean
service_tier
string | null
store
boolean
Always false.
background
boolean | null
Always false.
previous_response_id
string | null
Always null.
conversation
object | null
Always null.
prompt_cache_options
object
The context cache write options actually applied by the server. When the request omits prompt_cache_options, refer to the mode and ttl returned here
{"docsConfig":{"theme":"luma","$schema":"https://mintlify.com/docs.json","name":"Kimi API Platform","description":"Kimi K3.1 Pro is our flagship model for long-horizon coding and end-to-end knowledge work, with a 1M-token context window and industry-leading intelligence. The Kimi API Platform provides a range of large language model APIs with long context, multimodal understanding, and Tool Calling.","colors":{"primary":"#111111","light":"#F5F5F5","dark":"#111111"},"logo":{"light":"https://mintcdn.com/moonshotai/X_5b_eA1iuJP595e/assets/logo/light.svg?fit=max\u0026auto=format\u0026n=X_5b_eA1iuJP595e\u0026q=85\u0026s=f68cf2d80f8d7f0363e088d2b988a598","dark":"https://mintcdn.com/moonshotai/X_5b_eA1iuJP595e/assets/logo/dark.svg?fit=max\u0026auto=format\u0026n=X_5b_eA1iuJP595e\u0026q=85\u0026s=297861f343cd86556341fb85b17cb13d","href":"https://platform.kimi.ai"},"favicon":{"light":"https://mintcdn.com/moonshotai/X_5b_eA1iuJP595e/assets/pics/favicon.ico?fit=max\u0026auto=format\u0026n=X_5b_eA1iuJP595e\u0026q=85\u0026s=f5dbc381f82faaf2356c1d1bd7199526","dark":"https://mintcdn.com/moonshotai/X_5b_eA1iuJP595e/assets/pics/favicon-dark.ico?fit=max\u0026auto=format\u0026n=X_5b_eA1iuJP595e\u0026q=85\u0026s=0330e19f739be705f4a0bacdbdea87a3"},"api":{"openapi":["openapi.json","admin-api/openapi.yaml"],"examples":{"defaults":"required"}},"navbar":{"links":[{"href":"https://www.kimi.com/membership/pricing?from=platform_page\u0026open=business","label":"Kimi Business"},{"href":"https://www.kimi.ai/contact-sales","label":"Contact Sales"},{"href":"https://platform.kimi.ai/console/account","label":"User Center"}]},"footer":{"socials":{"x":"https://x.com/Kimi_Moonshot","github":"https://github.com/MoonshotAI","linkedin":"https://www.linkedin.com/company/kimi-ai-linkedin","discord":"https://discord.com/invite/TYU2fdJykW?source=docs_footer","website":"https://forum.moonshot.ai/?source=docs_footer"}},"seo":{"metatags":{"og:site_name":"Kimi API Platform","og:locale":"en-US","og:image":"https://platform.kimi.ai/og.png?v=1","og:image:alt":"Kimi API Platform","robots":"index,follow","canonical":"https://platform.kimi.ai/docs","description":"Kimi K3.1 Pro is our flagship model for long-horizon coding and end-to-end knowledge work, with a 1M-token context window and industry-leading intelligence. The Kimi API Platform provides a range of large language model APIs with long context, multimodal understanding, and Tool Calling.","keywords":"Kimi K3.1 Pro,kimi-k3.1-pro,Kimi K3,Moonshot AI,K3 Large Language Model,AI API,Tool Calling,Code Generation,Intelligent Dialogue,AI Agent,Open-source Model,Long Context,Claw Bot"}},"styling":{"eyebrows":"breadcrumbs","latex":false},"integrations":{"clarity":{"projectId":"r1wlk72gay"},"ga4":{"measurementId":"G-Z0ZTEN03PZ"}},"banner":{"content":"🎉 Kimi K3.1 Pro has launched! [Start exploring now!](https://platform.kimi.ai/docs/guide/kimi-k3-1-pro-quickstart)","dismissible":true},"errors":{"404":{"redirect":true}},"contextual":{"options":["copy","view",{"title":"Open in Kimi","description":"Ask questions about this page","icon":"/assets/logo/kimi-context.svg","href":{"base":"https://www.kimi.ai/","query":[{"key":"prefill_prompt","value":"Read from https://platform.kimi.ai/docs$path so I can ask questions about it."}]}}],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"moonshotai","hasAudioNarration":false,"actualSubdomain":"moonshotai","customDomains":["platform.kimi.ai"],"gitSource":{"type":"github","owner":"moonshotai","repo":"kimi-platform-docs","deployBranch":"master","contentDirectory":"global","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b080b64c08b84f405f88af7","clientVersion":"0.0.4347","searchFilterCounts":[{"language":"default","tag":"API Reference","count":61},{"language":"default","tag":"Admin API","count":32},{"language":"default","tag":"Guides","count":31},{"language":"default","tag":"Organization","count":24},{"language":"default","tag":"Learning and support","count":22},{"language":"default","tag":"Resources","count":21},{"language":"default","tag":"Help Center","count":12},{"language":"default","tag":"Model Capabilities","count":9},{"language":"default","tag":"Members \u0026 Invitations","count":7},{"language":"default","tag":"Integrations","count":7}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"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":"site-roles","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":"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":"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":"turbopuffer-dual-write","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":"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":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":":root{--brand-primary: #111111;--brand-primary-strong: #2a2a2a;--brand-primary-soft: rgba(17, 17, 17, 0.08);--brand-text: #171717;--brand-text-muted: #5f5f68;--brand-border: #e5e7eb;--brand-border-strong: #d4d4d8;--brand-surface: #f5f5f5;--brand-card-bg: rgba(255, 255, 255, 0.9);--brand-overlay: linear-gradient(to top, rgba(10, 10, 10, 0.78), rgba(10, 10, 10, 0.28), transparent)}.dark,[data-theme=\"dark\"]{--brand-primary: #f5f5f5;--brand-primary-strong: #ffffff;--brand-primary-soft: rgba(245, 245, 245, 0.14);--brand-text: #fafafa;--brand-text-muted: #a1a1aa;--brand-border: #303038;--brand-border-strong: #3f3f46;--brand-surface: #151515;--brand-card-bg: rgba(24, 24, 27, 0.88);--brand-overlay: linear-gradient(to top, rgba(0, 0, 0, 0.84), rgba(0, 0, 0, 0.3), transparent)}#footer>*>div:last-child,#footer>*>div:nth-last-child(2){display:none!important}#footer a[href^=\"https://forum.moonshot.ai/\"] svg{display:none!important}#footer a[href^=\"https://forum.moonshot.ai/\"]::before{content:\"\";display:block;width:1.25rem;height:1.25rem;background-color:currentColor;-webkit-mask:url(\"/assets/icons/community.svg\") center / contain no-repeat;mask:url(\"/assets/icons/community.svg\") center / contain no-repeat}#search-bar-entry,#search-bar-entry-mobile{border:1px solid var(--brand-border)!important;background:var(--brand-card-bg)!important;box-shadow:none!important}#search-input{color:var(--brand-text)!important}#search-input::placeholder{color:var(--brand-text-muted)!important}#topbar,#topbar-content-container,#topbar-content-wrapper{color:var(--brand-text)!important}@media (min-width: 1024px){#sidebar{top:calc(7rem + var(--banner-height, 0px))!important}}#sidebar-content li[data-active]{background:var(--brand-primary-soft)!important;border-radius:14px}#sidebar-content li[data-active] a,#sidebar-content li[data-active] button{color:var(--brand-primary)!important}#sidebar-content a,#sidebar-content button{font-weight:inherit!important;text-shadow:none!important}.sidebar-group[data-active]>.sidebar-group-header,.sidebar-group[data-active]>.sidebar-group-header *{color:var(--brand-primary)!important}.method-nav-pill,.method-pill{border-radius:999px!important;box-shadow:none!important}#request-example,#response-example,#api-playground-input,#panel,#page-context-menu-button{border-color:var(--brand-border)!important}#request-example,#response-example,#api-playground-input{background:var(--brand-card-bg)!important}.dark .method-nav-pill,.dark .method-pill,[data-theme=\"dark\"] .method-nav-pill,[data-theme=\"dark\"] .method-pill{border-color:transparent!important}.dark li[role=\"tab\"][aria-selected=\"true\"]>div,[data-theme=\"dark\"] li[role=\"tab\"][aria-selected=\"true\"]>div{color:#ffffff!important;border-color:#ffffff!important}.nav-tabs-item[data-active],.mobile-nav-tabs-item[data-active]{color:var(--brand-primary)!important}.navbar-link:hover,.nav-tabs-item:hover,.mobile-nav-tabs-item:hover{color:var(--brand-primary)!important}.toc-item[data-active],.toc-item[data-active-deepest]{color:var(--brand-primary)!important}.toc-item[data-active] a,.toc-item[data-active-deepest] a{color:var(--brand-primary)!important}#header>div.mt-2.prose{font-size:1rem;line-height:1.5rem}#header>div.mt-2.prose{color:#73737c}.dark #header>div.mt-2.prose,[data-theme=\"dark\"] #header>div.mt-2.prose{color:#a1a1aa}.mdx-content a{color:var(--brand-primary);text-decoration-color:color-mix(in srgb, var(--brand-primary) 58%, transparent)}.mdx-content a:hover{color:var(--brand-primary-strong);text-decoration-color:color-mix(in srgb, var(--brand-primary-strong) 72%, transparent)}.mdx-content a strong,.mdx-content a b,.mdx-content a code{color:inherit}.quickstart-cta-wrap{display:flex;justify-content:center;margin:48px 0 64px}.mdx-content .quickstart-cta{display:inline-flex;align-items:center;justify-content:center;padding:10px 20px;border-radius:8px;background:var(--brand-primary);color:var(--brand-surface);font-size:14px;font-weight:500;line-height:1.25;text-decoration:none}.mdx-content .quickstart-cta:hover{background:var(--brand-primary-strong);color:var(--brand-surface)}.code-block,pre{border-color:var(--brand-border)!important}code:not(pre code){background:var(--brand-surface)!important;border:1px solid var(--brand-border);color:var(--brand-text)!important}.mdx-content table td code{white-space:nowrap}#page-context-menu-button:hover,.pagination-next:hover,.pagination-prev:hover,.topbar-cta-button:hover{border-color:var(--brand-primary)!important}.overview-page{color:var(--brand-text)}.overview-page a{border-bottom:none!important;box-shadow:none!important;text-decoration:none!important}.overview-page .overview-overlay-link{position:absolute!important;inset:0!important;display:block!important;border:0!important;border-bottom:0!important;box-shadow:none!important;text-decoration:none!important;z-index:4!important}.overview-page .overview-grid-2,.overview-page .overview-grid-3,.overview-page .overview-grid-4{display:grid;align-items:stretch;gap:16px}.overview-page .overview-grid-2{grid-template-columns:repeat(2, minmax(0, 1fr))}.overview-page .overview-grid-3{grid-template-columns:repeat(3, minmax(0, 1fr))}.overview-page .overview-grid-4{grid-template-columns:repeat(2, minmax(0, 1fr))}.overview-page .overview-link-card,.overview-page .overview-resource-card{position:relative;overflow:hidden;display:flex;height:100%;border:1px solid var(--brand-border);border-radius:12px;background:var(--brand-card-bg);backdrop-filter:blur(10px);transition:border-color 0.2s, background-color 0.2s, box-shadow 0.2s}.overview-page .overview-link-card:hover,.overview-page .overview-resource-card:hover{border-color:var(--brand-primary);box-shadow:0 10px 30px rgba(15, 23, 42, 0.08)}.overview-page .overview-link-card__body,.overview-page .overview-resource-card__body{display:flex;padding:20px 16px;width:100%;flex-direction:row;gap:12px;align-items:flex-start}.overview-page .overview-link-card__content{display:flex;flex:1;flex-direction:column}.overview-page .overview-link-card__icon{display:flex;width:24px;min-width:24px;align-items:center;justify-content:center;line-height:1;margin-top:3px;color:var(--brand-text-muted)}.overview-page .overview-link-card__title,.overview-page .overview-resource-card__title{font-size:16px;font-weight:500;line-height:1.2;color:var(--brand-text)}.overview-page .overview-link-card__description,.overview-page .overview-resource-card__description{margin-top:4px;font-size:14px;color:var(--brand-text-muted);line-height:1.4}.overview-page .overview-model-card{position:relative;overflow:hidden;border:1px solid var(--brand-border);border-radius:12px;background:var(--brand-surface)}.overview-page .overview-model-card__media{position:relative;aspect-ratio:123 / 92;line-height:0}.overview-page .overview-model-card__image{display:block;width:100%;height:100%;object-fit:cover;transition:transform 0.5s}.overview-page .overview-model-card:hover .overview-model-card__image{transform:scale(1.05)}.overview-page .overview-model-card__overlay{position:absolute;inset:0;display:flex;align-items:flex-end;background:var(--brand-overlay)}.overview-page .overview-model-card__content{width:100%;padding:16px}.overview-page .overview-model-card__name{color:white;font-weight:600;line-height:1.2;font-size:16px}.overview-page .overview-model-card__tag-row{margin-top:8px;line-height:1}.overview-page .overview-hero-card{background:var(--brand-surface);border-color:var(--brand-border)!important}.overview-page .overview-hero-card__cta{display:inline-flex;align-items:center;gap:6px;padding:10px 20px;border:1px solid rgba(255, 255, 255, 0.14);border-radius:8px;background:rgba(255, 255, 255, 0.96);color:#111111!important;font-size:14px;font-weight:500;white-space:nowrap;position:relative;z-index:10;transition:transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease}.overview-page .overview-hero-card__cta:hover{background:#ffffff;border-color:rgba(255, 255, 255, 0.3);transform:translateY(-1px)}.overview-page .overview-section-link{color:var(--brand-primary)!important;text-decoration:underline!important;text-underline-offset:0.18em}.overview-page .overview-section-link:hover{color:var(--brand-primary-strong)!important}.overview-page .overview-resource-card a,.overview-page .overview-link-card a,.overview-page .overview-model-card a{color:inherit!important}@media (max-width: 1100px){.overview-page .overview-grid-3{grid-template-columns:repeat(2, minmax(0, 1fr))}}#choose-the-right-api+div table:first-of-type{min-width:680px;table-layout:fixed}#choose-the-right-api+div table:first-of-type th,#choose-the-right-api+div table:first-of-type td{min-width:0}#choose-the-right-api+div table:first-of-type th:nth-child(1),#choose-the-right-api+div table:first-of-type td:nth-child(1){width:16%}#choose-the-right-api+div table:first-of-type th:nth-child(2),#choose-the-right-api+div table:first-of-type td:nth-child(2){width:32%}#choose-the-right-api+div table:first-of-type td:nth-child(2),#choose-the-right-api+div table:first-of-type td:nth-child(2) code{white-space:nowrap}#content-side-layout:has(.code-group){display:none!important}@media (max-width: 700px){.overview-page .overview-grid-2,.overview-page .overview-grid-3,.overview-page .overview-grid-4{grid-template-columns:1fr}}.doc-table-wrap{width:100%;max-width:100%}.doc-table-wrap table{display:table!important;width:100%!important;max-width:100%!important;min-width:0!important;table-layout:fixed!important;margin:0!important}.doc-table-wrap th,.doc-table-wrap td{white-space:normal!important;overflow-wrap:anywhere;word-break:break-word;text-align:left!important;vertical-align:middle}.doc-table-wrap td ul{margin-top:0!important;margin-bottom:0!important}.doc-table-bordered{border:1px solid rgba(128, 128, 128, 0.25);container-type:inline-size}.doc-table-bordered th,.doc-table-bordered td{padding:12px 16px!important}.doc-table-legal th,.doc-table-legal td{vertical-align:top}.doc-table-legal td{line-height:1.75}.doc-table-legal th:nth-child(2),.doc-table-legal td:nth-child(2){border-right:1px solid rgba(128, 128, 128, 0.25)}.doc-table-bordered th:first-child,.doc-table-bordered td:first-child{border-right:1px solid rgba(128, 128, 128, 0.25)}.doc-table-bordered .doc-table-group-start,.doc-table-bordered thead tr.doc-table-groups th:nth-child(n+3){border-left:1px solid rgba(128, 128, 128, 0.25)}.doc-table-corner-sub{font-weight:400;opacity:0.6}.doc-table-unit{opacity:0.55;font-size:0.85em}@container (min-width: 840px){.doc-table-bordered .doc-table-price{white-space:nowrap}}.doc-table-wrap thead tr.doc-table-groups th{text-align:left!important;font-weight:600;border-bottom:1px solid rgba(128, 128, 128, 0.25)}.doc-table-wrap thead tr.doc-table-groups th:empty{border-bottom:none}.doc-table-bordered thead tr.doc-table-groups th{background-color:rgba(128, 128, 128, 0.16)}.doc-table-bordered thead tr:not(.doc-table-groups) th{background-color:rgba(128, 128, 128, 0.06)}@media (max-width: 900px){.doc-table-wrap th,.doc-table-wrap td{padding:10px 8px!important;font-size:13px;line-height:1.45}}@media (max-width: 640px){.doc-table-wrap{width:100%}.doc-table-wrap th,.doc-table-wrap td{padding:8px 6px!important;font-size:12px;line-height:1.4}.doc-table-wrap td:first-child,.doc-table-wrap th:first-child{word-break:break-all;overflow-wrap:anywhere}.doc-table-wrap code{font-size:11px;white-space:normal!important;word-break:break-all}}.sidebar-group-header{font-size:0.875rem!important}nav[aria-label=\"Pages\"] ul.bottom-0.border-t{display:none!important}li.navbar-link>a{border:1px solid var(--brand-border, #e5e7eb);border-radius:9999px;padding:0.3rem 0.9rem}li.navbar-link>a:hover{border-color:var(--brand-primary)!important;color:var(--brand-primary)!important}div.relative:has(>#search-bar-entry){flex:none!important;justify-content:flex-end!important}#search-bar-entry{width:2.25rem!important;min-width:2.25rem!important;flex:none!important;padding:0!important;justify-content:center!important;border-radius:9999px!important}#search-bar-entry *{font-size:0!important}#search-bar-entry kbd{display:none!important}div[data-top-chrome]{padding-left:1rem!important;padding-right:1rem!important}#search-bar-entry{width:1.75rem!important;min-width:1.75rem!important;height:1.75rem!important;display:flex!important;align-items:center!important;justify-content:center!important}#search-bar-entry>div{margin:0!important;gap:0!important}#search-bar-entry{width:2.1rem!important;min-width:2.1rem!important;height:2.1rem!important}#search-bar-entry>div{flex:none!important;width:auto!important;justify-content:center!important}#search-bar-entry svg{display:block!important;margin:0 auto!important}#theme-preference-menu-trigger{position:fixed!important;left:1rem;bottom:1rem;z-index:40;background:var(--brand-surface, #ffffff)!important;border:1px solid var(--brand-border, #e5e7eb)!important}#theme-preference-menu-trigger{left:auto!important;right:1rem!important}@media (min-width: 1024px){#content-area{margin-left:auto!important;margin-right:auto!important}}@media (min-width: 1280px){#content-area{max-width:56rem!important}#content-side-layout{margin-right:1.5rem!important;padding-left:1.5rem!important}}@media (min-width: 91.875rem){#sidebar-content{width:18rem!important}#body-content{padding-left:18rem!important}}.strike-price{white-space:nowrap}.strike-price-original{color:#9ca3af;margin-right:0.375rem}.strike-price-current{color:#dc2626;font-weight:600}.dark .strike-price-current,[data-theme=\"dark\"] .strike-price-current{color:#f87171}#banner button{width:1.25rem!important;height:1.25rem!important;right:0.75rem!important;border-radius:9999px!important;opacity:0.55;transition:opacity 0.15s ease, background-color 0.15s ease}#banner button:hover{opacity:1;background:rgba(255, 255, 255, 0.14)!important}#banner button svg{width:12px!important;height:12px!important;stroke-width:1.5}@media (min-width: 1280px){#content-container:not(:has(#table-of-contents-layout))::after{content:\"\";flex:none;width:19.5rem}}.video-intro{margin-top:4px;font-size:0.85em;line-height:1.6}.video-intro-toggle{display:none}.video-intro>label{cursor:pointer;color:#888}.video-intro>label::before{content:\"▸ \"}.video-intro-toggle:checked+label::before{content:\"▾ \"}.video-intro-body{display:none;color:#666;margin-top:4px}.video-intro-toggle:checked~.video-intro-body{display:block}.video-intro-body p{margin:0 0 6px}.video-grid video{margin:0}"}]}
{"page":{"pagePath":"api/responses","slug":"/api/responses","pageMetadata":{"title":"Responses API","sidebarTitle":"Responses API","description":"Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.","openapi":"POST /v1/responses","href":"/api/responses"},"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: \"Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.\"\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`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,CodeBlock,CodeGroup,Note,Table}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(Accordion,{title:`Examples`,id:`examples`,children:_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Python`,numberOfLines:`16`,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:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`client `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` OpenAI(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` api_key`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`os.environ[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"MOONSHOT_API_KEY\"`}),_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:` base_url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://api.moonshot.ai/v1\"`}),_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:` client.responses.create(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"kimi-k3.1-pro\"`}),_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:` instructions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"You are Kimi, an AI assistant provided by Moonshot AI.\"`}),_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:` input`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Explain context caching in one sentence.\"`}),_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:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(response.output_text)`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Node.js`,numberOfLines:`14`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"openai\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` apiKey:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`env`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`MOONSHOT_API_KEY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` baseURL:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.moonshot.ai/v1\"`}),_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:` 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:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`responses`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`create`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` model:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"kimi-k3.1-pro\"`}),_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:` instructions:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"You are Kimi, an AI assistant provided by Moonshot AI.\"`}),_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:` input:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Explain context caching in one sentence.\"`}),_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\":`#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:`response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`output_text`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`cURL`,numberOfLines:`8`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://api.moonshot.ai/v1/responses`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --header`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --header`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$MOONSHOT_API_KEY`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --data`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"model\": \"kimi-k3.1-pro\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"instructions\": \"You are Kimi, an AI assistant provided by Moonshot AI.\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"input\": \"Explain context caching in one sentence.\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` }'`})}),`\n`]})})})]})}),`\n`,_jsxs(Accordion,{title:`Tool Use`,id:`tool-use`,children:[_jsxs(_components.p,{children:[_jsx(_components.code,{children:`tools`}),` supports four tool types: `,_jsx(_components.code,{children:`function`}),`, `,_jsx(_components.code,{children:`namespace`}),`, `,_jsx(_components.code,{children:`custom`}),` (only `,_jsx(_components.code,{children:`apply_patch`}),`), and `,_jsx(_components.code,{children:`web_search`}),`. Other types are not supported. The first three run on your side: the model returns a call request, you execute it and send the result back. `,_jsx(_components.code,{children:`web_search`}),` runs on the server side, with nothing for you to handle.`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Function calling`})}),_jsxs(_components.p,{children:[`Pass functions defined with JSON Schema through `,_jsx(_components.code,{children:`tools`}),`, and the model decides when to call them:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`18`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`18`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"kimi-k3.1-pro\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What is the weather in Beijing today?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"tools\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_weather\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Get the weather for a city\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"city\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"City name\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"city\"`}),_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`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsxs(_components.p,{children:[`When the model decides to call a function, `,_jsx(_components.code,{children:`output`}),` contains a `,_jsx(_components.code,{children:`function_call`}),` item whose `,_jsx(_components.code,{children:`arguments`}),` is a JSON string:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function_call\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"fc_IrcmDq5JNO0JhWdEpsuZnL9J\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"completed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"call_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_weather_0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_weather\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"arguments\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"{`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`city`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Beijing`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`}\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsxs(_components.p,{children:[`After running it locally, append the previous `,_jsx(_components.code,{children:`output`}),` to `,_jsx(_components.code,{children:`input`}),` as is, followed by a `,_jsx(_components.code,{children:`function_call_output`}),` item (its `,_jsx(_components.code,{children:`call_id`}),` must match the `,_jsx(_components.code,{children:`function_call`}),`), and send the next request:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`22`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`22`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"kimi-k3.1-pro\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"input\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"message\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What is the weather in Beijing today?\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function_call\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"call_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_weather_0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_weather\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"arguments\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"{`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`city`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`Beijing`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:`\\\\\"`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},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:` {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function_call_output\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"call_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_weather_0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"output\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Sunny, 25°C\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"tools\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"function\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"name\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"get_weather\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Get the weather for a city\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"parameters\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"object\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"properties\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"city\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"string\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"description\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"City name\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"required\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"city\"`}),_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`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Web search`})}),_jsxs(_components.p,{children:[`Add `,_jsx(_components.code,{children:`{\"type\": \"web_search\"}`}),` to `,_jsx(_components.code,{children:`tools`}),`. The server first decides from the input whether a search is needed, then runs it and injects the results into the model context, and the model answers from those results:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"kimi-k3.1-pro\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"What are the top news stories today?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"tools\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"web_search\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsxs(_components.p,{children:[`When a search ran, a `,_jsx(_components.code,{children:`web_search_call`}),` item appears at the front of `,_jsx(_components.code,{children:`output`}),`. Add `,_jsx(_components.code,{children:`web_search_call.action.sources`}),` to `,_jsx(_components.code,{children:`include`}),` to get the web pages the search hit:`]}),_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"web_search_call\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ws_dackjbcdo9rs73fo3oig\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"status\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"completed\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"action\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"search\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"query\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"top news September 3 2026\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"sources\"`}),_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:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://example.com/news/1\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"title\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"News headline\"`}),_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`]})})}),_jsxs(_components.p,{children:[`Each executed search is billed per call ($0.005 per call, same price for image search); no charge applies if the model does not trigger a search. See `,_jsx(_components.a,{href:`/pricing/websearch`,children:`WebSearch Pricing`}),` for details.`]})]}),`\n`,_jsxs(Accordion,{title:`Context Caching (Cache Write)`,id:`context-caching-cache-write`,children:[_jsxs(_components.p,{children:[`The Kimi API automatically enables context caching for repeated request prefixes; cached portions are billed at a lower price and respond faster. Use `,_jsx(_components.code,{children:`prompt_cache_options`}),` to control cache write behavior:`]}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Parameter`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`prompt_cache_options`})}),_jsx(_components.td,{children:`object`}),_jsxs(_components.td,{children:[`Context cache write options. When omitted, cache write is enabled by default (`,_jsx(_components.code,{children:`5m`}),` tier)`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`prompt_cache_options.mode`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`\"implicit\"`})}),_jsxs(_components.td,{children:[`Cache write mode. Only `,_jsx(_components.code,{children:`implicit`}),` is supported: automatically writes the request prefix to the cache`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`prompt_cache_options.ttl`})}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`\"5m\"`}),` | `,_jsx(_components.code,{children:`\"1h\"`})]}),_jsxs(_components.td,{children:[`Lifetime of the written cache. Only `,_jsx(_components.code,{children:`5m`}),` and `,_jsx(_components.code,{children:`1h`}),` are supported (default `,_jsx(_components.code,{children:`5m`}),`); the two tiers are independent`]})]})]})]}),_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"model\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"kimi-k3.1-pro\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"input\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"prompt_cache_options\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: { `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"mode\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"implicit\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:`\"ttl\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"1h\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),_jsxs(_components.p,{children:[`When `,_jsx(_components.code,{children:`prompt_cache_options`}),` is omitted, cache write is automatically enabled (`,_jsx(_components.code,{children:`5m`}),` tier). The top-level `,_jsx(_components.code,{children:`prompt_cache_options`}),` in the response echoes the options actually applied by the server; refer to the returned value.`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Behavior`})}),_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`The cache is isolated per organization (org); caches are never shared across organizations.`}),`\n`,_jsx(_components.li,{children:`When a request with the same prefix hits the cache within its lifetime, the cache entry is refreshed with its original TTL. Cache hits are billed only at the cache read price, with no additional cache write charge.`}),`\n`,_jsxs(_components.li,{children:[`Cache writes are billed by TTL; see `,_jsx(_components.a,{href:`/pricing/chat`,children:`Pricing`}),` for details.`]}),`\n`,_jsx(_components.li,{children:`Manual cache clearing is not supported; cached prefixes expire automatically after at least 5 minutes of inactivity.`}),`\n`,_jsxs(_components.li,{children:[`Explicit cache breakpoints are not supported: the request is rejected (HTTP 400) if `,_jsx(_components.code,{children:`prompt_cache_breakpoint`}),` appears in `,_jsx(_components.code,{children:`content`}),`.`]}),`\n`]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Usage fields`})}),_jsxs(_components.p,{children:[_jsx(_components.code,{children:`usage.input_tokens`}),` is always the total number of input tokens. Its internal breakdown is returned in `,_jsx(_components.code,{children:`input_tokens_details`}),`:`]}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`usage.input_tokens_details.cached_tokens`})}),_jsx(_components.td,{children:`Tokens served from the cache (cache read)`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`usage.input_tokens_details.cache_write_tokens`})}),_jsx(_components.td,{children:`Tokens written to the cache by this request (cache write)`})]})]})]}),_jsxs(_components.p,{children:[_jsx(_components.code,{children:`cached_tokens`}),`, `,_jsx(_components.code,{children:`cache_write_tokens`}),`, and the uncached remainder are mutually exclusive and sum to `,_jsx(_components.code,{children:`input_tokens`}),`; the uncached remainder = `,_jsx(_components.code,{children:`input_tokens`}),` − `,_jsx(_components.code,{children:`cached_tokens`}),` − `,_jsx(_components.code,{children:`cache_write_tokens`}),`.`]}),_jsx(Note,{children:_jsxs(_components.p,{children:[`For the mechanism behind automatic context caching, see the `,_jsx(_components.a,{href:`/guide/context-caching`,children:`Context Caching guide`}),`.`]})})]})]})}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":"Responses API","sidebarTitle":"Responses API","description":"Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.","openapi":"POST /v1/responses","href":"/api/responses"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"summary":"Create a model response","description":"Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.","tags":["Responses"],"security":["934a5256-f90e-467f-85ef-79438ff0aed4"],"parameters":["3ec4b1d1-02c9-4af0-adf7-85cd785c0ed2"],"requestBody":"9ecee049-2d20-4bb8-90b5-1111ddd9e9a2","responses":{"200":"53c91109-28e1-4fc7-ad69-dc055bd6d833","400":"da9a2406-e397-47fe-8d82-0ecddf8ff83c","401":"a1b7227e-3bc2-48ba-ad2f-135d8bf1b49f","403":"14f6fcff-dc91-4bfc-ad58-ee0eb7b2b64d","429":"522abb1d-3691-4922-9af3-194365231e9a","500":"abcd1e5c-bdfb-4e69-814d-b90300af297c"},"method":"post","type":"path","servers":["0ba739b9-d5bb-4489-8d45-dee9bb1dbc06"],"path":"/v1/responses","baseUrlOptions":["https://api.moonshot.ai"],"title":"Create a model response","codeSamples":[],"requiredOnlyExamples":true,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"3ec4b1d1-02c9-4af0-adf7-85cd785c0ed2":{"name":"X-Msh-Request-Nonce","in":"header","required":false,"description":"A client-generated random nonce (a UUID v4 is recommended). Sending it enables Request Signature: the Kimi API returns `Msh-Request-Timestamp` and `Msh-Request-Signature` in the response headers, which can later be used to prove that the request was handled by the Kimi API. Exactly one non-empty header value is allowed; if the value is invalid, the request proceeds normally but the headers above are not returned. See [Verify Request Signature](/api/signatures-verify).","schema":{"type":"string","minLength":1,"example":"7d929748-0ae6-41c2-ab5d-a186498ad721","isRequired":false,"description":"A client-generated random nonce (a UUID v4 is recommended). Sending it enables Request Signature: the Kimi API returns `Msh-Request-Timestamp` and `Msh-Request-Signature` in the response headers, which can later be used to prove that the request was handled by the Kimi API. Exactly one non-empty header value is allowed; if the value is invalid, the request proceeds normally but the headers above are not returned. See [Verify Request Signature](/api/signatures-verify).","uniqueKey":"","typeLabel":"string"}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","description":"ID of the model to use. This endpoint currently supports `kimi-k3.1-pro`, `kimi-k3.1-pro-highspeed`, and `kimi-k3`.","example":"kimi-k3.1-pro","isRequired":true,"uniqueKey":"model","typeLabel":"string"},"input":{"oneOf":[{"type":"string","description":"Input for this request. A string is equivalent to a single user message. An array holds ordered typed items and may contain conversation history, tool calls, and tool results.","isRequired":true,"uniqueKey":"input.oneOf.0","typeLabel":"string"},{"type":"array","items":{"oneOf":[{"type":"object","title":"Message","description":"An element of the input array, discriminated by `type`. When `type` is omitted the item is treated as `message`.","required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant","developer"],"description":"Message role. `developer` is handled as a system instruction.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.role","typeLabel":"enum\u003cstring>"},"content":{"oneOf":[{"type":"string","description":"Message content, either a string or an array of content parts.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.0","typeLabel":"string"},{"type":"array","items":{"oneOf":[{"type":"object","title":"Input text","description":"An element of a content array, discriminated by `type`.","required":["type","text"],"properties":{"type":{"type":"string","enum":["input_text"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.0.text","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.0","typeLabel":"Input text · object"},{"type":"object","title":"Input image","description":"An element of a content array, discriminated by `type`.","required":["type","image_url"],"properties":{"type":{"type":"string","enum":["input_image"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"image_url":{"type":"string","description":"Data URL of the image, for example `data:image/png;base64,\u003cbase64>`. Public http(s) URLs are not supported.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.1.image_url","typeLabel":"string"},"detail":{"type":"string","enum":["auto","low","high","original"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.1.detail","typeLabel":"enum\u003cstring>"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.1","typeLabel":"Input image · object"},{"type":"object","title":"Output text","description":"An element of a content array, discriminated by `type`.","required":["type","text"],"properties":{"type":{"type":"string","enum":["output_text"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.2.text","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX].oneOf.2","typeLabel":"Output text · object"}],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1.items.[INDEX]","typeLabel":"Input text · object | Input image · object | Output text · object"},"description":"Message content, either a string or an array of content parts.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content.oneOf.1","typeLabel":"(Input text · object | Input image · object | Output text · object)[]"}],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.content","typeLabel":"string | (Input text · object | Input image · object | Output text · object)[]"},"type":{"type":"string","enum":["message"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"status":{"type":"string","enum":["completed"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.0","typeLabel":"Message · object"},{"type":"object","title":"Reasoning","description":"An element of the input array, discriminated by `type`. When `type` is omitted the item is treated as `message`.","required":["type"],"properties":{"type":{"type":"string","enum":["reasoning"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"id":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.id","typeLabel":"string"},"summary":{"type":"array","items":{"type":"object","required":["type","text"],"properties":{"type":{"type":"string","enum":["summary_text"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.summary.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.summary.items.[INDEX].text","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.summary.items.[INDEX]","typeLabel":"object"},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.summary","typeLabel":"object[]"},"content":{"type":"array","items":{"type":"object","required":["type","text"],"properties":{"type":{"type":"string","enum":["reasoning_text"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.content.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.content.items.[INDEX].text","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.content.items.[INDEX]","typeLabel":"object"},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.content","typeLabel":"object[]"},"status":{"type":"string","enum":["completed"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.1","typeLabel":"Reasoning · object"},{"type":"object","title":"Function call","description":"An element of the input array, discriminated by `type`. When `type` is omitted the item is treated as `message`.","required":["type","call_id","name","arguments"],"properties":{"type":{"type":"string","enum":["function_call"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"call_id":{"type":"string","description":"Call ID paired with the matching `function_call_output`.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.2.call_id","typeLabel":"string"},"name":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.2.name","typeLabel":"string"},"arguments":{"type":"string","description":"JSON string of the function arguments.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.2.arguments","typeLabel":"string"},"id":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.2.id","typeLabel":"string"},"namespace":{"type":"string","description":"Namespace the tool belongs to, returned for namespace tool calls.","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.2.namespace","typeLabel":"string"},"status":{"type":"string","enum":["completed"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.2.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.2","typeLabel":"Function call · object"},{"type":"object","title":"Function call output","description":"An element of the input array, discriminated by `type`. When `type` is omitted the item is treated as `message`.","required":["type","call_id","output"],"properties":{"type":{"type":"string","enum":["function_call_output"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.type","typeLabel":"enum\u003cstring>"},"call_id":{"type":"string","description":"Same call ID as the matching `function_call`.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.call_id","typeLabel":"string"},"output":{"oneOf":[{"type":"string","description":"Content returned by the tool.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.0","typeLabel":"string"},{"type":"array","items":{"oneOf":[{"type":"object","title":"Input text","description":"An element of a content array, discriminated by `type`.","required":["type","text"],"properties":{"type":{"type":"string","enum":["input_text"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.0.text","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.0","typeLabel":"Input text · object"},{"type":"object","title":"Input image","description":"An element of a content array, discriminated by `type`.","required":["type","image_url"],"properties":{"type":{"type":"string","enum":["input_image"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"image_url":{"type":"string","description":"Data URL of the image, for example `data:image/png;base64,\u003cbase64>`. Public http(s) URLs are not supported.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.1.image_url","typeLabel":"string"},"detail":{"type":"string","enum":["auto","low","high","original"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.1.detail","typeLabel":"enum\u003cstring>"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.1","typeLabel":"Input image · object"},{"type":"object","title":"Output text","description":"An element of a content array, discriminated by `type`.","required":["type","text"],"properties":{"type":{"type":"string","enum":["output_text"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.2.text","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX].oneOf.2","typeLabel":"Output text · object"}],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1.items.[INDEX]","typeLabel":"Input text · object | Input image · object | Output text · object"},"description":"Content returned by the tool.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output.oneOf.1","typeLabel":"(Input text · object | Input image · object | Output text · object)[]"}],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.output","typeLabel":"string | (Input text · object | Input image · object | Output text · object)[]"},"status":{"type":"string","enum":["completed"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.3","typeLabel":"Function call output · object"},{"type":"object","title":"Custom tool call","description":"An element of the input array, discriminated by `type`. When `type` is omitted the item is treated as `message`.","required":["type","call_id","name","input"],"properties":{"type":{"type":"string","enum":["custom_tool_call"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.4.type","typeLabel":"enum\u003cstring>"},"call_id":{"type":"string","description":"Call ID paired with the matching `custom_tool_call_output`.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.4.call_id","typeLabel":"string"},"name":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.4.name","typeLabel":"string"},"input":{"type":"string","description":"Free-form text input generated by the model.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.4.input","typeLabel":"string"},"id":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.4.id","typeLabel":"string"},"namespace":{"type":"string","description":"Namespace the tool belongs to, returned for namespace tool calls.","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.4.namespace","typeLabel":"string"},"status":{"type":"string","enum":["completed"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.4.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.4","typeLabel":"Custom tool call · object"},{"type":"object","title":"Custom tool call output","description":"An element of the input array, discriminated by `type`. When `type` is omitted the item is treated as `message`.","required":["type","call_id","output"],"properties":{"type":{"type":"string","enum":["custom_tool_call_output"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.type","typeLabel":"enum\u003cstring>"},"call_id":{"type":"string","description":"Same call ID as the matching `custom_tool_call`.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.call_id","typeLabel":"string"},"output":{"oneOf":[{"type":"string","description":"Content returned by the tool.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.0","typeLabel":"string"},{"type":"array","items":{"oneOf":[{"type":"object","title":"Input text","description":"An element of a content array, discriminated by `type`.","required":["type","text"],"properties":{"type":{"type":"string","enum":["input_text"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.0.text","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.0","typeLabel":"Input text · object"},{"type":"object","title":"Input image","description":"An element of a content array, discriminated by `type`.","required":["type","image_url"],"properties":{"type":{"type":"string","enum":["input_image"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"image_url":{"type":"string","description":"Data URL of the image, for example `data:image/png;base64,\u003cbase64>`. Public http(s) URLs are not supported.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.1.image_url","typeLabel":"string"},"detail":{"type":"string","enum":["auto","low","high","original"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.1.detail","typeLabel":"enum\u003cstring>"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.1","typeLabel":"Input image · object"},{"type":"object","title":"Output text","description":"An element of a content array, discriminated by `type`.","required":["type","text"],"properties":{"type":{"type":"string","enum":["output_text"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.2.text","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX].oneOf.2","typeLabel":"Output text · object"}],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1.items.[INDEX]","typeLabel":"Input text · object | Input image · object | Output text · object"},"description":"Content returned by the tool.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output.oneOf.1","typeLabel":"(Input text · object | Input image · object | Output text · object)[]"}],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.output","typeLabel":"string | (Input text · object | Input image · object | Output text · object)[]"},"status":{"type":"string","enum":["completed"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.5","typeLabel":"Custom tool call output · object"},{"type":"object","title":"Web search call","description":"An element of the input array, discriminated by `type`. When `type` is omitted the item is treated as `message`.","required":["type"],"properties":{"type":{"type":"string","enum":["web_search_call"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.6.type","typeLabel":"enum\u003cstring>"},"id":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.6.id","typeLabel":"string"},"status":{"type":"string","enum":["completed"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.6.status","typeLabel":"enum\u003cstring>"},"action":{"type":"object","properties":{"type":{"type":"string","enum":["search"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.6.action.type","typeLabel":"enum\u003cstring>"},"query":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.6.action.query","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.6.action","typeLabel":"object"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.6","typeLabel":"Web search call · object"},{"type":"object","title":"Additional tools","description":"An element of the input array, discriminated by `type`. When `type` is omitted the item is treated as `message`.","required":["type","role","tools"],"properties":{"type":{"type":"string","enum":["additional_tools"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.type","typeLabel":"enum\u003cstring>"},"role":{"type":"string","enum":["developer"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.role","typeLabel":"enum\u003cstring>"},"tools":{"type":"array","items":{"oneOf":[{"type":"object","title":"Function tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name"],"properties":{"type":{"type":"string","enum":["function"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","description":"Function name. Must follow the regex: ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","pattern":"^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.0.name","typeLabel":"string"},"description":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.0.description","typeLabel":"string"},"parameters":{"type":"object","description":"JSON Schema describing the function arguments.","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.0.parameters","typeLabel":"object"},"strict":{"type":"boolean","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.0.strict","typeLabel":"boolean"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.0","typeLabel":"Function tool · object"},{"type":"object","title":"Custom tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name","format"],"properties":{"type":{"type":"string","enum":["custom"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","enum":["apply_patch"],"description":"Tool name. Only `apply_patch` is supported.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.1.name","typeLabel":"enum\u003cstring>"},"format":{"type":"object","description":"Input format constraint. Only the `grammar` type with `lark` syntax is supported.","required":["type","syntax","definition"],"properties":{"type":{"type":"string","enum":["grammar"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.1.format.type","typeLabel":"enum\u003cstring>"},"syntax":{"type":"string","enum":["lark"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.1.format.syntax","typeLabel":"enum\u003cstring>"},"definition":{"type":"string","description":"The Lark grammar definition.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.1.format.definition","typeLabel":"string"}},"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.1.format","typeLabel":"object"},"description":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.1.description","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.1","typeLabel":"Custom tool · object"},{"type":"object","title":"Namespace tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name","description","tools"],"properties":{"type":{"type":"string","enum":["namespace"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.name","typeLabel":"string"},"description":{"type":"string","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.description","typeLabel":"string"},"tools":{"type":"array","items":{"oneOf":[{"type":"object","title":"Function tool","description":"A function tool whose arguments are described by a JSON Schema.","required":["type","name"],"properties":{"type":{"type":"string","enum":["function"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","description":"Function name. Must follow the regex: ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","pattern":"^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.name","typeLabel":"string"},"description":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.description","typeLabel":"string"},"parameters":{"type":"object","description":"JSON Schema describing the function arguments.","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.parameters","typeLabel":"object"},"strict":{"type":"boolean","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.strict","typeLabel":"boolean"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0","typeLabel":"Function tool · object"},{"type":"object","title":"Custom tool","description":"A custom tool that takes free-form text input. Only the custom tool named `apply_patch` is supported, and it must define a `grammar` + `lark` format; when the model calls it, a `custom_tool_call` item is returned in the output.","required":["type","name","format"],"properties":{"type":{"type":"string","enum":["custom"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","enum":["apply_patch"],"description":"Tool name. Only `apply_patch` is supported.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.name","typeLabel":"enum\u003cstring>"},"format":{"type":"object","description":"Input format constraint. Only the `grammar` type with `lark` syntax is supported.","required":["type","syntax","definition"],"properties":{"type":{"type":"string","enum":["grammar"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format.type","typeLabel":"enum\u003cstring>"},"syntax":{"type":"string","enum":["lark"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format.syntax","typeLabel":"enum\u003cstring>"},"definition":{"type":"string","description":"The Lark grammar definition.","isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format.definition","typeLabel":"string"}},"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format","typeLabel":"object"},"description":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.description","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1","typeLabel":"Custom tool · object"}],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools.items.[INDEX]","typeLabel":"Function tool · object | Custom tool · object"},"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2.tools","typeLabel":"(Function tool · object | Custom tool · object)[]"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.2","typeLabel":"Namespace tool · object"},{"type":"object","title":"Web search tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type"],"properties":{"type":{"type":"string","enum":["web_search"],"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3.type","typeLabel":"enum\u003cstring>"},"filters":{"type":"object","description":"Search scope filters.","properties":{"allowed_domains":{"type":"array","items":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3.filters.allowed_domains.items.[INDEX]","typeLabel":"string"},"maxItems":100,"description":"Restrict the search to these domains, up to 100.","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3.filters.allowed_domains","typeLabel":"string[]"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3.filters","typeLabel":"object"},"search_content_types":{"type":"array","items":{"type":"string","enum":["text","image"],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3.search_content_types.items.[INDEX]","typeLabel":"enum\u003cstring>"},"default":["text"],"description":"Result types to search for. Defaults to `text` only. Including `image` additionally runs an image search.","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3.search_content_types","typeLabel":"enum\u003cstring>[]"},"image_settings":{"type":"object","description":"Image search settings. Only effective when `search_content_types` includes `image`.","properties":{"max_results":{"type":"integer","minimum":1,"maximum":10,"default":3,"description":"Maximum number of images to return.","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3.image_settings.max_results","typeLabel":"integer"},"caption":{"type":"boolean","default":false,"description":"Whether to generate a caption for each image.","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3.image_settings.caption","typeLabel":"boolean"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3.image_settings","typeLabel":"object"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX].oneOf.3","typeLabel":"Web search tool · object"}],"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools.items.[INDEX]","typeLabel":"Function tool · object | Custom tool · object | Namespace tool · object | Web search tool · object"},"isRequired":true,"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.tools","typeLabel":"(Function tool · object | Custom tool · object | Namespace tool · object | Web search tool · object)[]"},"id":{"type":"string","uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7.id","typeLabel":"string"}},"uniqueKey":"input.oneOf.1.items.[INDEX].oneOf.7","typeLabel":"Additional tools · object"}],"uniqueKey":"input.oneOf.1.items.[INDEX]","typeLabel":"Message · object | Reasoning · object | Function call · object | Function call output · object | Custom tool call · object | Custom tool call output · object | Web search call · object | Additional tools · object"},"description":"Input for this request. A string is equivalent to a single user message. An array holds ordered typed items and may contain conversation history, tool calls, and tool results.","isRequired":true,"uniqueKey":"input.oneOf.1","typeLabel":"(Message · object | Reasoning · object | Function call · object | Function call output · object | Custom tool call · object | Custom tool call output · object | Web search call · object | Additional tools · object)[]"}],"isRequired":true,"uniqueKey":"input","typeLabel":"string | (Message · object | Reasoning · object | Function call · object | Function call output · object | Custom tool call · object | Custom tool call output · object | Web search call · object | Additional tools · object)[]"},"instructions":{"type":"string","description":"Top-level system instructions, applied ahead of every input item.","uniqueKey":"instructions","typeLabel":"string"},"stream":{"type":"boolean","default":false,"description":"When true, the response is delivered as a stream of SSE events.","uniqueKey":"stream","typeLabel":"boolean"},"max_output_tokens":{"type":"integer","description":"Maximum number of tokens to generate for this response. For Kimi K3-series models (`kimi-k3.1-pro`, `kimi-k3.1-pro-highspeed`, and `kimi-k3`) it defaults to 131072 and can be set up to 1048576. This refers to the length of tokens you expect us to return, not the total length of input plus output. When the limit is reached, `status` is `incomplete` and `incomplete_details.reason` is `max_output_tokens`.","uniqueKey":"max_output_tokens","typeLabel":"integer"},"reasoning":{"type":"object","description":"Reasoning configuration.","properties":{"effort":{"type":"string","enum":["low","high","max"],"default":"max","description":"Reasoning depth. Higher levels reason more thoroughly, which usually also increases latency and reasoning token usage.","uniqueKey":"reasoning.effort","typeLabel":"enum\u003cstring>"}},"uniqueKey":"reasoning","typeLabel":"object"},"text":{"type":"object","description":"Output text configuration.","properties":{"format":{"type":"object","required":["type","schema"],"description":"Constrains the output structure with a JSON Schema.","properties":{"type":{"type":"string","enum":["json_schema"],"isRequired":true,"uniqueKey":"text.format.type","typeLabel":"enum\u003cstring>"},"schema":{"type":"object","description":"JSON Schema describing the output structure.","isRequired":true,"uniqueKey":"text.format.schema","typeLabel":"object"},"name":{"type":"string","description":"Schema name. Defaults to `output`.","uniqueKey":"text.format.name","typeLabel":"string"},"strict":{"type":"boolean","description":"Whether the output must strictly conform to the schema.","uniqueKey":"text.format.strict","typeLabel":"boolean"}},"uniqueKey":"text.format","typeLabel":"object"}},"uniqueKey":"text","typeLabel":"object"},"tools":{"type":"array","description":"List of tools the model may call.","items":{"oneOf":[{"type":"object","title":"Function tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name"],"properties":{"type":{"type":"string","enum":["function"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","description":"Function name. Must follow the regex: ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","pattern":"^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.0.name","typeLabel":"string"},"description":{"type":"string","uniqueKey":"tools.items.[INDEX].oneOf.0.description","typeLabel":"string"},"parameters":{"type":"object","description":"JSON Schema describing the function arguments.","uniqueKey":"tools.items.[INDEX].oneOf.0.parameters","typeLabel":"object"},"strict":{"type":"boolean","uniqueKey":"tools.items.[INDEX].oneOf.0.strict","typeLabel":"boolean"}},"uniqueKey":"tools.items.[INDEX].oneOf.0","typeLabel":"Function tool · object"},{"type":"object","title":"Custom tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name","format"],"properties":{"type":{"type":"string","enum":["custom"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","enum":["apply_patch"],"description":"Tool name. Only `apply_patch` is supported.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.name","typeLabel":"enum\u003cstring>"},"format":{"type":"object","description":"Input format constraint. Only the `grammar` type with `lark` syntax is supported.","required":["type","syntax","definition"],"properties":{"type":{"type":"string","enum":["grammar"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.format.type","typeLabel":"enum\u003cstring>"},"syntax":{"type":"string","enum":["lark"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.format.syntax","typeLabel":"enum\u003cstring>"},"definition":{"type":"string","description":"The Lark grammar definition.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.format.definition","typeLabel":"string"}},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.1.format","typeLabel":"object"},"description":{"type":"string","uniqueKey":"tools.items.[INDEX].oneOf.1.description","typeLabel":"string"}},"uniqueKey":"tools.items.[INDEX].oneOf.1","typeLabel":"Custom tool · object"},{"type":"object","title":"Namespace tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name","description","tools"],"properties":{"type":{"type":"string","enum":["namespace"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.name","typeLabel":"string"},"description":{"type":"string","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.description","typeLabel":"string"},"tools":{"type":"array","items":{"oneOf":[{"type":"object","title":"Function tool","description":"A function tool whose arguments are described by a JSON Schema.","required":["type","name"],"properties":{"type":{"type":"string","enum":["function"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","description":"Function name. Must follow the regex: ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","pattern":"^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.name","typeLabel":"string"},"description":{"type":"string","uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.description","typeLabel":"string"},"parameters":{"type":"object","description":"JSON Schema describing the function arguments.","uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.parameters","typeLabel":"object"},"strict":{"type":"boolean","uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.strict","typeLabel":"boolean"}},"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0","typeLabel":"Function tool · object"},{"type":"object","title":"Custom tool","description":"A custom tool that takes free-form text input. Only the custom tool named `apply_patch` is supported, and it must define a `grammar` + `lark` format; when the model calls it, a `custom_tool_call` item is returned in the output.","required":["type","name","format"],"properties":{"type":{"type":"string","enum":["custom"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","enum":["apply_patch"],"description":"Tool name. Only `apply_patch` is supported.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.name","typeLabel":"enum\u003cstring>"},"format":{"type":"object","description":"Input format constraint. Only the `grammar` type with `lark` syntax is supported.","required":["type","syntax","definition"],"properties":{"type":{"type":"string","enum":["grammar"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format.type","typeLabel":"enum\u003cstring>"},"syntax":{"type":"string","enum":["lark"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format.syntax","typeLabel":"enum\u003cstring>"},"definition":{"type":"string","description":"The Lark grammar definition.","isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format.definition","typeLabel":"string"}},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format","typeLabel":"object"},"description":{"type":"string","uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.description","typeLabel":"string"}},"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1","typeLabel":"Custom tool · object"}],"uniqueKey":"tools.items.[INDEX].oneOf.2.tools.items.[INDEX]","typeLabel":"Function tool · object | Custom tool · object"},"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.2.tools","typeLabel":"(Function tool · object | Custom tool · object)[]"}},"uniqueKey":"tools.items.[INDEX].oneOf.2","typeLabel":"Namespace tool · object"},{"type":"object","title":"Web search tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type"],"properties":{"type":{"type":"string","enum":["web_search"],"isRequired":true,"uniqueKey":"tools.items.[INDEX].oneOf.3.type","typeLabel":"enum\u003cstring>"},"filters":{"type":"object","description":"Search scope filters.","properties":{"allowed_domains":{"type":"array","items":{"type":"string","uniqueKey":"tools.items.[INDEX].oneOf.3.filters.allowed_domains.items.[INDEX]","typeLabel":"string"},"maxItems":100,"description":"Restrict the search to these domains, up to 100.","uniqueKey":"tools.items.[INDEX].oneOf.3.filters.allowed_domains","typeLabel":"string[]"}},"uniqueKey":"tools.items.[INDEX].oneOf.3.filters","typeLabel":"object"},"search_content_types":{"type":"array","items":{"type":"string","enum":["text","image"],"uniqueKey":"tools.items.[INDEX].oneOf.3.search_content_types.items.[INDEX]","typeLabel":"enum\u003cstring>"},"default":["text"],"description":"Result types to search for. Defaults to `text` only. Including `image` additionally runs an image search.","uniqueKey":"tools.items.[INDEX].oneOf.3.search_content_types","typeLabel":"enum\u003cstring>[]"},"image_settings":{"type":"object","description":"Image search settings. Only effective when `search_content_types` includes `image`.","properties":{"max_results":{"type":"integer","minimum":1,"maximum":10,"default":3,"description":"Maximum number of images to return.","uniqueKey":"tools.items.[INDEX].oneOf.3.image_settings.max_results","typeLabel":"integer"},"caption":{"type":"boolean","default":false,"description":"Whether to generate a caption for each image.","uniqueKey":"tools.items.[INDEX].oneOf.3.image_settings.caption","typeLabel":"boolean"}},"uniqueKey":"tools.items.[INDEX].oneOf.3.image_settings","typeLabel":"object"}},"uniqueKey":"tools.items.[INDEX].oneOf.3","typeLabel":"Web search tool · object"}],"uniqueKey":"tools.items.[INDEX]","typeLabel":"Function tool · object | Custom tool · object | Namespace tool · object | Web search tool · object"},"uniqueKey":"tools","typeLabel":"(Function tool · object | Custom tool · object | Namespace tool · object | Web search tool · object)[]"},"tool_choice":{"type":"string","enum":["auto"],"description":"Controls tool-calling behavior. With `auto`, the model decides whether to call a tool.","uniqueKey":"tool_choice","typeLabel":"enum\u003cstring>"},"include":{"type":"array","items":{"type":"string","enum":["web_search_call.results","web_search_call.action.sources"],"uniqueKey":"include.items.[INDEX]","typeLabel":"enum\u003cstring>"},"description":"Additional fields to return. Only effective when the `web_search` tool is used. `web_search_call.action.sources` returns the web pages the search hit; `web_search_call.results` returns image search results.","uniqueKey":"include","typeLabel":"enum\u003cstring>[]"},"prompt_cache_key":{"type":"string","description":"Context cache identifier. Reusing the same value across a session improves cache hit rate.","uniqueKey":"prompt_cache_key","typeLabel":"string"},"prompt_cache_options":{"type":"object","description":"Context cache write options. When omitted, cache write is enabled by default (5m tier): the system automatically writes the request prefix to the 5m cache tier","properties":{"mode":{"type":"string","enum":["implicit"],"default":"implicit","description":"Cache write mode. Only implicit is supported: automatically writes the request prefix to the cache","uniqueKey":"prompt_cache_options.mode","typeLabel":"enum\u003cstring>"},"ttl":{"type":"string","enum":["5m","1h"],"default":"5m","description":"Lifetime of the written cache. The 5m and 1h tiers are independent of each other. When a request with the same prefix hits the cache within its lifetime, the cache entry is refreshed with its original TTL","uniqueKey":"prompt_cache_options.ttl","typeLabel":"enum\u003cstring>"}},"uniqueKey":"prompt_cache_options","typeLabel":"object"},"safety_identifier":{"type":"string","description":"A stable identifier used to help detect users of your application that may be violating usage policies. The ID should be a string that uniquely identifies each user. It is recommended to hash the username or email address to avoid sending any identifying information","uniqueKey":"safety_identifier","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"model":"kimi-k3.1-pro","input":"\u003cstring>","instructions":"\u003cstring>","stream":false,"max_output_tokens":123,"reasoning":{"effort":"max"},"text":{},"tools":[{"type":"function","name":"\u003cstring>","description":"\u003cstring>","parameters":{},"strict":true}],"tool_choice":"auto","include":[],"prompt_cache_key":"\u003cstring>","prompt_cache_options":{"mode":"implicit","ttl":"5m"},"safety_identifier":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"53c91109-28e1-4fc7-ad69-dc055bd6d833":{"description":"The response was created","headers":{"Msh-Request-Timestamp":{"description":"Unix timestamp in milliseconds at which the Kimi API accepted this request. Only returned when the request carries a valid `X-Msh-Request-Nonce`.","schema":{"type":"integer","format":"int64","example":1786338000123}},"Msh-Request-Signature":{"description":"Signature token prefixed with `reqsigv1_`, issued by the Kimi API over the nonce, timestamp, and the request's `model`; verify it with `POST /v1/signatures/verify`. Only returned when the request carries a valid `X-Msh-Request-Nonce`.","schema":{"type":"string","example":"reqsigv1_\u003copaque-token>"}}},"content":{"application/json":{"schema":{"type":"object","description":"A single model response.","properties":{"id":{"type":"string","description":"Unique identifier of the response.","example":"resp_68f0c1c2d3e4f5a6b7c8d9e0","uniqueKey":"id","typeLabel":"string"},"object":{"type":"string","enum":["response"],"uniqueKey":"object","typeLabel":"enum\u003cstring>"},"created_at":{"type":"integer","description":"Unix timestamp of when the response was created.","uniqueKey":"created_at","typeLabel":"integer"},"completed_at":{"oneOf":[{"type":"integer","description":"Unix timestamp of when the response finished. Present when `status` is `completed` or `incomplete`; `null` when `status` is `in_progress` or `failed`.","uniqueKey":"completed_at.oneOf.0","typeLabel":"integer"},{"type":"null","description":"Unix timestamp of when the response finished. Present when `status` is `completed` or `incomplete`; `null` when `status` is `in_progress` or `failed`.","uniqueKey":"completed_at.oneOf.1","typeLabel":"null"}],"uniqueKey":"completed_at","typeLabel":"integer | null"},"status":{"type":"string","enum":["in_progress","completed","incomplete","failed"],"description":"Response status. The opening snapshot of a stream is `in_progress`.","uniqueKey":"status","typeLabel":"enum\u003cstring>"},"model":{"type":"string","description":"Model that produced the response.","uniqueKey":"model","typeLabel":"string"},"output":{"type":"array","description":"The output item array, ordered as web_search_call (if any), reasoning, message, tool calls.","items":{"oneOf":[{"type":"object","title":"Reasoning","description":"An element of the output array, discriminated by `type`.","properties":{"type":{"type":"string","enum":["reasoning"],"uniqueKey":"output.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"id":{"type":"string","example":"rs_68f0c1c2d3e4f5a6b7c8d9e0","uniqueKey":"output.items.[INDEX].oneOf.0.id","typeLabel":"string"},"summary":{"type":"array","description":"The reasoning content.","items":{"type":"object","properties":{"type":{"type":"string","enum":["summary_text"],"uniqueKey":"output.items.[INDEX].oneOf.0.summary.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","uniqueKey":"output.items.[INDEX].oneOf.0.summary.items.[INDEX].text","typeLabel":"string"}},"uniqueKey":"output.items.[INDEX].oneOf.0.summary.items.[INDEX]","typeLabel":"object"},"uniqueKey":"output.items.[INDEX].oneOf.0.summary","typeLabel":"object[]"},"encrypted_content":{"oneOf":[{"type":"string","description":"Always `null`.","uniqueKey":"output.items.[INDEX].oneOf.0.encrypted_content.oneOf.0","typeLabel":"string"},{"type":"null","description":"Always `null`.","uniqueKey":"output.items.[INDEX].oneOf.0.encrypted_content.oneOf.1","typeLabel":"null"}],"uniqueKey":"output.items.[INDEX].oneOf.0.encrypted_content","typeLabel":"string | null"},"status":{"type":"string","enum":["in_progress","completed"],"uniqueKey":"output.items.[INDEX].oneOf.0.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"output.items.[INDEX].oneOf.0","typeLabel":"Reasoning · object"},{"type":"object","title":"Message","description":"An element of the output array, discriminated by `type`.","properties":{"type":{"type":"string","enum":["message"],"uniqueKey":"output.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"id":{"type":"string","example":"msg_68f0c1c2d3e4f5a6b7c8d9e0","uniqueKey":"output.items.[INDEX].oneOf.1.id","typeLabel":"string"},"role":{"type":"string","enum":["assistant"],"uniqueKey":"output.items.[INDEX].oneOf.1.role","typeLabel":"enum\u003cstring>"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["output_text"],"uniqueKey":"output.items.[INDEX].oneOf.1.content.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"text":{"type":"string","uniqueKey":"output.items.[INDEX].oneOf.1.content.items.[INDEX].text","typeLabel":"string"},"annotations":{"type":"array","items":{"oneOf":[{}],"uniqueKey":"output.items.[INDEX].oneOf.1.content.items.[INDEX].annotations.items.[INDEX]","typeLabel":"any"},"uniqueKey":"output.items.[INDEX].oneOf.1.content.items.[INDEX].annotations","typeLabel":"any[]"}},"uniqueKey":"output.items.[INDEX].oneOf.1.content.items.[INDEX]","typeLabel":"object"},"uniqueKey":"output.items.[INDEX].oneOf.1.content","typeLabel":"object[]"},"status":{"type":"string","enum":["in_progress","completed"],"uniqueKey":"output.items.[INDEX].oneOf.1.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"output.items.[INDEX].oneOf.1","typeLabel":"Message · object"},{"type":"object","title":"Function call","description":"An element of the output array, discriminated by `type`.","properties":{"type":{"type":"string","enum":["function_call"],"uniqueKey":"output.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"id":{"type":"string","example":"fc_68f0c1c2d3e4f5a6b7c8d9e0","uniqueKey":"output.items.[INDEX].oneOf.2.id","typeLabel":"string"},"call_id":{"type":"string","description":"Use this value in `function_call_output` when returning the result.","uniqueKey":"output.items.[INDEX].oneOf.2.call_id","typeLabel":"string"},"name":{"type":"string","uniqueKey":"output.items.[INDEX].oneOf.2.name","typeLabel":"string"},"namespace":{"type":"string","description":"Returned for namespace tool calls.","uniqueKey":"output.items.[INDEX].oneOf.2.namespace","typeLabel":"string"},"arguments":{"type":"string","description":"JSON string of the function arguments.","uniqueKey":"output.items.[INDEX].oneOf.2.arguments","typeLabel":"string"},"status":{"type":"string","enum":["in_progress","completed"],"uniqueKey":"output.items.[INDEX].oneOf.2.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"output.items.[INDEX].oneOf.2","typeLabel":"Function call · object"},{"type":"object","title":"Custom tool call","description":"An element of the output array, discriminated by `type`.","properties":{"type":{"type":"string","enum":["custom_tool_call"],"uniqueKey":"output.items.[INDEX].oneOf.3.type","typeLabel":"enum\u003cstring>"},"id":{"type":"string","example":"ctc_68f0c1c2d3e4f5a6b7c8d9e0","uniqueKey":"output.items.[INDEX].oneOf.3.id","typeLabel":"string"},"call_id":{"type":"string","description":"Use this value in `custom_tool_call_output` when returning the result.","uniqueKey":"output.items.[INDEX].oneOf.3.call_id","typeLabel":"string"},"name":{"type":"string","uniqueKey":"output.items.[INDEX].oneOf.3.name","typeLabel":"string"},"namespace":{"type":"string","description":"Returned for namespace tool calls.","uniqueKey":"output.items.[INDEX].oneOf.3.namespace","typeLabel":"string"},"input":{"type":"string","description":"Free-form text input generated by the model.","uniqueKey":"output.items.[INDEX].oneOf.3.input","typeLabel":"string"},"status":{"type":"string","enum":["in_progress","completed"],"uniqueKey":"output.items.[INDEX].oneOf.3.status","typeLabel":"enum\u003cstring>"}},"uniqueKey":"output.items.[INDEX].oneOf.3","typeLabel":"Custom tool call · object"},{"type":"object","title":"Web search call","description":"An element of the output array, discriminated by `type`.","properties":{"type":{"type":"string","enum":["web_search_call"],"uniqueKey":"output.items.[INDEX].oneOf.4.type","typeLabel":"enum\u003cstring>"},"id":{"type":"string","example":"ws_68f0c1c2d3e4f5a6b7c8d9e0","uniqueKey":"output.items.[INDEX].oneOf.4.id","typeLabel":"string"},"status":{"type":"string","enum":["in_progress","completed"],"uniqueKey":"output.items.[INDEX].oneOf.4.status","typeLabel":"enum\u003cstring>"},"action":{"type":"object","description":"The action performed by this search.","properties":{"type":{"type":"string","enum":["search"],"uniqueKey":"output.items.[INDEX].oneOf.4.action.type","typeLabel":"enum\u003cstring>"},"query":{"type":"string","description":"The search query actually used.","uniqueKey":"output.items.[INDEX].oneOf.4.action.query","typeLabel":"string"},"sources":{"type":"array","description":"Web pages the search hit. Returned only when `include` contains `web_search_call.action.sources`.","items":{"type":"object","properties":{"type":{"type":"string","enum":["url"],"uniqueKey":"output.items.[INDEX].oneOf.4.action.sources.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"url":{"type":"string","uniqueKey":"output.items.[INDEX].oneOf.4.action.sources.items.[INDEX].url","typeLabel":"string"},"title":{"type":"string","uniqueKey":"output.items.[INDEX].oneOf.4.action.sources.items.[INDEX].title","typeLabel":"string"}},"uniqueKey":"output.items.[INDEX].oneOf.4.action.sources.items.[INDEX]","typeLabel":"object"},"uniqueKey":"output.items.[INDEX].oneOf.4.action.sources","typeLabel":"object[]"}},"uniqueKey":"output.items.[INDEX].oneOf.4.action","typeLabel":"object"},"results":{"type":"array","description":"Image search results. Returned only when `include` contains `web_search_call.results` and `search_content_types` includes `image`.","items":{"type":"object","properties":{"type":{"type":"string","enum":["image_result"],"uniqueKey":"output.items.[INDEX].oneOf.4.results.items.[INDEX].type","typeLabel":"enum\u003cstring>"},"image_url":{"type":"string","uniqueKey":"output.items.[INDEX].oneOf.4.results.items.[INDEX].image_url","typeLabel":"string"},"thumbnail_url":{"type":"string","uniqueKey":"output.items.[INDEX].oneOf.4.results.items.[INDEX].thumbnail_url","typeLabel":"string"},"source_website_url":{"type":"string","uniqueKey":"output.items.[INDEX].oneOf.4.results.items.[INDEX].source_website_url","typeLabel":"string"},"caption":{"type":"string","description":"Image caption. Returned only when `image_settings.caption` is enabled.","uniqueKey":"output.items.[INDEX].oneOf.4.results.items.[INDEX].caption","typeLabel":"string"}},"uniqueKey":"output.items.[INDEX].oneOf.4.results.items.[INDEX]","typeLabel":"object"},"uniqueKey":"output.items.[INDEX].oneOf.4.results","typeLabel":"object[]"}},"uniqueKey":"output.items.[INDEX].oneOf.4","typeLabel":"Web search call · object"}],"uniqueKey":"output.items.[INDEX]","typeLabel":"Reasoning · object | Message · object | Function call · object | Custom tool call · object | Web search call · object"},"uniqueKey":"output","typeLabel":"(Reasoning · object | Message · object | Function call · object | Custom tool call · object | Web search call · object)[]"},"usage":{"oneOf":[{"type":"object","description":"Token usage for this response.","properties":{"input_tokens":{"type":"integer","description":"Number of input tokens, including cached tokens.","uniqueKey":"usage.oneOf.0.input_tokens","typeLabel":"integer"},"input_tokens_details":{"type":"object","properties":{"cached_tokens":{"type":"integer","description":"Number of tokens served from the context cache.","uniqueKey":"usage.oneOf.0.input_tokens_details.cached_tokens","typeLabel":"integer"},"cache_write_tokens":{"type":"integer","description":"Number of tokens written to the context cache.","uniqueKey":"usage.oneOf.0.input_tokens_details.cache_write_tokens","typeLabel":"integer"}},"uniqueKey":"usage.oneOf.0.input_tokens_details","typeLabel":"object"},"output_tokens":{"type":"integer","description":"Number of output tokens, including reasoning tokens.","uniqueKey":"usage.oneOf.0.output_tokens","typeLabel":"integer"},"output_tokens_details":{"type":"object","properties":{"reasoning_tokens":{"type":"integer","description":"Number of tokens spent on reasoning.","uniqueKey":"usage.oneOf.0.output_tokens_details.reasoning_tokens","typeLabel":"integer"}},"uniqueKey":"usage.oneOf.0.output_tokens_details","typeLabel":"object"},"total_tokens":{"type":"integer","description":"Total number of tokens.","uniqueKey":"usage.oneOf.0.total_tokens","typeLabel":"integer"}},"uniqueKey":"usage.oneOf.0","typeLabel":"object"},{"type":"null","uniqueKey":"usage.oneOf.1","typeLabel":"null"}],"uniqueKey":"usage","typeLabel":"object | null"},"incomplete_details":{"oneOf":[{"type":"object","description":"Reason the response is `incomplete`.","properties":{"reason":{"type":"string","enum":["max_output_tokens","content_filter"],"uniqueKey":"incomplete_details.oneOf.0.reason","typeLabel":"enum\u003cstring>"}},"uniqueKey":"incomplete_details.oneOf.0","typeLabel":"object"},{"type":"null","description":"Reason the response is `incomplete`.","properties":{"reason":{"type":"string","enum":["max_output_tokens","content_filter"]}},"uniqueKey":"incomplete_details.oneOf.1","typeLabel":"null"}],"uniqueKey":"incomplete_details","typeLabel":"object | null"},"error":{"oneOf":[{"type":"object","description":"Error information when `status` is `failed`.","properties":{"code":{"type":"string","uniqueKey":"error.oneOf.0.code","typeLabel":"string"},"message":{"type":"string","uniqueKey":"error.oneOf.0.message","typeLabel":"string"}},"uniqueKey":"error.oneOf.0","typeLabel":"object"},{"type":"null","description":"Error information when `status` is `failed`.","properties":{"code":{"type":"string"},"message":{"type":"string"}},"uniqueKey":"error.oneOf.1","typeLabel":"null"}],"uniqueKey":"error","typeLabel":"object | null"},"instructions":{"oneOf":[{"type":"string","uniqueKey":"instructions.oneOf.0","typeLabel":"string"},{"type":"null","uniqueKey":"instructions.oneOf.1","typeLabel":"null"}],"uniqueKey":"instructions","typeLabel":"string | null"},"reasoning":{"oneOf":[{"type":"object","uniqueKey":"reasoning.oneOf.0","typeLabel":"object"},{"type":"null","uniqueKey":"reasoning.oneOf.1","typeLabel":"null"}],"uniqueKey":"reasoning","typeLabel":"object | null"},"text":{"oneOf":[{"type":"object","uniqueKey":"text.oneOf.0","typeLabel":"object"},{"type":"null","uniqueKey":"text.oneOf.1","typeLabel":"null"}],"uniqueKey":"text","typeLabel":"object | null"},"tools":{"oneOf":[{"type":"array","items":{"oneOf":[{"type":"object","title":"Function tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name"],"properties":{"type":{"type":"string","enum":["function"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","description":"Function name. Must follow the regex: ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","pattern":"^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.0.name","typeLabel":"string"},"description":{"type":"string","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.0.description","typeLabel":"string"},"parameters":{"type":"object","description":"JSON Schema describing the function arguments.","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.0.parameters","typeLabel":"object"},"strict":{"type":"boolean","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.0.strict","typeLabel":"boolean"}},"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.0","typeLabel":"Function tool · object"},{"type":"object","title":"Custom tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name","format"],"properties":{"type":{"type":"string","enum":["custom"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","enum":["apply_patch"],"description":"Tool name. Only `apply_patch` is supported.","isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.1.name","typeLabel":"enum\u003cstring>"},"format":{"type":"object","description":"Input format constraint. Only the `grammar` type with `lark` syntax is supported.","required":["type","syntax","definition"],"properties":{"type":{"type":"string","enum":["grammar"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.1.format.type","typeLabel":"enum\u003cstring>"},"syntax":{"type":"string","enum":["lark"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.1.format.syntax","typeLabel":"enum\u003cstring>"},"definition":{"type":"string","description":"The Lark grammar definition.","isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.1.format.definition","typeLabel":"string"}},"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.1.format","typeLabel":"object"},"description":{"type":"string","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.1.description","typeLabel":"string"}},"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.1","typeLabel":"Custom tool · object"},{"type":"object","title":"Namespace tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name","description","tools"],"properties":{"type":{"type":"string","enum":["namespace"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.name","typeLabel":"string"},"description":{"type":"string","isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.description","typeLabel":"string"},"tools":{"type":"array","items":{"oneOf":[{"type":"object","title":"Function tool","description":"A function tool whose arguments are described by a JSON Schema.","required":["type","name"],"properties":{"type":{"type":"string","enum":["function"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","description":"Function name. Must follow the regex: ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","pattern":"^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.name","typeLabel":"string"},"description":{"type":"string","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.description","typeLabel":"string"},"parameters":{"type":"object","description":"JSON Schema describing the function arguments.","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.parameters","typeLabel":"object"},"strict":{"type":"boolean","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0.strict","typeLabel":"boolean"}},"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.0","typeLabel":"Function tool · object"},{"type":"object","title":"Custom tool","description":"A custom tool that takes free-form text input. Only the custom tool named `apply_patch` is supported, and it must define a `grammar` + `lark` format; when the model calls it, a `custom_tool_call` item is returned in the output.","required":["type","name","format"],"properties":{"type":{"type":"string","enum":["custom"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.type","typeLabel":"enum\u003cstring>"},"name":{"type":"string","enum":["apply_patch"],"description":"Tool name. Only `apply_patch` is supported.","isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.name","typeLabel":"enum\u003cstring>"},"format":{"type":"object","description":"Input format constraint. Only the `grammar` type with `lark` syntax is supported.","required":["type","syntax","definition"],"properties":{"type":{"type":"string","enum":["grammar"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format.type","typeLabel":"enum\u003cstring>"},"syntax":{"type":"string","enum":["lark"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format.syntax","typeLabel":"enum\u003cstring>"},"definition":{"type":"string","description":"The Lark grammar definition.","isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format.definition","typeLabel":"string"}},"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.format","typeLabel":"object"},"description":{"type":"string","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1.description","typeLabel":"string"}},"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX].oneOf.1","typeLabel":"Custom tool · object"}],"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools.items.[INDEX]","typeLabel":"Function tool · object | Custom tool · object"},"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2.tools","typeLabel":"(Function tool · object | Custom tool · object)[]"}},"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.2","typeLabel":"Namespace tool · object"},{"type":"object","title":"Web search tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type"],"properties":{"type":{"type":"string","enum":["web_search"],"isRequired":true,"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3.type","typeLabel":"enum\u003cstring>"},"filters":{"type":"object","description":"Search scope filters.","properties":{"allowed_domains":{"type":"array","items":{"type":"string","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3.filters.allowed_domains.items.[INDEX]","typeLabel":"string"},"maxItems":100,"description":"Restrict the search to these domains, up to 100.","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3.filters.allowed_domains","typeLabel":"string[]"}},"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3.filters","typeLabel":"object"},"search_content_types":{"type":"array","items":{"type":"string","enum":["text","image"],"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3.search_content_types.items.[INDEX]","typeLabel":"enum\u003cstring>"},"default":["text"],"description":"Result types to search for. Defaults to `text` only. Including `image` additionally runs an image search.","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3.search_content_types","typeLabel":"enum\u003cstring>[]"},"image_settings":{"type":"object","description":"Image search settings. Only effective when `search_content_types` includes `image`.","properties":{"max_results":{"type":"integer","minimum":1,"maximum":10,"default":3,"description":"Maximum number of images to return.","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3.image_settings.max_results","typeLabel":"integer"},"caption":{"type":"boolean","default":false,"description":"Whether to generate a caption for each image.","uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3.image_settings.caption","typeLabel":"boolean"}},"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3.image_settings","typeLabel":"object"}},"uniqueKey":"tools.oneOf.0.items.[INDEX].oneOf.3","typeLabel":"Web search tool · object"}],"uniqueKey":"tools.oneOf.0.items.[INDEX]","typeLabel":"Function tool · object | Custom tool · object | Namespace tool · object | Web search tool · object"},"uniqueKey":"tools.oneOf.0","typeLabel":"(Function tool · object | Custom tool · object | Namespace tool · object | Web search tool · object)[]"},{"type":"null","items":{"oneOf":[{"type":"object","title":"Function tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name"],"properties":{"type":{"type":"string","enum":["function"]},"name":{"type":"string","description":"Function name. Must follow the regex: ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","pattern":"^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$"},"description":{"type":"string"},"parameters":{"type":"object","description":"JSON Schema describing the function arguments."},"strict":{"type":"boolean"}}},{"type":"object","title":"Custom tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name","format"],"properties":{"type":{"type":"string","enum":["custom"]},"name":{"type":"string","enum":["apply_patch"],"description":"Tool name. Only `apply_patch` is supported."},"description":{"type":"string"},"format":{"type":"object","description":"Input format constraint. Only the `grammar` type with `lark` syntax is supported.","required":["type","syntax","definition"],"properties":{"type":{"type":"string","enum":["grammar"]},"syntax":{"type":"string","enum":["lark"]},"definition":{"type":"string","description":"The Lark grammar definition."}}}}},{"type":"object","title":"Namespace tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type","name","description","tools"],"properties":{"type":{"type":"string","enum":["namespace"]},"name":{"type":"string"},"description":{"type":"string"},"tools":{"type":"array","items":{"oneOf":[{"type":"object","title":"Function tool","description":"A function tool whose arguments are described by a JSON Schema.","required":["type","name"],"properties":{"type":{"type":"string","enum":["function"]},"name":{"type":"string","description":"Function name. Must follow the regex: ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$","pattern":"^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$"},"description":{"type":"string"},"parameters":{"type":"object","description":"JSON Schema describing the function arguments."},"strict":{"type":"boolean"}}},{"type":"object","title":"Custom tool","description":"A custom tool that takes free-form text input. Only the custom tool named `apply_patch` is supported, and it must define a `grammar` + `lark` format; when the model calls it, a `custom_tool_call` item is returned in the output.","required":["type","name","format"],"properties":{"type":{"type":"string","enum":["custom"]},"name":{"type":"string","enum":["apply_patch"],"description":"Tool name. Only `apply_patch` is supported."},"description":{"type":"string"},"format":{"type":"object","description":"Input format constraint. Only the `grammar` type with `lark` syntax is supported.","required":["type","syntax","definition"],"properties":{"type":{"type":"string","enum":["grammar"]},"syntax":{"type":"string","enum":["lark"]},"definition":{"type":"string","description":"The Lark grammar definition."}}}}}]}}}},{"type":"object","title":"Web search tool","description":"A tool definition, discriminated by `type`. Supported types are `function`, `custom` (only `apply_patch`), `namespace`, and `web_search`; other tool types are not supported.","required":["type"],"properties":{"type":{"type":"string","enum":["web_search"]},"filters":{"type":"object","description":"Search scope filters.","properties":{"allowed_domains":{"type":"array","items":{"type":"string"},"maxItems":100,"description":"Restrict the search to these domains, up to 100."}}},"search_content_types":{"type":"array","items":{"type":"string","enum":["text","image"]},"default":["text"],"description":"Result types to search for. Defaults to `text` only. Including `image` additionally runs an image search."},"image_settings":{"type":"object","description":"Image search settings. Only effective when `search_content_types` includes `image`.","properties":{"max_results":{"type":"integer","minimum":1,"maximum":10,"default":3,"description":"Maximum number of images to return."},"caption":{"type":"boolean","default":false,"description":"Whether to generate a caption for each image."}}}}}]},"uniqueKey":"tools.oneOf.1","typeLabel":"null"}],"uniqueKey":"tools","typeLabel":"(Function tool · object | Custom tool · object | Namespace tool · object | Web search tool · object)[] | null"},"tool_choice":{"oneOf":[{"type":"string","description":"Controls tool-calling behavior. With `auto`, the model decides whether to call a tool.","enum":["auto"],"uniqueKey":"tool_choice.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"null","uniqueKey":"tool_choice.oneOf.1","typeLabel":"null"}],"uniqueKey":"tool_choice","typeLabel":"enum\u003cstring> | null"},"max_output_tokens":{"oneOf":[{"type":"integer","uniqueKey":"max_output_tokens.oneOf.0","typeLabel":"integer"},{"type":"null","uniqueKey":"max_output_tokens.oneOf.1","typeLabel":"null"}],"uniqueKey":"max_output_tokens","typeLabel":"integer | null"},"temperature":{"oneOf":[{"type":"number","uniqueKey":"temperature.oneOf.0","typeLabel":"number"},{"type":"null","uniqueKey":"temperature.oneOf.1","typeLabel":"null"}],"uniqueKey":"temperature","typeLabel":"number | null"},"top_p":{"oneOf":[{"type":"number","uniqueKey":"top_p.oneOf.0","typeLabel":"number"},{"type":"null","uniqueKey":"top_p.oneOf.1","typeLabel":"null"}],"uniqueKey":"top_p","typeLabel":"number | null"},"metadata":{"oneOf":[{"type":"object","uniqueKey":"metadata.oneOf.0","typeLabel":"object"},{"type":"null","uniqueKey":"metadata.oneOf.1","typeLabel":"null"}],"uniqueKey":"metadata","typeLabel":"object | null"},"parallel_tool_calls":{"type":"boolean","uniqueKey":"parallel_tool_calls","typeLabel":"boolean"},"service_tier":{"oneOf":[{"type":"string","uniqueKey":"service_tier.oneOf.0","typeLabel":"string"},{"type":"null","uniqueKey":"service_tier.oneOf.1","typeLabel":"null"}],"uniqueKey":"service_tier","typeLabel":"string | null"},"store":{"type":"boolean","description":"Always `false`.","uniqueKey":"store","typeLabel":"boolean"},"background":{"oneOf":[{"type":"boolean","description":"Always `false`.","uniqueKey":"background.oneOf.0","typeLabel":"boolean"},{"type":"null","description":"Always `false`.","uniqueKey":"background.oneOf.1","typeLabel":"null"}],"uniqueKey":"background","typeLabel":"boolean | null"},"previous_response_id":{"oneOf":[{"type":"string","description":"Always `null`.","uniqueKey":"previous_response_id.oneOf.0","typeLabel":"string"},{"type":"null","description":"Always `null`.","uniqueKey":"previous_response_id.oneOf.1","typeLabel":"null"}],"uniqueKey":"previous_response_id","typeLabel":"string | null"},"conversation":{"oneOf":[{"type":"object","description":"Always `null`.","uniqueKey":"conversation.oneOf.0","typeLabel":"object"},{"type":"null","description":"Always `null`.","uniqueKey":"conversation.oneOf.1","typeLabel":"null"}],"uniqueKey":"conversation","typeLabel":"object | null"},"prompt_cache_options":{"type":"object","description":"The context cache write options actually applied by the server. When the request omits prompt_cache_options, refer to the mode and ttl returned here","properties":{"mode":{"type":"string","enum":["implicit"],"description":"The write mode actually applied","uniqueKey":"prompt_cache_options.mode","typeLabel":"enum\u003cstring>"},"ttl":{"type":"string","enum":["5m","1h"],"description":"The cache lifetime actually applied","uniqueKey":"prompt_cache_options.ttl","typeLabel":"enum\u003cstring>"}},"uniqueKey":"prompt_cache_options","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"resp_68f0c1c2d3e4f5a6b7c8d9e0","object":"response","created_at":123,"completed_at":123,"status":"in_progress","model":"\u003cstring>","output":[{"type":"reasoning","id":"rs_68f0c1c2d3e4f5a6b7c8d9e0","summary":[{"type":"summary_text","text":"\u003cstring>"}],"encrypted_content":"\u003cstring>","status":"in_progress"}],"usage":{"input_tokens":123,"input_tokens_details":{"cached_tokens":123,"cache_write_tokens":123},"output_tokens":123,"output_tokens_details":{"reasoning_tokens":123},"total_tokens":123},"incomplete_details":{"reason":"max_output_tokens"},"error":{"code":"\u003cstring>","message":"\u003cstring>"},"instructions":"\u003cstring>","reasoning":{},"text":{},"tools":[{"type":"function","name":"\u003cstring>","description":"\u003cstring>","parameters":{},"strict":true}],"tool_choice":"auto","max_output_tokens":123,"temperature":123,"top_p":123,"metadata":{},"parallel_tool_calls":true,"service_tier":"\u003cstring>","store":true,"background":true,"previous_response_id":"\u003cstring>","conversation":{},"prompt_cache_options":{"mode":"implicit","ttl":"5m"}}}},"exampleType":"generated"},"text/event-stream":{"schema":{"type":"object","description":"A single SSE event returned when `stream: true`. Each frame is `event: \u003ctype>` followed by `data: \u003cjson>`, and the remaining fields of the event body vary by `type`.","required":["type","sequence_number"],"properties":{"type":{"type":"string","enum":["response.created","response.in_progress","response.output_item.added","response.output_item.done","response.content_part.added","response.content_part.done","response.output_text.delta","response.output_text.done","response.reasoning_summary_part.added","response.reasoning_summary_part.done","response.reasoning_summary_text.delta","response.reasoning_summary_text.done","response.function_call_arguments.delta","response.function_call_arguments.done","response.custom_tool_call_input.delta","response.custom_tool_call_input.done","response.web_search_call.in_progress","response.web_search_call.searching","response.web_search_call.completed","response.completed","response.incomplete","response.failed","error"],"isRequired":true,"uniqueKey":"type","typeLabel":"enum\u003cstring>"},"sequence_number":{"type":"integer","description":"Event sequence number, increasing monotonically from 0.","isRequired":true,"uniqueKey":"sequence_number","typeLabel":"integer"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"type":"response.created","sequence_number":123}}},"exampleType":"generated"}},"exampleType":"generated"},"da9a2406-e397-47fe-8d82-0ecddf8ff83c":{"description":"Bad request - invalid parameters","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing what went wrong","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"type":{"type":"string","description":"Error type","uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","description":"Error code","uniqueKey":"error.code","typeLabel":"string"}},"required":["message"],"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"message":"\u003cstring>","type":"\u003cstring>","code":"\u003cstring>"}}}},"exampleType":"generated"}},"exampleType":"generated"},"a1b7227e-3bc2-48ba-ad2f-135d8bf1b49f":{"description":"Unauthorized - the API key is invalid or missing","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing what went wrong","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"type":{"type":"string","description":"Error type","uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","description":"Error code","uniqueKey":"error.code","typeLabel":"string"}},"required":["message"],"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"message":"\u003cstring>","type":"\u003cstring>","code":"\u003cstring>"}}}},"exampleType":"generated"}},"exampleType":"generated"},"14f6fcff-dc91-4bfc-ad58-ee0eb7b2b64d":{"description":"Access to the resource is forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing what went wrong","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"type":{"type":"string","description":"Error type","uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","description":"Error code","uniqueKey":"error.code","typeLabel":"string"}},"required":["message"],"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"message":"\u003cstring>","type":"\u003cstring>","code":"\u003cstring>"}}}},"exampleType":"generated"}},"exampleType":"generated"},"522abb1d-3691-4922-9af3-194365231e9a":{"description":"Rate limited or out of quota","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing what went wrong","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"type":{"type":"string","description":"Error type","uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","description":"Error code","uniqueKey":"error.code","typeLabel":"string"}},"required":["message"],"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"message":"\u003cstring>","type":"\u003cstring>","code":"\u003cstring>"}}}},"exampleType":"generated"}},"exampleType":"generated"},"abcd1e5c-bdfb-4e69-814d-b90300af297c":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message describing what went wrong","isRequired":true,"uniqueKey":"error.message","typeLabel":"string"},"type":{"type":"string","description":"Error type","uniqueKey":"error.type","typeLabel":"string"},"code":{"type":"string","description":"Error code","uniqueKey":"error.code","typeLabel":"string"}},"required":["message"],"isRequired":true,"uniqueKey":"error","typeLabel":"object"}},"required":["error"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"error":{"message":"\u003cstring>","type":"\u003cstring>","code":"\u003cstring>"}}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"934a5256-f90e-467f-85ef-79438ff0aed4":{"bearerAuth":{"type":"http","scheme":"bearer","description":"The Authorization header expects a Bearer token. Use an MOONSHOT_API_KEY as the token. This is a server-side secret key. Generate one on the [API keys page](https://platform.kimi.ai/console/api-keys) in your dashboard.","scopes":[],"schemeName":"bearerAuth"}}},"servers":{"0ba739b9-d5bb-4489-8d45-dee9bb1dbc06":{"url":"https://api.moonshot.ai","description":"Production"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","description":"The Authorization header expects a Bearer token. Use an MOONSHOT_API_KEY as the token. This is a server-side secret key. Generate one on the [API keys page](https://platform.kimi.ai/console/api-keys) in your dashboard.","scopes":[],"schemeName":"bearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"The Authorization header expects a Bearer token. Use an MOONSHOT_API_KEY as the token. This is a server-side secret key. Generate one on the [API keys page](https://platform.kimi.ai/console/api-keys) in your dashboard.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"bearerAuth","name":"Authorization"}],"title":"bearerAuth"}]},"originalFileLocation":"openapi.json"},"subdomain":"moonshotai","siteName":"Kimi API Platform","title":"Responses API - Kimi API Platform","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-12T05:48:22.775Z","originalFileLocation":"api/responses.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=\"Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.\">\u003cmeta data-mint-head name=\"keywords\" content=\"Kimi K3.1 Pro,kimi-k3.1-pro,Kimi K3,Moonshot AI,K3 Large Language Model,AI API,Tool Calling,Code Generation,Intelligent Dialogue,AI Agent,Open-source Model,Long Context,Claw Bot\">\u003cmeta data-mint-head name=\"application-name\" content=\"Kimi API Platform\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003cmeta data-mint-head name=\"robots\" content=\"index,follow\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Responses API - Kimi API Platform\">\u003cmeta data-mint-head property=\"og:description\" content=\"Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Kimi API Platform\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://platform.kimi.ai/docs/api/responses\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://platform.kimi.ai/og.png?v=1\">\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=\"Responses API - Kimi API Platform\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://platform.kimi.ai/og.png?v=1\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/moonshotai/6rzjGwhLi_bSodW_/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Kimi API Platform\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#111111\">\u003cmeta data-mint-head name=\"og:locale\" content=\"en-US\">\u003cmeta data-mint-head name=\"og:image:alt\" content=\"Kimi API Platform\">\u003clink data-mint-head rel=\"canonical\" href=\"https://platform.kimi.ai/docs/api/responses\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/api/responses.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://platform.kimi.ai/#organization\",\"name\":\"Kimi API Platform\",\"url\":\"https://platform.kimi.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/moonshotai/X_5b_eA1iuJP595e/assets/logo/light.svg?fit=max\u0026auto=format\u0026n=X_5b_eA1iuJP595e\u0026q=85\u0026s=f68cf2d80f8d7f0363e088d2b988a598\"}},{\"@type\":\"WebSite\",\"@id\":\"https://platform.kimi.ai/docs#website\",\"name\":\"Kimi API Platform\",\"url\":\"https://platform.kimi.ai/docs\",\"publisher\":{\"@id\":\"https://platform.kimi.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://platform.kimi.ai/docs/api/responses#webpage\",\"url\":\"https://platform.kimi.ai/docs/api/responses\",\"name\":\"Responses API\",\"description\":\"Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.\",\"dateModified\":\"2026-11-12T05:48:22.775Z\",\"isPartOf\":{\"@id\":\"https://platform.kimi.ai/docs#website\"},\"breadcrumb\":{\"@id\":\"https://platform.kimi.ai/docs/api/responses#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://platform.kimi.ai/docs/api/responses#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Reference\",\"item\":\"https://platform.kimi.ai/docs/api/chat\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Responses API\",\"item\":\"https://platform.kimi.ai/docs/api/responses\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://platform.kimi.ai/docs/api/responses#apireference\",\"headline\":\"Responses API\",\"name\":\"Responses API\",\"description\":\"Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define, or use server-side web search.\",\"url\":\"https://platform.kimi.ai/docs/api/responses\",\"mainEntityOfPage\":{\"@id\":\"https://platform.kimi.ai/docs/api/responses#webpage\"},\"image\":\"https://platform.kimi.ai/og.png?v=1\",\"dateModified\":\"2026-11-12T05:48:22.775Z\",\"publisher\":{\"@id\":\"https://platform.kimi.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://platform.kimi.ai/docs#website\"}}]}\u003c/script>","agentPointerHref":"/docs/api/responses.md","siteName":"Kimi API Platform","nav":{"global":null,"tabs":[{"tab":"Guides","pages":[{"title":"Guides","href":"/get-your-api-key"}]},{"tab":"API Reference","groups":[{"group":"Using the API","pages":[{"title":"API Overview","sidebarTitle":"API Overview","href":"/api/overview"},{"title":"Model Parameter Reference","sidebarTitle":"Model Parameter Reference","href":"/api/models-overview"},{"title":"Common Error Codes","sidebarTitle":"Error Codes","href":"/api/errors"}]},{"group":"API Reference","pages":[{"title":"Chat Completions API","sidebarTitle":"Chat Completions API","description":"Create a chat completion: send messages to Kimi models and get replies, with streaming, tool calling, and vision input.","openapi":"POST /v1/chat/completions","href":"/api/chat"},{"title":"Responses API","sidebarTitle":"Responses API","openapi":"POST /v1/responses","href":"/api/responses"},{"title":"Messages API","sidebarTitle":"Messages API","description":"Call Kimi models with an Anthropic Messages API compatible format, supporting streaming, tool use, image input, thinking, and structured output.","openapi":"POST /anthropic/v1/messages","href":"/api/messages"},{"title":"List Models","sidebarTitle":"List Models","openapi":"GET /v1/models","href":"/api/list-models"},{"title":"Estimate Tokens","sidebarTitle":"Estimate Tokens","openapi":"POST /v1/tokenizers/estimate-token-count","href":"/api/estimate"},{"title":"Check Balance","sidebarTitle":"Check Balance","openapi":"GET /v1/users/me/balance","href":"/api/balance"},{"title":"Verify Request Signature","sidebarTitle":"Verify Request Signature","openapi":"POST /v1/signatures/verify","href":"/api/signatures-verify"}]},{"group":"Tools","pages":[{"title":"Web Search Basic","sidebarTitle":"Web Search Basic","openapi":"POST /v1/tools/search","href":"/api/tools-search"},{"title":"Web Search Pro","sidebarTitle":"Web Search Pro","openapi":"POST /v1/tools/search_pro","href":"/api/tools-search-pro"},{"title":"URL Fetch","sidebarTitle":"URL Fetch","openapi":"POST /v1/tools/fetch","href":"/api/tools-fetch"}]},{"group":"Files","pages":[{"title":"Upload File","sidebarTitle":"Upload File","openapi":"POST /v1/files","href":"/api/files-upload"},{"title":"List Files","sidebarTitle":"List Files","openapi":"GET /v1/files","href":"/api/files-list"},{"title":"Get File Information","sidebarTitle":"Get File Information","openapi":"GET /v1/files/{file_id}","href":"/api/files-retrieve"},{"title":"Delete File","sidebarTitle":"Delete File","openapi":"DELETE /v1/files/{file_id}","href":"/api/files-delete"},{"title":"Get File Content","sidebarTitle":"Get File Content","openapi":"GET /v1/files/{file_id}/content","href":"/api/files-content"}]},{"group":"Batch API","pages":[{"title":"Create Batch","sidebarTitle":"Create Batch","openapi":"POST /v1/batches","href":"/api/batch-create"},{"title":"List Batches","sidebarTitle":"List Batches","openapi":"GET /v1/batches","href":"/api/batch-list"},{"title":"Retrieve Batch","sidebarTitle":"Retrieve Batch","openapi":"GET /v1/batches/{batch_id}","href":"/api/batch-retrieve"},{"title":"Cancel Batch","sidebarTitle":"Cancel Batch","openapi":"POST /v1/batches/{batch_id}/cancel","href":"/api/batch-cancel"}]},{"group":"Admin API","tag":"Beta","pages":[{"title":"Admin API overview","sidebarTitle":"Overview","href":"/admin-api/overview"},{"group":"Billing","pages":[{"title":"List daily bills","openapi":"GET /v1/admin/organizations/billings/daily_bills","href":"/admin-api/billing-daily-bills"},{"title":"List product bills","openapi":"GET /v1/admin/organizations/billings/product_bills","href":"/admin-api/billing-product-bills"},{"title":"List request details","openapi":"GET /v1/admin/organizations/billings/request_details","href":"/admin-api/billing-request-details"},{"title":"List interrupted requests","openapi":"GET /v1/admin/organizations/billings/interrupted_requests","href":"/admin-api/billing-interrupted-requests"},{"title":"Get account balance","openapi":"GET /v1/admin/organizations/account","href":"/admin-api/billing-account"}]},{"group":"Audit Logs","pages":[{"title":"List audit log events","openapi":"GET /v1/admin/organizations/audit_logs","href":"/admin-api/audit-logs"}]},{"group":"Usage","pages":[{"title":"Get usage aggregation","openapi":"GET /v1/admin/organizations/usage/{usage_type}","href":"/admin-api/usage"}]},{"group":"Organization","pages":[{"title":"Get organization info","openapi":"GET /v1/admin/organizations","href":"/admin-api/organization"},{"group":"Members \u0026 Invitations","pages":[{"title":"List members","openapi":"GET /v1/admin/organizations/members","href":"/admin-api/members"},{"title":"Get member","openapi":"GET /v1/admin/organizations/members/{uid}","href":"/admin-api/member"},{"title":"Update member role","openapi":"PATCH /v1/admin/organizations/members/{uid}","href":"/admin-api/member-update-role"},{"title":"Remove member","openapi":"DELETE /v1/admin/organizations/members/{uid}","href":"/admin-api/member-remove"},{"title":"List invitations","openapi":"GET /v1/admin/organizations/invites","href":"/admin-api/invites"},{"title":"Get invitation","openapi":"GET /v1/admin/organizations/invites/{code}","href":"/admin-api/invite"},{"title":"Create invitation","openapi":"POST /v1/admin/organizations/invites","href":"/admin-api/invite-create"}]},{"group":"Projects","pages":[{"title":"List projects","openapi":"GET /v1/admin/organizations/projects","href":"/admin-api/projects"},{"title":"Get project","openapi":"GET /v1/admin/organizations/projects/{pid}","href":"/admin-api/project"},{"title":"Create project","openapi":"POST /v1/admin/organizations/projects","href":"/admin-api/project-create"},{"title":"Update project","openapi":"PATCH /v1/admin/organizations/projects/{pid}","href":"/admin-api/project-update"},{"title":"Archive project","openapi":"POST /v1/admin/organizations/projects/{pid}/archive","href":"/admin-api/project-archive"}]},{"group":"Project Members","pages":[{"title":"List project members","openapi":"GET /v1/admin/organizations/projects/{pid}/members","href":"/admin-api/project-members"},{"title":"Add project member","openapi":"POST /v1/admin/organizations/projects/{pid}/members","href":"/admin-api/project-member-add"},{"title":"Update project member role","openapi":"PATCH /v1/admin/organizations/projects/{pid}/members/{uid}","href":"/admin-api/project-member-update-role"},{"title":"Remove project member","openapi":"DELETE /v1/admin/organizations/projects/{pid}/members/{uid}","href":"/admin-api/project-member-remove"}]},{"group":"API Keys","pages":[{"title":"List project API keys","openapi":"GET /v1/admin/organizations/projects/{pid}/api_keys","href":"/admin-api/project-api-keys"},{"title":"Get API key metadata","openapi":"GET /v1/admin/organizations/api_keys/{key}","href":"/admin-api/api-key"},{"title":"Rename API key","openapi":"PATCH /v1/admin/organizations/projects/{pid}/api_keys/{key}","href":"/admin-api/api-key-rename"},{"title":"Revoke API key","openapi":"DELETE /v1/admin/organizations/projects/{pid}/api_keys/{key}","href":"/admin-api/api-key-revoke"}]},{"group":"Configuration","pages":[{"title":"Get organization rate limits","openapi":"GET /v1/admin/organizations/rate_limits","href":"/admin-api/rate-limits"},{"title":"Get project spend limit","openapi":"GET /v1/admin/organizations/projects/{pid}/spend_limits","href":"/admin-api/project-spend-limits"},{"title":"Update project spend limit","openapi":"PATCH /v1/admin/organizations/projects/{pid}/spend_limits","href":"/admin-api/project-spend-limits-update"}]}]}]}]},{"tab":"Models \u0026 Pricing","pages":[{"title":"Models \u0026 Pricing","href":"/pricing/chat"}]},{"tab":"Resources","menu":[{"item":"Community","icon":"users","pages":[{"title":"Community","href":"/api/join-the-community"}]},{"item":"Playground","icon":"terminal","href":"https://platform.kimi.ai/playground"},{"item":"Help Center","icon":"circle-question","pages":[{"title":"Help Center","href":"/guide/account-and-payments"}]},{"item":"Learning and support","icon":"book-open","pages":[{"title":"Learning and support","href":"/guide/compact-conversation-history"}]},{"item":"Legal","icon":"file-text","pages":[{"title":"Legal","href":"/agreement/modeluse"}]},{"item":"Changelog","icon":"list","pages":[{"title":"Changelog","href":"/platform-changelog"}]}],"pages":[{"title":"Resources","href":"/api/join-the-community"}]}]},"basePath":"","title":"Responses API - Kimi API Platform","deploymentId":"dpl_BnrwKdxWnqTCMaKmLBoTuzTNCBXD","buildId":"dpl_BnrwKdxWnqTCMaKmLBoTuzTNCBXD","dynamics":["10e4515597","c2aa737661","b0f84f53ff","a9bb46feb3","2b790eda92"],"chunks":["BannerMarkdown-B5-c58ng.js","dist-C-6Hw7la.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js","OpenApiReferenceProvider-CoHzAoFO.js","snippetPresets-C5LN7NjD.js","utils-BpbIYxoM.js","style-to-object-BY3JEAdk.js","utils-BZwmDJa7.js","v4-DIgz8zy6.js","addTypeLabelsToSchema-CX_8VhVG.js","conditional-requirements-CFM0id0Q.js","cloneDeep-Dwu87dmY.js","_Uint8Array-B3i1ZElT.js","isObject-FP1Yky1u.js","Page-Cu8jJzLy.js","api-description-markdown-CIH_USrp.js","DynamicMarkdown-D8nv7Epe.js","CodeSnippet-C6XWIfQu.js","use-playground-group-access-CTV1-lLQ.js","SectionHeading-Bf3Mv7z3.js","ApiExamples-CFIWkASu.js","usePlaygroundInputsStore-DQyvDMeD.js","shallow-C76oKkt-.js","isEqual-B4Njk6_P.js","CodeSnippets-COpKhdko.js","MethodPill-BcGQxR6W.js","getPastedJson-DMp6zdSQ.js","Check2Icon-TCQe7AMx.js","axios-CsQoIw0U.js","Markdown-DJPODUCq.js","AssistantPageLink-DD0-O5es.js"]}