Skip to main content

llm-api-adapter-kimi

Official direct Kimi / Moonshot Chat Completions API support for llm-api-adapter. The package uses only POST /v1/chat/completions; it does not install the Kimi SDK or add provider-specific public APIs.

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 and capabilities

The package deliberately exposes fixed model IDs, not moving aliases: kimi-k3 and kimi-k2.6.

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" 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.

History, files, and pricing

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.

Cost fields use registered standard USD rates. When Kimi reports usage.cached_tokens, the adapter applies cache-hit and cache-miss input rates; without that split, it retains the standard cache-miss estimate. This does not enable Kimi context caching, and the result is not an invoice.

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.

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-api-adapter-kimi 0.1.0
File Size Uploaded Provenance Actions
llm_api_adapter_kimi-0.1.0.tar.gz 24.8 kB Without provenance Details for llm_api_adapter_kimi-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-api-adapter-kimi 0.1.0
File Interpreter ABI Platform Actions
llm_api_adapter_kimi-0.1.0-py3-none-any.whl Python 3 none any Details for llm_api_adapter_kimi-0.1.0-py3-none-any.whl

Total release size: 42.9 kB

Release files / llm_api_adapter_kimi-0.1.0.tar.gz

Download URL llm_api_adapter_kimi-0.1.0.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
899c5ccb452664bb2b97d8be7086e8b8ae3f6f14c580b87ff41c79dde4f97c04
BLAKE2b-256 checksum
How to use checksums
a412004da1230f281b8efd66553edc8721d6ce9aca3a3fc48e15edccff4321af
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.0-py3-none-any.whl

Download URL llm_api_adapter_kimi-0.1.0-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cac2b0d1b5b2e5f90eb32156693dc5b3b70c8744d35be6aea161dec4facc1750
BLAKE2b-256 checksum
How to use checksums
f600d9f4e509f39a8bc9ea4f596f4a83f2e82432158d4799207940fe463a277d
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.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page