Skip to main content
Kimi does not accept inline file attachments. Instead each file is uploaded to Kimi’s Files endpoint with purpose=“file-extract”, its text is extracted server-side, and that text is injected into the message - all handled automatically by the MoonShot model.
file_input.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your Moonshot API key

4

Run the example

Save the code above as file_input.py, then run:
Full source: cookbook/90_models/moonshot/file_input.py