Skip to main content

A Python API Wrapper for Z.AI (GLM).

Project description

GLM4Free

A Python-only client for Z.AI (GLM) that allows you to interact with the LLM for free, requests only.

Features

  • Python Only: No Node.js, Selenium, or heavy dependencies.
  • Stream Support: Real-time streaming of AI responses.
  • Thinking Mode: Toggle "Thinking" process (Chain of Thought).
  • Web Search: Toggle capability to search the web.
  • Image Generation: Toggle AI image generation features.
  • CLI & API: Use it as a library or a command-line tool.

Installation

pip install glm4free

🎯 Usage

📖 As a Library

from GLM4Free.client import ZChat

# Initialize
bot = ZChat()
bot.initialize()

# Chat
print("AI: ", end="")
bot.chat("Hello! Who are you?")

# Enable Web Search or Image Gen
bot.use_web_search = True
bot.use_image_gen = True
bot.chat("Generate an image of a futuristic city.")

👥 CLI

You can run the chat interface directly from your terminal:

glm4free

🔧 Commands

Inside the CLI, you can use:

  • /search: Toggle Web Search (Turned off by default)
  • /thinking: Toggle Thinking Mode (Turned on by default)
  • /image: Toggle Image Generation (Turned off by default) (Does not work, only returning a prompt)
  • /preview: Toggle Preview Mode (Useless) (Turned off by default)
  • /new: Start a new conversation
  • /history: View conversation history
  • /exit: Quit

🚨Disclaimer

This is an unofficial client for educational purposes. It is not affiliated with Z.AI. Use responsibly.

🤝 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

Enhanced using AI.

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

glm4free-0.1.3.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

glm4free-0.1.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for glm4free-0.1.3.tar.gz
Algorithm Hash digest
SHA256 666dc63cad4f22df51d090e2d99f4b3c6d8199b20dac9493ff051cc3135a5c74
MD5 a5513d6a9af6a3b304fe1e2a4e370d11
BLAKE2b-256 f248c43c4d1622591721b01edff45f83fa303a5d23e4c074cf53b8ed00fafa10

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for glm4free-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5bc1144aca0d0eeecd6aaaea167714ac42bff7c36ca366735a7de9f62fce2504
MD5 130f6aefbb7e56aa4eeed3b5d01a2d41
BLAKE2b-256 67f9cd5be7a21faa38ed6f5e3a05a7d712a86be0ca6f9f497a9dca7fad9778f4

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