Each file can be up to 100 MiB; larger files return a file-too-large error. The number of files is no longer limited. Instead, total storage is limited per organization, with a default quota of 10 GiB. The file parsing service is currently free, but rate limiting may be applied during peak traffic periods.
Supported Formats
Supported formats include .pdf, .txt, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .md, .dot, .epub, .html, .json, .mobi, .log, .go, .h, .c, .cpp, .cxx, .cc, .cs, .java, .js, .css, .jsp, .php, .py, .py3, .asp, .yaml, .yml, .ini, .conf, .ts, .tsx, and more.Note: Image files no longer support content extraction (file-extract). For image understanding, upload images with purpose="image". See Use Vision Models.
File Content Extraction Example
When uploading a file, use purpose="file-extract" if you want the model to use the extracted file contents as context. The extracted content is Markdown-formatted text (bold, headings, lists, etc. are represented with Markdown syntax) and can be placed directly into messages. See Get File Content for details.
python
curl
node.js
showLineNumbers
from pathlib import Pathimport osfrom openai import OpenAIclient = OpenAI( api_key=os.environ["MOONSHOT_API_KEY"], base_url = "https://api.moonshot.ai/v1",)# xlnet.pdf is an example file; we support text formats such as pdf and doc.file_object = client.files.create(file=Path("xlnet.pdf"), purpose="file-extract")# Note: retrieve_content is deprecated in the latest version.# If you are using the latest SDK, use files.content instead.file_content = client.files.content(file_id=file_object.id).textmessages = [ { "role": "system", "content": "You are Kimi, an AI assistant provided by Moonshot AI. You are particularly skilled in Chinese and English conversations. You provide users with safe, helpful, and accurate answers. You will refuse to answer any questions involving terrorism, racism, pornography, or violence. Moonshot AI is a proper noun and should not be translated into other languages.", }, { "role": "system", "content": file_content, }, {"role": "user", "content": "Please give a brief introduction of what xlnet.pdf is about"},]completion = client.chat.completions.create( model="kimi-k3.1-pro", messages=messages, temperature=0.6,)print(completion.choices[0].message)
showLineNumbers
# xlnet.pdf is a sample filecurl https://api.moonshot.ai/v1/files \ -H "Authorization: Bearer $MOONSHOT_API_KEY" \ -F purpose="file-extract" \ -F file="@xlnet.pdf"
showLineNumbers
const OpenAI = require("openai");const fs = require("fs");const client = new OpenAI({ apiKey: process.env.MOONSHOT_API_KEY, baseURL: "https://api.moonshot.ai/v1",});async function main() { let file_object = await client.files.create({ file: fs.createReadStream("xlnet.pdf"), purpose: "file-extract" }); // retrieve_content is deprecated in the latest version. let file_content = await (await client.files.content(file_object.id)).text(); let messages = [ { "role": "system", "content": "You are Kimi, an AI assistant provided by Moonshot AI. You are more proficient in Chinese and English conversations. You provide users with safe, helpful, and accurate answers. You will refuse to answer any questions related to terrorism, racism, pornography, or violence. Moonshot AI is a proper noun and should not be translated into other languages.", }, { "role": "system", "content": file_content, }, {"role": "user", "content": "Please give a brief introduction of what xlnet.pdf is about"}, ]; const completion = await client.chat.completions.create({ model: "kimi-k3.1-pro", messages: messages, temperature: 0.6 }); console.log(completion.choices[0].message.content);}main();
Replace $MOONSHOT_API_KEY with your own API key, or set it as an environment variable before making the call.
Multi-file Chat Example
If you want to upload multiple files and have a conversation with Kimi based on these files, you can use the following pattern:
from typing import *import osimport jsonfrom pathlib import Pathfrom openai import OpenAIclient = OpenAI( base_url="https://api.moonshot.ai/v1", api_key=os.environ["MOONSHOT_API_KEY"],)def upload_files(files: List[str]) -> List[Dict[str, Any]]: """ upload_files uploads all provided files (paths) via the file upload API '/v1/files', retrieves the uploaded file content, and generates file messages. Each file becomes an independent message with role set to system. The Kimi model will correctly recognize the file content in these system messages. :param files: A list of file paths to upload. Paths can be absolute or relative, passed as strings. :return: A list of messages containing file content. Add these messages to the Context, i.e., the messages parameter when calling the `/v1/chat/completions` API. """ messages = [] for file in files: file_object = client.files.create(file=Path(file), purpose="file-extract") file_content = client.files.content(file_id=file_object.id).text messages.append({ "role": "system", "content": file_content, }) return messagesdef main(): file_messages = upload_files(files=["upload_files.py"]) messages = [ *file_messages, { "role": "system", "content": "You are Kimi, an AI assistant provided by Moonshot AI. You are more proficient in Chinese and English conversations. You provide users with safe, helpful, and accurate answers. You will refuse to answer any questions related to terrorism, racism, pornography, or violence. Moonshot AI is a proper noun and should not be translated into other languages.", }, { "role": "user", "content": "Summarize the content of these files.", }, ] print(json.dumps(messages, indent=2, ensure_ascii=False)) completion = client.chat.completions.create( model="kimi-k3.1-pro", messages=messages, ) print(completion.choices[0].message.content)if __name__ == '__main__': main()
Image or Video Understanding
When uploading image or video assets for native model understanding, use purpose="image" or purpose="video".Please refer to Using Vision Models for end-to-end examples.
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.
Specifies how the uploaded file will be processed. file-extract: extract content from text-based files (such as pdf, doc, txt); images are not supported; image: upload images for vision understanding; video: upload videos for video understanding; batch: upload JSONL files for batch processing
Purpose used when uploading the file. file-extract: extract content from text-based files (such as pdf, doc, txt); images are not supported; image: upload images for vision understanding; video: upload videos for video understanding; batch: upload JSONL files for batch processing
{"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 K3.1 Pro, the previous-generation K3, K2.7 Code, K2.6 and other large language model APIs, supporting 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://platform.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 K3.1 Pro, the previous-generation K3, K2.7 Code, K2.6 and other large language model APIs, supporting 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":"6af2b8f185248c755bd2c9d3","clientVersion":"0.0.4102","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":"Resources","count":17},{"language":"default","tag":"Learning and support","count":14},{"language":"default","tag":"Help Center","count":12},{"language":"default","tag":"Model Capabilities","count":9},{"language":"default","tag":"Models \u0026 Pricing","count":9},{"language":"default","tag":"Members \u0026 Invitations","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":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"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}#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-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/files-upload","slug":"/api/files-upload","pageMetadata":{"title":"Upload File","sidebarTitle":"Upload File","description":"Upload a file for text content extraction, image understanding, or video understanding. Supports text-based formats such as pdf, doc, and txt.","openapi":"POST /v1/files","href":"/api/files-upload"},"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: \"Upload a file for text content extraction, image understanding, or video understanding. Supports text-based formats such as pdf, doc, and txt.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{Accordion,CodeBlock,Note,Tab,Tabs}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);return _jsxs(_Fragment,{children:[_jsx(Note,{children:_jsx(_components.p,{children:`Each file can be up to 100 MiB; larger files return a file-too-large error. The number of files is no longer limited. Instead, total storage is limited per organization, with a default quota of 10 GiB. The file parsing service is currently free, but rate limiting may be applied during peak traffic periods.`})}),`\n`,_jsxs(Accordion,{title:`Supported Formats`,id:`supported-formats`,children:[_jsxs(_components.p,{children:[`Supported formats include `,_jsx(_components.code,{children:`.pdf`}),`, `,_jsx(_components.code,{children:`.txt`}),`, `,_jsx(_components.code,{children:`.csv`}),`, `,_jsx(_components.code,{children:`.doc`}),`, `,_jsx(_components.code,{children:`.docx`}),`, `,_jsx(_components.code,{children:`.xls`}),`, `,_jsx(_components.code,{children:`.xlsx`}),`, `,_jsx(_components.code,{children:`.ppt`}),`, `,_jsx(_components.code,{children:`.pptx`}),`, `,_jsx(_components.code,{children:`.md`}),`, `,_jsx(_components.code,{children:`.dot`}),`, `,_jsx(_components.code,{children:`.epub`}),`, `,_jsx(_components.code,{children:`.html`}),`, `,_jsx(_components.code,{children:`.json`}),`, `,_jsx(_components.code,{children:`.mobi`}),`, `,_jsx(_components.code,{children:`.log`}),`, `,_jsx(_components.code,{children:`.go`}),`, `,_jsx(_components.code,{children:`.h`}),`, `,_jsx(_components.code,{children:`.c`}),`, `,_jsx(_components.code,{children:`.cpp`}),`, `,_jsx(_components.code,{children:`.cxx`}),`, `,_jsx(_components.code,{children:`.cc`}),`, `,_jsx(_components.code,{children:`.cs`}),`, `,_jsx(_components.code,{children:`.java`}),`, `,_jsx(_components.code,{children:`.js`}),`, `,_jsx(_components.code,{children:`.css`}),`, `,_jsx(_components.code,{children:`.jsp`}),`, `,_jsx(_components.code,{children:`.php`}),`, `,_jsx(_components.code,{children:`.py`}),`, `,_jsx(_components.code,{children:`.py3`}),`, `,_jsx(_components.code,{children:`.asp`}),`, `,_jsx(_components.code,{children:`.yaml`}),`, `,_jsx(_components.code,{children:`.yml`}),`, `,_jsx(_components.code,{children:`.ini`}),`, `,_jsx(_components.code,{children:`.conf`}),`, `,_jsx(_components.code,{children:`.ts`}),`, `,_jsx(_components.code,{children:`.tsx`}),`, and more.`]}),_jsxs(_components.p,{children:[`Note: Image files no longer support content extraction (`,_jsx(_components.code,{children:`file-extract`}),`). For image understanding, upload images with `,_jsx(_components.code,{children:`purpose=\"image\"`}),`. See `,_jsx(_components.a,{href:`/guide/use-kimi-vision-model`,children:`Use Vision Models`}),`.`]})]}),`\n`,_jsxs(Accordion,{title:`File Content Extraction Example`,id:`file-content-extraction-example`,children:[_jsxs(_components.p,{children:[`When uploading a file, use `,_jsx(_components.code,{children:`purpose=\"file-extract\"`}),` if you want the model to use the extracted file contents as context. The extracted content is Markdown-formatted text (bold, headings, lists, etc. are represented with Markdown syntax) and can be placed directly into messages. See `,_jsx(_components.a,{href:`/api/files-content`,children:`Get File Content`}),` for details.`]}),_jsxs(Tabs,{children:[_jsx(Tab,{title:`python`,id:`python`,children:_jsx(CodeBlock,{filename:`showLineNumbers`,expandable:`true`,numberOfLines:`36`,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:`36`,children:[_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:` pathlib `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Path`})]}),`\n`,_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`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# xlnet.pdf is an example file; we support text formats such as pdf and doc.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`file_object `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.files.create(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Path(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"xlnet.pdf\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`), `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`purpose`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"file-extract\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Note: retrieve_content is deprecated in the latest version.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# If you are using the latest SDK, use files.content instead.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`file_content `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.files.content(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`file_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`file_object.id).text`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`messages `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"You are Kimi, an AI assistant provided by Moonshot AI. You are particularly skilled in Chinese and English conversations. You provide users with safe, helpful, and accurate answers. You will refuse to answer any questions involving terrorism, racism, pornography, or violence. Moonshot AI is a proper noun and should not be translated into other languages.\"`}),_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.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: file_content,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Please give a brief introduction of what xlnet.pdf is about\"`}),_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:`completion `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.chat.completions.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:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`messages,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` temperature`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0.6`}),_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:`(completion.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message)`})]}),`\n`]})})})}),_jsx(Tab,{title:`curl`,id:`curl`,children:_jsx(CodeBlock,{filename:`showLineNumbers`,numberOfLines:`6`,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:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# xlnet.pdf is a sample file`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_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/files`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Authorization: Bearer `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`$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:` -F`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` purpose=\"file-extract\"`}),_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:` -F`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` file=\"@xlnet.pdf\"`})]}),`\n`]})})})}),_jsx(Tab,{title:`node.js`,id:`node-js`,children:_jsx(CodeBlock,{filename:`showLineNumbers`,expandable:`true`,numberOfLines:`38`,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:`38`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` OpenAI`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"openai\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` fs`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"fs\"`}),_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:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` main`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file_object`}),_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:`files`}),_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:` file:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` fs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`createReadStream`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"xlnet.pdf\"`}),_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:` purpose:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"file-extract\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // retrieve_content is deprecated in the latest version.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file_content`}),_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\":`#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:`files`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`file_object`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`text`}),_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:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"You are Kimi, an AI assistant provided by Moonshot AI. You are more proficient in Chinese and English conversations. You provide users with safe, helpful, and accurate answers. You will refuse to answer any questions related to terrorism, racism, pornography, or violence. Moonshot AI is a proper noun and should not be translated into other languages.\"`}),_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.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` file_content`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Please give a brief introduction of what xlnet.pdf is about\"`}),_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:` completion`}),_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:`chat`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`completions`}),_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:` messages:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` messages`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` temperature:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0.6`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` 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:`completion`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`choices`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`content`}),_jsx(_components.span,{style:{color:`#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:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`main`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})})})]}),_jsxs(_components.p,{children:[`Replace `,_jsx(_components.code,{children:`$MOONSHOT_API_KEY`}),` with your own API key, or set it as an environment variable before making the call.`]})]}),`\n`,_jsxs(Accordion,{title:`Multi-file Chat Example`,id:`multi-file-chat-example`,children:[_jsx(_components.p,{children:`If you want to upload multiple files and have a conversation with Kimi based on these files, you can use the following pattern:`}),_jsx(CodeBlock,{filename:``,expandable:`true`,numberOfLines:`66`,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:`66`,children:[_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:` typing `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--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\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` os`})]}),`\n`,_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:` json`})]}),`\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:` pathlib `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Path`})]}),`\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:` 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`,_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`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` upload_files`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`files`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: List[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]) -> List[Dict[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, Any]]:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_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:` upload_files uploads all provided files (paths) via the file upload API '/v1/files',`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` retrieves the uploaded file content, and generates file messages. Each file becomes`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` an independent message with role set to system. The Kimi model will correctly`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` recognize the file content in these system messages.`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` :param files: A list of file paths to upload. Paths can be absolute or relative,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` passed as strings.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` :return: A list of messages containing file content. Add these messages to the Context,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" i.e., the messages parameter when calling the `/v1/chat/completions` API.\"})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"\"\"`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` messages `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},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\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:` file`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` files:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` file_object `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.files.create(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`file`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`Path(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`file`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`), `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`purpose`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"file-extract\"`}),_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:` file_content `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.files.content(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`file_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`file_object.id).text`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` messages.append({`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: file_content,`})]}),`\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\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` messages`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` main`}),_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:` file_messages `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` upload_files(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`files`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"upload_files.py\"`}),_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:` messages `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`file_messages,`})]}),`\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:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"system\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"You are Kimi, an AI assistant provided by Moonshot AI. You are more proficient in Chinese and English conversations. You provide users with safe, helpful, and accurate answers. You will refuse to answer any questions related to terrorism, racism, pornography, or violence. Moonshot AI is a proper noun and should not be translated into other languages.\"`}),_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.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"role\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"content\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Summarize the content of these files.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ]`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` print`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(json.dumps(messages, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`indent`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`ensure_ascii`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`False`}),_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:` completion `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` client.chat.completions.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:` messages`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`messages,`})]}),`\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:`(completion.choices[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`].message.content)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`if`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` __name__`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '__main__'`}),_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:` main()`})}),`\n`]})})})]}),`\n`,_jsxs(Accordion,{title:`Image or Video Understanding`,id:`image-or-video-understanding`,children:[_jsxs(_components.p,{children:[`When uploading image or video assets for native model understanding, use `,_jsx(_components.code,{children:`purpose=\"image\"`}),` or `,_jsx(_components.code,{children:`purpose=\"video\"`}),`.`]}),_jsxs(_components.p,{children:[`Please refer to `,_jsx(_components.a,{href:`/guide/use-kimi-vision-model`,children:`Using Vision Models`}),` for end-to-end examples.`]})]})]})}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":"Upload File","sidebarTitle":"Upload File","description":"Upload a file for text content extraction, image understanding, or video understanding. Supports text-based formats such as pdf, doc, and txt.","openapi":"POST /v1/files","href":"/api/files-upload"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"summary":"Upload File","description":"Upload a file for text content extraction, image understanding, or video understanding. Supports text-based formats such as pdf, doc, and txt.","tags":["Files"],"security":["a76e6f35-ba21-4947-b855-be058976a3e5"],"requestBody":"55e9acb2-ea42-4494-aefe-f10012c9e482","responses":{"200":"6c5875a8-12f7-4b59-8c2f-dbe4817ae9e4","400":"ec403ae8-55c3-4b0a-b2d8-e906c7e25462","401":"7916180d-fa1e-45cf-870c-2f6a06d3b153","500":"d5439ddf-ff24-4b0c-a027-484da87a15df"},"method":"post","type":"path","servers":["f283f8d4-efce-425c-b24a-ee8368b5c4e3"],"path":"/v1/files","baseUrlOptions":["https://api.moonshot.ai"],"title":"Upload File","codeSamples":[],"requiredOnlyExamples":true,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"The file to upload","isRequired":true,"uniqueKey":"file","typeLabel":"file"},"purpose":{"type":"string","enum":["file-extract","image","video","batch"],"description":"Specifies how the uploaded file will be processed. file-extract: extract content from text-based files (such as pdf, doc, txt); images are not supported; image: upload images for vision understanding; video: upload videos for video understanding; batch: upload JSONL files for batch processing","isRequired":true,"uniqueKey":"purpose","typeLabel":"enum\u003cstring>"}},"required":["file","purpose"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"file":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"6c5875a8-12f7-4b59-8c2f-dbe4817ae9e4":{"description":"Uploaded file metadata","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Unique file identifier","isRequired":true,"uniqueKey":"id","typeLabel":"string"},"object":{"type":"string","description":"Object type","example":"file","isRequired":true,"uniqueKey":"object","typeLabel":"string"},"bytes":{"type":"integer","description":"File size in bytes","isRequired":true,"uniqueKey":"bytes","typeLabel":"integer"},"created_at":{"type":"integer","description":"Unix timestamp when the file was created","isRequired":true,"uniqueKey":"created_at","typeLabel":"integer"},"filename":{"type":"string","description":"Original file name","isRequired":true,"uniqueKey":"filename","typeLabel":"string"},"purpose":{"type":"string","description":"Purpose used when uploading the file. file-extract: extract content from text-based files (such as pdf, doc, txt); images are not supported; image: upload images for vision understanding; video: upload videos for video understanding; batch: upload JSONL files for batch processing","enum":["file-extract","image","video","batch"],"isRequired":true,"uniqueKey":"purpose","typeLabel":"enum\u003cstring>"},"status":{"type":"string","description":"Processing status of the file","example":"ready","isRequired":true,"uniqueKey":"status","typeLabel":"string"},"status_details":{"type":"string","description":"Additional status details when processing fails or returns warnings","uniqueKey":"status_details","typeLabel":"string"}},"required":["id","object","bytes","created_at","filename","purpose","status"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"id":"\u003cstring>","object":"file","bytes":123,"created_at":123,"filename":"\u003cstring>","purpose":"file-extract","status":"ready","status_details":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"ec403ae8-55c3-4b0a-b2d8-e906c7e25462":{"description":"Bad request - Invalid upload 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"},"7916180d-fa1e-45cf-870c-2f6a06d3b153":{"description":"Unauthorized - Invalid or missing API key","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"},"d5439ddf-ff24-4b0c-a027-484da87a15df":{"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":{"a76e6f35-ba21-4947-b855-be058976a3e5":{"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":{"f283f8d4-efce-425c-b24a-ee8368b5c4e3":{"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":"Upload File - Kimi API Platform","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-23T17:23:00.825Z","originalFileLocation":"api/files-upload.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=\"Upload a file for text content extraction, image understanding, or video understanding. Supports text-based formats such as pdf, doc, and txt.\">\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=\"Upload File - Kimi API Platform\">\u003cmeta data-mint-head property=\"og:description\" content=\"Upload a file for text content extraction, image understanding, or video understanding. Supports text-based formats such as pdf, doc, and txt.\">\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/files-upload\">\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=\"Upload File - Kimi API Platform\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Upload a file for text content extraction, image understanding, or video understanding. Supports text-based formats such as pdf, doc, and txt.\">\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/files-upload\">\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/files-upload.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/files-upload#webpage\",\"url\":\"https://platform.kimi.ai/docs/api/files-upload\",\"name\":\"Upload File\",\"description\":\"Upload a file for text content extraction, image understanding, or video understanding. Supports text-based formats such as pdf, doc, and txt.\",\"dateModified\":\"2026-10-23T17:23:00.825Z\",\"isPartOf\":{\"@id\":\"https://platform.kimi.ai/docs#website\"},\"breadcrumb\":{\"@id\":\"https://platform.kimi.ai/docs/api/files-upload#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://platform.kimi.ai/docs/api/files-upload#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Kimi API Platform\",\"item\":\"https://platform.kimi.ai/docs\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Upload File\",\"item\":\"https://platform.kimi.ai/docs/api/files-upload\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://platform.kimi.ai/docs/api/files-upload#apireference\",\"headline\":\"Upload File\",\"name\":\"Upload File\",\"description\":\"Upload a file for text content extraction, image understanding, or video understanding. Supports text-based formats such as pdf, doc, and txt.\",\"url\":\"https://platform.kimi.ai/docs/api/files-upload\",\"mainEntityOfPage\":{\"@id\":\"https://platform.kimi.ai/docs/api/files-upload#webpage\"},\"image\":\"https://platform.kimi.ai/og.png?v=1\",\"dateModified\":\"2026-10-23T17:23:00.825Z\",\"publisher\":{\"@id\":\"https://platform.kimi.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://platform.kimi.ai/docs#website\"}}]}\u003c/script>","agentPointerHref":"/docs/api/files-upload.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","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","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","description":"Fetch the content of a URL via the /v1/tools/fetch endpoint and get the page title and body text in Markdown.","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","description":"List the files uploaded to the current account.","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/ask-questions-about-pdf-content"}]},{"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":"Upload File - Kimi API Platform","buildId":"dpl_2AK98Hxhwu4fUXpx9atbv41cC328","deploymentId":"dpl_2AK98Hxhwu4fUXpx9atbv41cC328","dynamics":["10e4515597","c2aa737661","b0f84f53ff","a9bb46feb3","2b790eda92"],"chunks":["BannerMarkdown-CK-IGkvh.js","dist-PCbBHBTv.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-Y_UC780V.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","OpenApiReferenceProvider-EBSrFTg1.js","utils-Y_7TcRh4.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-D1wvvkPH.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-aT0ty6oN.js","snippetPresets-DoNRuyJc.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","Page-DCFaZE46.js","ApiExamples-CXRajFpn.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-BAyOsINj.js","shallow-CIcHqV1v.js","getApiPlaygroundDisplay-C5igZwEf.js","CodeSnippet-BFWnQLNh.js","CodeSnippets-Cx2mFgZW.js","getPastedJson-BOy09PZp.js","icon-BwmYtB6R.js","MethodPill-DAIhq-iu.js","DuplicateIcon-DFM8Q3ph.js","createIcon-0UdvzB4Z.js","DynamicMarkdown-DYYZTGpa.js","SectionHeading-BFCDRUuH.js","axios-vUo_bRtp.js","Markdown-C6TcKjiR.js","AssistantPageLink-D4q_oRML.js"]}