Skip to main content

🤖 Kimi API

A simple yet working Python client for interacting with the Kimi AI assistant (Bypass log-in + all chats options)

Python License PyPI

🚀 Installation

pip install kimi4free

⚡ Quick Start

from kimi4free import KimiClient

# Initialize the client
client = KimiClient()

# 💬 Get response without streaming
response = client.chat("Hello, how are you?")
print(response)

# 🌊 Stream response to console
response = client.chat("Tell me a joke", stream=True)
print(f"\nComplete response: {response}")

📖 Usage

💭 Basic Chat

from kimi4free import KimiClient

# Create client instance
client = KimiClient()

# Simple chat interaction
response = client.chat("What's 2+2?")
print(response)

🌊 Streaming Response

# Stream output to console while building full response
response = client.chat("Write a short poem", stream=True)
print(f"\n\nFull poem: {response}")

⚙️ Advanced Parameters

# 🔍 Disable search and deep research
response = client.chat(
    "Hello", 
    use_search=False, 
    use_deep_research=False
)

# 🎯 Use different model
response = client.chat("Hi there", model="k2")

📚 API Reference

🏗️ KimiClient(debug=False)

Creates a new Kimi API client instance.

  • Parameters:
    • 🐞 debug (bool): Enable debug output to see internal steps and responses.

💬 client.chat(message, stream=False, chat_id=None, **kwargs)

  • chat_id only if you want to continue a conversation.

Send a message and automatically create a new chat session if none is provided.

Parameters:

  • 📝 message (str): Your message
  • 🌊 stream (bool): Stream output to console (default: False)
  • 🤖 model (str): AI model to use (default: "k2" other: k1.5)
  • 🔍 use_search (bool): Enable web search (default: True)
  • 🔬 use_deep_research (bool): Enable deep research (default: True)
  • 🧠 use_semantic_memory (bool): Use semantic memory (default: False)

Returns: 📤 Complete response text

🆕 client.create_chat()

Create a new chat session.

Returns: 🆔 Chat ID string

📨 client.send_message(chat_id, message, **kwargs)

Send a message to an existing chat session.

Parameters:

  • 🆔 chat_id (str): Chat session ID
  • 📝 message (str): Your message
  • ⚙️ All parameters from chat() method

Returns: 📤 Complete response text

🎯 Features

  • 🌊 Real-time streaming support
  • 🔍 Web search integration
  • 🔬 Deep research capabilities
  • 📱 Lightweight and fast

🤝 Contributing

We welcome contributions! We are still missing upload functionality, feel free to pull request !

📄 License

This project is licensed under the MIT License.

💖 Support

If you find this project helpful:

  • ⭐ Star this repository
  • 🐛 Report issues
  • 💡 Suggest new features
  • 🤝 Contribute code

Made with ❤️ by the community

⭐ Star on GitHub📦 PyPI Package

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kimi4free-0.1.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kimi4free-0.1.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file kimi4free-0.1.3.tar.gz.

File metadata

  • Download URL: kimi4free-0.1.3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for kimi4free-0.1.3.tar.gz
Algorithm Hash digest
SHA256 769a9a2a6320f43ceb4495e4c1c38a29359dbb0a511e99224104c71073b24156
MD5 1ea55aa51bf324bb45bc06b4a125a504
BLAKE2b-256 96dc9893529ae99d5c3843f43f6e34528175d5176e0c45166d131e18b8d6e02b

See more details on using hashes here.

File details

Details for the file kimi4free-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: kimi4free-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for kimi4free-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7c060945784467ef371557de4a6f94a2ae693e124a8d3bc4d7d42e499bbc8d94
MD5 54a16974647a778e334ae77d16e95eff
BLAKE2b-256 9e58cd20b91b41d84619d770e9178e8adf29beb77b6fde2db7877e93f64c774a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

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