| 22 | |
| 23 | #[derive(Subcommand)] |
| 24 | enum Commands { |
| 25 | /// Run a model locally, as cluster master, or as cluster worker. |
| 26 | /// |
| 27 | /// With model: local inference or cluster master. |
| 28 | /// Without model + --cluster-key: cluster worker (waits for master). |
| 29 | Run { |
| 30 | /// Model name or HuggingFace repo (e.g., evilsocket/Qwen3-0.6B). |
| 31 | /// Omit with --cluster-key to start as a worker node. |
| 32 | #[arg(id = "model_name")] |
| 33 | model: Option<String>, |
| 34 | /// Prompt text (omit for interactive mode) |
| 35 | #[arg(id = "prompt_text")] |
| 36 | prompt: Option<String>, |
| 37 | #[command(flatten)] |
| 38 | args: Args, |
| 39 | }, |
| 40 | /// Start an OpenAI-compatible API server. |
| 41 | Serve { |
| 42 | /// Model name or HuggingFace repo |
| 43 | #[arg(id = "model_name")] |
| 44 | model: String, |
| 45 | /// API bind address |
| 46 | #[arg(long = "api", default_value = "0.0.0.0:8080")] |
| 47 | address: String, |
| 48 | #[command(flatten)] |
| 49 | args: Args, |
| 50 | }, |
| 51 | /// Download a model from HuggingFace Hub |
| 52 | Pull { |
| 53 | /// HuggingFace repo ID (e.g., evilsocket/Qwen3-0.6B) |
| 54 | model: String, |
| 55 | }, |
| 56 | /// List locally available models |
| 57 | List, |
| 58 | /// Interactive chat with a model (local or remote). |
| 59 | /// |
| 60 | /// Local mode: `cake chat <model>` — loads model and runs TUI chat. |
| 61 | /// Remote mode: `cake chat --server http://host:8080` — connects to API. |
| 62 | Chat { |
| 63 | /// Model name or HuggingFace repo for local chat (e.g., Qwen/Qwen3-0.6B). |
| 64 | /// If omitted, connects to --server instead. |
| 65 | model: Option<String>, |
| 66 | /// Server URL for remote chat mode. |
| 67 | #[arg(long, default_value = "http://localhost:8080")] |
| 68 | server: String, |
| 69 | /// Offload expert weights to disk for MoE models larger than available RAM. |
| 70 | #[arg(long, default_value_t = false)] |
| 71 | expert_offload: bool, |
| 72 | }, |
| 73 | /// Delete a cached model. |
| 74 | Rm { |
| 75 | /// Model name (e.g., evilsocket/Qwen3-0.6B or just Qwen3-0.6B) |
| 76 | model: String, |
| 77 | }, |
| 78 | /// Split a model into per-worker bundles |
| 79 | Split { |
| 80 | /// Input model path |
| 81 | #[arg(long)] |
nothing calls this directly
no outgoing calls
no test coverage detected