Skip to main content

A simple CLI tool for chatting with OpenAI-compatible APIs

Project description

yllm-chat

A simple CLI tool for chatting with OpenAI-compatible APIs.

Installation

pip install yllm-chat

Usage

Command Line

# Direct message
yllm "Explain Python decorators"

# With custom system prompt
yllm -s "You are a Python expert" "What are generators?"

# Pipe input
echo "Summarize this" | yllm

# Disable streaming
yllm --no-stream "Hello"

As a Library

from yllm import chat_with_openai

# Streaming (prints to stdout)
chat_with_openai("Hello, world!")

# Non-streaming (returns string)
response = chat_with_openai("Hello", stream=False)
print(response)

Configuration

Set these environment variables (or use a .env file):

Variable Required Description
OPENAI_API_KEY Yes Your API key
OPENAI_BASE_URL No Custom API endpoint (for OpenAI-compatible APIs)
OPENAI_MODEL No Model to use (default: gpt-4o-mini)

Development

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check .

License

MIT

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

yllm_chat-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

yllm_chat-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file yllm_chat-0.1.0.tar.gz.

File metadata

  • Download URL: yllm_chat-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for yllm_chat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 75b9ac7f7541263825ab67fcfb86e722022b786684d2510f253380974ff00a2e
MD5 c86ebe5364b435c6434496b75a20aac0
BLAKE2b-256 c5a5ea4dbb15edfd55cd5cb3191f72e6d791094689694576e5b2d80d5e2be077

See more details on using hashes here.

File details

Details for the file yllm_chat-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: yllm_chat-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for yllm_chat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1340ecc10a869d92e94c985ec2c5e5859aee46472209894fc41e95f045b784ba
MD5 cb202c86a65540dbb87aec2a4cecbb7b
BLAKE2b-256 29be76677b5b65b2f3b9d8a5aac7ab0aef764fece990c6b2cbb2f8c9af2e9e1b

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