From 023cc54fed0f002979f430f87958a563ed85b1a1 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 23 Feb 2026 09:18:41 -0500 Subject: [PATCH] Merge unified-llm-cli crate into unified-llm Move the ullm binary from a separate crate into unified-llm as src/bin/ullm.rs, consolidating CLI dependencies into the library crate. Co-Authored-By: Claude Opus 4.6 --- crates/unified-llm-cli/Cargo.toml | 26 ----- crates/unified-llm-cli/README.md | 95 ------------------- crates/unified-llm/Cargo.toml | 9 +- .../main.rs => unified-llm/src/bin/ullm.rs} | 0 4 files changed, 8 insertions(+), 122 deletions(-) delete mode 100644 crates/unified-llm-cli/Cargo.toml delete mode 100644 crates/unified-llm-cli/README.md rename crates/{unified-llm-cli/src/main.rs => unified-llm/src/bin/ullm.rs} (100%) diff --git a/crates/unified-llm-cli/Cargo.toml b/crates/unified-llm-cli/Cargo.toml deleted file mode 100644 index f3de5416d..000000000 --- a/crates/unified-llm-cli/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "unified-llm-cli" -description = "CLI for the unified-llm library" -edition.workspace = true -version.workspace = true -license.workspace = true - -[lints] -workspace = true - -[[bin]] -name = "ullm" -path = "src/main.rs" - -[dependencies] -unified-llm = { path = "../unified-llm" } -clap = { workspace = true } -tokio = { workspace = true } -anyhow = { workspace = true } -dotenvy = { workspace = true } -futures = { workspace = true } -serde_json = { workspace = true } - -[dev-dependencies] -assert_cmd = "2" -predicates = "3" diff --git a/crates/unified-llm-cli/README.md b/crates/unified-llm-cli/README.md deleted file mode 100644 index 2f0c98f0f..000000000 --- a/crates/unified-llm-cli/README.md +++ /dev/null @@ -1,95 +0,0 @@ -# unified-llm-cli - -A command-line interface for interacting with LLM providers through the [unified-llm](../unified-llm/) library. Supports Anthropic, OpenAI, Google Gemini, and other providers with a single tool. - -## Installation - -```sh -cargo install --path crates/unified-llm-cli -``` - -This installs the `ullm` binary. - -## Configuration - -API keys are read from environment variables. You can set them directly or place them in a `.env` file: - -```sh -export ANTHROPIC_API_KEY="sk-..." -export OPENAI_API_KEY="sk-..." -export GEMINI_API_KEY="..." -``` - -## Commands - -### `ullm prompt` - -Send a prompt to an LLM and print the response. - -```sh -ullm prompt "What is the capital of France?" -``` - -**Flags:** - -| Flag | Description | -|------|-------------| -| `-m, --model ` | Model to use (defaults to first catalog model) | -| `-s, --system ` | System prompt | -| `-o, --option ` | Generation options: `temperature`, `max_tokens`, `top_p`, or provider-specific keys | -| `-u, --usage` | Show token usage on stderr | -| `--no-stream` | Disable streaming (wait for full response) | - -**Stdin support:** Pipe text into `ullm prompt` to use it as input. If both stdin and an argument are provided, they are concatenated. - -```sh -echo "Summarize this" | ullm prompt -cat article.txt | ullm prompt "Give me the key points" -``` - -**Examples:** - -```sh -# Use a specific model -ullm prompt -m claude-opus-4-6 "Explain quicksort" - -# Set a system prompt -ullm prompt -s "You are a helpful translator" "Translate to French: hello" - -# Adjust generation parameters -ullm prompt -o temperature=0.2 -o max_tokens=500 "Write a haiku" - -# Show token usage -ullm prompt -u --no-stream "Hello" -``` - -### `ullm models` - -List available models from all providers. Running `ullm models` with no subcommand defaults to `ullm models list`. - -```sh -ullm models -``` - -#### `ullm models list` - -```sh -ullm models list -``` - -**Flags:** - -| Flag | Description | -|------|-------------| -| `-p, --provider ` | Filter models by provider (e.g., `anthropic`, `openai`, `gemini`) | -| `-q, --query ` | Search models by ID, display name, or alias (case-insensitive) | - -**Examples:** - -```sh -# List only Anthropic models -ullm models list --provider anthropic - -# Search for models matching "opus" -ullm models list --query opus -``` diff --git a/crates/unified-llm/Cargo.toml b/crates/unified-llm/Cargo.toml index 191b01ae4..ed5bc6096 100644 --- a/crates/unified-llm/Cargo.toml +++ b/crates/unified-llm/Cargo.toml @@ -9,6 +9,10 @@ readme = "README.md" keywords = ["llm", "ai", "openai", "anthropic"] categories = ["api-bindings"] +[[bin]] +name = "ullm" +path = "src/bin/ullm.rs" + [dependencies] anyhow.workspace = true thiserror.workspace = true @@ -24,11 +28,14 @@ reqwest.workspace = true base64.workspace = true bytes.workspace = true tokio-util.workspace = true +clap.workspace = true +dotenvy.workspace = true [dev-dependencies] -dotenvy.workspace = true http = "1" tokio = { workspace = true, features = ["test-util", "macros"] } +assert_cmd = "2" +predicates = "3" [lints] workspace = true diff --git a/crates/unified-llm-cli/src/main.rs b/crates/unified-llm/src/bin/ullm.rs similarity index 100% rename from crates/unified-llm-cli/src/main.rs rename to crates/unified-llm/src/bin/ullm.rs