Skip to main content

A way of using Kimi for free; even with login features.

Project description

๐Ÿค– 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

Project details


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.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page