Skip to main content

OpenAI CLI with Function Calling, MCP Support, and Extensible Tools

Project description

Janito4 - OpenAI CLI

A powerful command-line interface for interacting with OpenAI-compatible APIs. Features built-in function calling, MCP support, real-time tool progress reporting, and an extensible tool system.

Features

  • 🚀 Easy Setup - Interactive configuration with --config or quick setup with --set flags
  • 🔧 Function Calling - Built-in tools for file operations, web search, and more
  • 📊 Real-time Progress - Watch tool execution progress as it happens
  • 🔌 Any OpenAI-Compatible API - Works with OpenAI, Azure, local servers (LM Studio, Ollama), and custom endpoints
  • 💬 Multiple Modes - Single prompts, piped input, or interactive chat sessions
  • 🛠️ Extensible - Easy to add custom tools with automatic schema generation

Quick Start

# Install
pip install janito4

# Configure interactively
python -m janito4 --config

# Or set options directly
python -m janito4 --set provider=openai --set-api-key="sk-your-key" --set model=gpt-4

# Start chatting
python -m janito4 "Hello!"

Installation

From PyPI

pip install janito4

For development setup, see README_DEV.md.

Configuration

Interactive Setup

python -m janito4 --config

You'll be prompted for:

  • Provider - openai, anthropic, azure, or custom
  • API Key - Masked for security
  • Model - e.g., gpt-4, gpt-3.5-turbo
  • Context Window - Max tokens (default: 65536)

Quick Configuration with --set

Set options directly from the command line:

# Set the provider
python -m janito4 --set provider=openai

# Set your API key
python -m janito4 --set-api-key="sk-your-key-here"

# Set the model
python -m janito4 --set model=gpt-4

# Combine multiple options
python -m janito4 --set provider=openai --set model=gpt-4 --set-api-key="sk-your-key"

View Configuration

python -m janito4 --show-config

Available Options

Option Description Example
provider Provider name openai, anthropic, azure, custom
model Model name gpt-4, claude-3-opus
context-window Context window size 65536

For custom endpoints (base-url), see README_LOCAL.md.

Usage

Single Prompt

python -m janito4 "What is the capital of France?"

Pipe Input

echo "Tell me a joke" | python -m janito4

Interactive Chat

python -m janito4

Commands in chat mode:

  • exit / quit - End session
  • restart - Clear conversation history
  • Ctrl+D / Ctrl+Z - Exit

Logging

python -m janito4 --log=info "Your prompt"      # Info level
python -m janito4 --log=debug "Your prompt"     # Debug level
python -m janito4 --log=info,debug "Your prompt" # Multiple levels

Examples

OpenAI

python -m janito4 --set provider=openai --set-api-key="sk-your-key" --set model=gpt-4 "Explain quantum computing"

Local LLM (LM Studio, Ollama)

python -m janito4 --set provider=openai --set-api-key="not-needed" --set model="local-model" "What is 2+2?"

Azure OpenAI

python -m janito4 --set provider=azure --set-api-key="your-key" --set model="gpt-4" "Hello"

Built-in Tools

Janito4 includes tools for common tasks:

File Operations

# List files
python -m janito4.tools.files.list_files . --recursive --pattern "*.py"

# Read file
python -m janito4.tools.files.read_file README.md --max-lines 20

Web Search

python -m janito4 "Search the web for the latest Python news"

MCP Tools

Connect to MCP servers for additional tools:

python -m janito4 --mcp-server=myserver "Use the read_file tool"

Tool Progress Reporting

Tools report progress in real-time:

🔄 Reading files...
📊 Processing: 50/100 files
✅ Completed: 100 files (2.3MB)

Progress messages go to stderr so they don't interfere with tool output.

Error Handling

Exit Code Meaning
0 Success
1 Configuration or runtime error
130 User cancelled (Ctrl+C)

Dependencies

  • Python 3.6+
  • openai>=1.0.0
  • rich>=10.0.0
  • prompt-toolkit>=3.0.0
  • requests (for MCP support)

License

MIT License

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

janito4-0.1.3.tar.gz (75.8 kB view details)

Uploaded Source

Built Distribution

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

janito4-0.1.3-py3-none-any.whl (106.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: janito4-0.1.3.tar.gz
  • Upload date:
  • Size: 75.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for janito4-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a9d33f4fa370046f7a265d5f170d75f5e3ece7ce290b54076acefca072915cf7
MD5 35857ae39875e1c39948d1bf83402411
BLAKE2b-256 ed991af168d0aaf8ee6013d5aff7a22320baa452690f17bbb3bd79d8fa7b39d0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: janito4-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 106.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for janito4-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7599d49db0d691b846141a99596c01bd1e7f95de178aed56cfb93b2559cb0af4
MD5 09aa8c815a243b4a2232bab5f696b62b
BLAKE2b-256 5853a96c20caec3fffda0dc3c1dbb36112b24c406eb046c8c2560dcd8ab0f25d

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