llm-api-adapter-kimi
An optional Kimi / Moonshot organization package for LLM API Adapter, a Python SDK with one shared interface for calling LLM APIs.
Calls Kimi / Moonshot through POST /v1/chat/completions without a provider SDK.
Installation
Install through the Core package extra:
pip install "llm-api-adapter[kimi]"
Direct installation is also supported when Core is managed separately:
pip install llm-api-adapter-kimi
Async requests need HTTPX:
pip install "llm-api-adapter[kimi,async]"
Synchronous requests remains the default. To opt into HTTPX for sync
chat() and stream_chat(), install "llm-api-adapter[kimi,httpx]" and pass
transport="httpx".
Quick start
import os
from llm_api_adapter.models.messages.chat_message import UserMessage
from llm_api_adapter.universal_adapter import UniversalLLMAPIAdapter
adapter = UniversalLLMAPIAdapter(
organization="kimi",
model="kimi-k3",
api_key=os.environ["KIMI_API_KEY"],
)
response = adapter.chat(
messages=[UserMessage("Explain retrieval-augmented generation.")],
max_tokens=128,
)
print(response.content)
Supported models
kimi-k3kimi-k2.6
Capabilities
| Capability | Supported models |
|---|---|
| Text chat; sync/async streaming; application tools; portable JSON Schema/Pydantic output; image bytes and data URIs | Both models |
Public ImagePart URLs and every DocumentPart PDF URL or byte |
Unsupported; rejected before HTTP |
reasoning_level is resolved automatically from registry metadata. K3 cannot
disable reasoning, so reasoning_level="none" uses the registered minimum and
warns. K2.6 maps "none" to disabled thinking and every other valid level to
enabled thinking. When omitted, no thinking control is sent and Kimi's native
default is preserved.
Reasoning is never mixed into visible text; use
capture_reasoning=True for opt-in observability.
Both models reject named tool choice before transport. kimi-k3 accepts
tool_choice="any"; kimi-k2.6 rejects it and accepts only automatic or
disabled tool choice. Exact supported values, request rules, and exceptions
are recorded in the Kimi registry.
History and files
Kimi Chat Completions is stateless: previous_response is accepted for the
shared API but is not serialized. Send the complete messages history on
each turn, including assistant tool calls and ToolMessage results.
Image bytes are encoded as data URIs. Public image URLs and every
DocumentPart are rejected before transport. Kimi's Files API provides
extracted text rather than a Chat Completions attachment, so the adapter does
not upload, retain, download, extract, or delete caller files.
Kimi maps authentication/authorization (401/403), rate-limit (429), timeout
(408/504), documented token/quota, and server failures to the matching public
LLMAPI*Error; other client or SSE failures become LLMAPIClientError.
Automatic cache usage and pricing
usage.prompt_tokens_details.cached_tokens becomes Usage.cached_tokens;
the legacy usage.cached_tokens field is also accepted. K3 additionally
reports prompt_tokens_details.cache_write_tokens as Usage.cache_write_tokens
for its automatic cache-write component. Both are disjoint subsets of total
Usage.input_tokens. K2.6 has registered automatic cache-read pricing only.
Input cost uses ordinary, read, and applicable write rates from the USD
registry tier without double counting. If a required read or write count is
omitted, cost_input and cost_total stay None; known output cost can still
be exposed. An explicitly reported zero stays zero. The adapter does not enable
opt-in cache modes or account for selectable TTLs or storage charges. See the
shared usage and pricing guide.
See the main llm-api-adapter README for the shared API contract, error mapping, and E2E/release documentation.
Metadata
Release files for llm-api-adapter-kimi 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llm_api_adapter_kimi-0.1.1.tar.gz | 25.8 kB | Without provenance | Details for llm_api_adapter_kimi-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llm_api_adapter_kimi-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for llm_api_adapter_kimi-0.1.1-py3-none-any.whl |
Total release size: 43.8 kB
Release files / llm_api_adapter_kimi-0.1.1.tar.gz
| Download URL | llm_api_adapter_kimi-0.1.1.tar.gz |
|---|---|
| Size | 25.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a26084d474e8c461e127021eb325c26f1d431a43f39787d5acf386d822a7485c
|
|
BLAKE2b-256 checksum How to use checksums |
bb8f18971bb7e2aaaa81a496e5de643a5324a58aa9420e743c67dabe310ca5a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / llm_api_adapter_kimi-0.1.1-py3-none-any.whl
| Download URL | llm_api_adapter_kimi-0.1.1-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8333162a1b1521359984e3b8e2f4555b6702cd93591cd836be4e2e37ac7cdf3
|
|
BLAKE2b-256 checksum How to use checksums |
31c18f71ddb5dfb41fd1df6c3db6c1e1eea8e84e5fc02cd713503f241b050f53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for llm-api-adapter-kimi 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.