A Unified Command-Line Interface for Multiple LLMs
Project description
llm-cli: A Unified Terminal Interface for Multiple LLMs
llm-cli is a high-assurance command-line tool designed for interacting with Large Language Models (LLMs). It provides a unified, stable interface for Gemini, OpenAI, Claude, xAI, and local models via Ollama, prioritizing cognitive focus, secure execution, and extensible automation.
[English] | 日本語
🚀 Quick Start
- Install:
# Recommended: Install from PyPI pip install llm-secure-cli # Alternatively, install from source git clone https://github.com/yosh95/llm-cli.git cd llm-cli pip install .
- Set API Keys:
llm-clirequires API keys to be set as environment variables.export GEMINI_API_KEY="your-api-key" # Supported: OPENAI_API_KEY, ANTHROPIC_API_KEY, XAI_API_KEY, OLLAMA_API_KEY, BRAVE_SEARCH_API_KEY
- Chat: Type
llm-clito start an interactive session.- Config-less usage: If the API key is set, the tool is ready to use immediately without a
config.toml.
- Config-less usage: If the API key is set, the tool is ready to use immediately without a
- Configure (Optional): To customize behavior or add MCP servers, run:
llm-cli --init-config # Edit ~/.llm_cli/config.toml to modify settings.
- Help: Type
/helpinside the chat to see all commands.
One-Shot Examples
# Ask a question using the default provider (Gemini)
llm-cli "What is the capital of France?"
# Use a specific provider and model
llm-cli -p anthropic -m sonnet "Explain quantum computing"
# Analyze a local file or a URL
llm-cli "Summarize this PDF" ./document.pdf
llm-cli "Analyze this website" https://example.com
✨ Core Features (Product Ready)
- Unified Provider Access: Seamlessly switch between Google (Gemini), OpenAI, Anthropic (Claude), xAI (Grok), and Local LLMs (Ollama).
- Autonomous Agent: Let the AI manage files, execute Python code (replacing risky shell commands), and search the web.
- Config-free Execution: Start using immediately by just providing an environment variable.
- MCP (Model Context Protocol) Support: Connect to remote resources or services via custom servers.
- Multimodal capabilities: Support for Images, PDFs, Audio, and Video.
- Operational Stability: A clean, flicker-free UI designed for long-term "Deep Work" sessions and SSH-based environments.
- Human-in-the-Loop: All critical actions (file edits, code execution) require explicit human approval by default.
🤖 Autonomous Agent & Tool Use
The AI agent autonomously uses tools to perform complex tasks, such as file management, web search, and Python execution.
🛡️ Security & Governance (High-Assurance Framework)
As a tool designed with CISSP/CISA/CCSP principles and EU AI Act compliance in mind, llm-cli implements a multi-layered security architecture to mitigate the risks associated with autonomous AI agents.
1. Zero Trust & Access Control (ABAC)
llm-cli implements Attribute-Based Access Control (ABAC), providing granular security based on execution context and resource attributes.
- Risk-based Scaling: Security requirements automatically scale based on the tool's risk level (HIGH/MEDIUM/LOW).
- Identity Proof: High-risk actions (e.g., Python execution) require a valid PQC-signed identity.
- Path Guardrails: Tools are restricted by path attributes (defaulting to the current directory).
- Explanation Enforcement: Every tool mandates an
explanationparameter, forcing the LLM to justify its intent.
2. Identity & Non-Repudiation (Post-Quantum Ready)
- Hybrid Identity Tokens: Uses COSE (RFC 9052) binary structures combining RS256 with Post-Quantum Cryptography (ML-DSA) to sign tool execution requests, ensuring long-term non-repudiation.
- Client Integrity Attestation: The client generates a signed manifest of its own source code state to prove the integrity of the execution environment.
- Bi-directional Verification: Tool results are signed by the client, allowing the LLM to verify that the observations it receives are authentic and untampered.
3. Observability & Anomaly Detection
- Reasoning Sentinel (SSM-based): A built-in Mamba (State Space Model) implementation monitors the LLM's reasoning tokens in real-time. It detects statistical anomalies that may indicate prompt injection or "model hallucination" leading to risky behavior.
- Tamper-Evident Audit Logs: Audit trails are protected using Chained Hashing and optionally encrypted with ML-KEM (Kyber) for confidentiality.
- Merkle Tree Anchoring: Log batches are anchored via Merkle Roots to prevent historical revisionism.
📖 Advanced Commands & Power User Tips
Inside the llm-cli interactive session:
/help: Display all available commands./p <provider>//m <model>: Switch the AI engine on the fly./attach <path/URL>: Add a file or website content to the context./tools on|off: Enable/disable autonomous tool use./i: Show session integrity and Reasoning Sentinel (anomaly) scores./save//load: Manage conversation history./cp: Checkpoint (Summarize and clear history)./mcp: Toggle or manage MCP server integrations.
💡 Power User Tips
- Backgrounding (
Ctrl+Z): Suspend the session to perform shell operations, then usefgto return. - External Editor (
Ctrl+X, Ctrl+E): Open the current prompt in your default editor (vim,nano, etc.) for complex editing. - Templates: Define reusable prompts in
~/.llm_cli/config.tomland call them with/t <name>.
🔑 Security Management
Use the llm-cli-security tool to manage your cryptographic identity:
llm-cli-security keygen # Generate RSA and PQC (ML-DSA/ML-KEM) keys
llm-cli-security manifest # Rebuild integrity manifest for remote attestation
llm-cli-security decrypt-log ~/.llm_cli/audit.jsonl -o decrypted.jsonl
📜 License
Licensed under Apache License 2.0.
For detailed architectural insights and the academic background of our security framework, please refer to the Technical Report (Pre-print).
llm-cli: 複数LLM対応 統合コマンドラインインターフェース
llm-cli は、Gemini, OpenAI, Claude, Grok、および Ollama を介したローカルLLMを一元的に操作できる、高い安全性を備えたCLIツールです。開発者の「深い集中(Deep Work)」を妨げない安定した対話環境と、プロフェッショナルな要求に応える高度なセキュリティ機能を両立しています。
🚀 クイックスタート
- インストール:
# 推奨: PyPIからインストール pip install llm-secure-cli # あるいはソースからインストール git clone https://github.com/yosh95/llm-cli.git cd llm-cli pip install .
- APIキーの設定: APIキーを環境変数として設定します。
export GEMINI_API_KEY="your-api-key" # 対応: OPENAI_API_KEY, ANTHROPIC_API_KEY, XAI_API_KEY, OLLAMA_API_KEY, BRAVE_SEARCH_API_KEY
- 対話開始:
llm-cliコマンドでスタート。- 設定ファイル不要: APIキーさえ設定されていれば、
config.tomlなしですぐに利用可能です。
- 設定ファイル不要: APIキーさえ設定されていれば、
- 詳細設定 (任意): MCPサーバーの追加や動作のカスタマイズを行いたい場合は、以下のコマンドを実行します。
llm-cli --init-config # ~/.llm_cli/config.toml を編集して設定を調整してください。
- ヘルプ: チャット内で
/helpと入力するとコマンド一覧が表示されます。
✨ 主な機能 (実用ツールとして)
- 統合インターフェース:
llm-cliコマンド一つで主要なクラウドLLMと Ollama (Local) にアクセス。 - 自律型エージェント: ファイル操作、Python実行、Web検索、URL解析をAIが自律的に実行。
- 設定不要の即時利用: 環境変数を設定するだけで、セットアップの手間なく利用可能。
- MCP (Model Context Protocol) 対応: リモートサーバーや外部サービスとの連携をサポート。
- マルチモーダル対応: 画像、PDF、音声、動画の入力をサポート。画像・動画の生成も可能。
- 集中力を削がないUI: 画面のちらつきを抑え、SSH越しでも安定して動作するクリーンなターミナル出力。
🤖 自律型エージェントのツール実行
AIがファイル操作、Web検索、Python実行などのツールを自律的に使用し、複雑なタスクを遂行します。
🛡️ セキュリティとガバナンス (プロフェッショナル向け)
本ツールは CISSP/CISA/CCSP の各ドメインにおける管理策、および EU AI Act(欧州AI法) の技術的要件を意識して設計されています。
1. 属性ベースアクセス制御 (ABAC)
llm-cli は、実行コンテキストとリソース属性に基づいた 属性ベースアクセス制御 (ABAC) を採用し、高度に粒度の細かいセキュリティを実現しています。
- リスクベース・スケーリング: ツールのリスクレベル(HIGH/MEDIUM/LOW)に応じて、要求されるセキュリティ強度が自動的に変化します。
- アイデンティティ証明: 高リスクな操作(Python実行など)には、耐量子暗号 (PQC) による署名付き証明が必要です。
- パス・ガードレール: 操作可能な範囲を属性(ディレクトリ・パスなど)で制限します。
2. アイデンティティと非否認性 (耐量子暗号)
- ハイブリッド署名: COSE (RFC 9052) を採用し、RS256 と 耐量子暗号 (ML-DSA) を組み合わせ、ツール実行リクエストの正当性をバイナリレベルで長期的に保証(非否認性)。
- 完全性検証: クライアント自身のソースコードの状態を署名付きマニフェストで証明し、実行環境の健全性を担保。
3. 観測可能性と異常検知
- 推論異常モニタ (Reasoning Sentinel): Mamba (SSM) の実装により、LLMの推論プロセスをリアルタイム監視。プロンプトインジェクション等による統計的異常を検知。
- 改ざん防止監査ログ: ハッシュ連鎖(Chained Hashing)によるログ保護と、ML-KEM (Kyber) による機密性保護。
💡 パワーユーザー向け機能
- 一時中断 (
Ctrl+Z): セッションをバックグラウンドに送り、シェルに戻る。fgで復帰可能。 - 外部エディタ編集 (
Ctrl+X, Ctrl+E): プロンプト入力をvimやnanoで編集。 - テンプレート: 頻繁に使うプロンプトを
~/.llm_cli/config.tomlに定義し、/t <名前>で呼び出し。
📜 ライセンス
Apache License 2.0 に基づき公開されています。技術的な詳細については テクニカルレポート を参照してください。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_secure_cli-1.0.3.tar.gz.
File metadata
- Download URL: llm_secure_cli-1.0.3.tar.gz
- Upload date:
- Size: 163.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc401e986a29f0719f5793a4381a81192ea516dd368848f657892aff9d664e63
|
|
| MD5 |
a5b60be29cb361318cf2cb7783b024db
|
|
| BLAKE2b-256 |
0f6cc512f79f20b4fd525bfeb45082e2419def1a046ca66f65f3b2ffa02d4d3e
|
Provenance
The following attestation bundles were made for llm_secure_cli-1.0.3.tar.gz:
Publisher:
publish.yml on yosh95/llm-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_secure_cli-1.0.3.tar.gz -
Subject digest:
cc401e986a29f0719f5793a4381a81192ea516dd368848f657892aff9d664e63 - Sigstore transparency entry: 1154162795
- Sigstore integration time:
-
Permalink:
yosh95/llm-cli@d84bc149561e24d4eae4462a47f3a2205d3b6298 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/yosh95
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d84bc149561e24d4eae4462a47f3a2205d3b6298 -
Trigger Event:
push
-
Statement type:
File details
Details for the file llm_secure_cli-1.0.3-py3-none-any.whl.
File metadata
- Download URL: llm_secure_cli-1.0.3-py3-none-any.whl
- Upload date:
- Size: 149.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91a1fa07df62e5635fb3922367c5ac10369d430dd62be306c33f9b829ee6ff9f
|
|
| MD5 |
857d5233f2bbd84ecd12eac244b93408
|
|
| BLAKE2b-256 |
2a0a4e74588f9824f393d9a08b0fd90665471c6f1ab91ee68329213ce6cf3c26
|
Provenance
The following attestation bundles were made for llm_secure_cli-1.0.3-py3-none-any.whl:
Publisher:
publish.yml on yosh95/llm-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_secure_cli-1.0.3-py3-none-any.whl -
Subject digest:
91a1fa07df62e5635fb3922367c5ac10369d430dd62be306c33f9b829ee6ff9f - Sigstore transparency entry: 1154162800
- Sigstore integration time:
-
Permalink:
yosh95/llm-cli@d84bc149561e24d4eae4462a47f3a2205d3b6298 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/yosh95
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d84bc149561e24d4eae4462a47f3a2205d3b6298 -
Trigger Event:
push
-
Statement type: