--- id: kosong version: "0.56.0" license: unclear license_treatment: unclear maintenance: active --- # kosong — The LLM abstraction layer for modern AI agent applications. License: unclear · Maintenance: active · Downloads: 503.2K/mo ## What it is and what it does Kosong is an LLM abstraction layer designed to unify how you interact with multiple large language model providers. It standardizes message structures, handles asynchronous tool orchestration, and lets you swap between providers (Kimi, Anthropic, Google Gemini, OpenAI) without rewriting your agent logic. The package is built on pydantic for schema validation, loguru for logging, and mcp for protocol support, and it exposes a simple async API for chat completion, streaming, and tool calling. You use it by instantiating a chat provider, building a message history, and calling kosong.generate() or kosong.step() to get responses. Tool calling is handled through a pluggable toolset interface where you define tools as pydantic-based classes. This design avoids vendor lock-in and lets you experiment with different LLM backends without changing application code. Use it for: - Build multi-provider AI agents that can switch between Kimi, Anthropic, Google Gemini, and OpenAI without code changes. - Implement tool-calling workflows where the LLM orchestrates function execution asynchronously across a defined toolset. - Stream LLM responses in real time while maintaining a unified message history and provider abstraction. - Prototype and test agent behavior across different LLM backends to compare cost, latency, and output quality. - Standardize message structures and chat logic across multiple projects using a single abstraction layer. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Kosong is an LLM abstraction layer that unifies message structures and asynchronous tool orchestration across multiple chat providers, letting you build AI agents without vendor lock-in. Yes, with conditions. Kosong is actively maintained and has low install friction, making it a solid choice for building multi-provider AI agents. However, the package is very new (first release 2025-10-15) and has no recorded license metadata—verify the license terms before using in proprietary work, and expect the API to evolve. If you need vendor-agnostic LLM abstraction and are comfortable with a young codebase, it's worth trying. ## Install pip install kosong uv add kosong poetry add kosong ## Installing kosong Before you install: Low install friction with a pure-Python wheel. Active maintenance as of 11 days ago. Requires Python 3.12 or higher and brings in 9 runtime dependencies including anthropic, google-genai, openai, pydantic, and loguru. License in practice: License treatment is unclear—no SPDX identifier or raw license text is recorded. Verify the actual license before using in proprietary or copyleft-sensitive projects. Quickstart: import asyncio import kosong from kosong.chat_provider.kimi import Kimi from kosong.message import Message async def main(): kimi = Kimi(base_url="...", api_key="...", model="...") history = [Message(role="user", content="Who are you?")] result = await kosong.generate(chat_provider=kimi, system_prompt="...", tools=[], history=history) print(result.message) asyncio.run(main()) Requires Python 3.12 or higher. API keys for at least one chat provider (Kimi, Anthropic, Google Gemini, or OpenAI) must be configured. Verify before relying: - Whether the package is published under an open-source or proprietary license—no license metadata is recorded. - Actual test coverage and stability guarantees given the very recent first release (2025-10-15). - Whether streaming and tool-calling features are production-ready or still experimental. ## Package facts - License: not declared (unclear) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 503.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags llm abstraction layer, multi-provider chat api, ai agent framework, async tool orchestration, vendor-agnostic llm client, llm-abstraction, multi-provider, async-agents [View on SkillFed](https://skillfed.io/packages/kosong) · [View on PyPI](https://pypi.org/project/kosong/)