lc-cli 0.1.3

LLM Client - A fast Rust-based LLM CLI tool with provider management and chat sessions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
---
sidebar_position: 3
---

# Provider Commands

Manage LLM provider configurations and installations.

## Overview

The `providers` command (alias: `p`) allows you to install, update, and manage provider configurations from a centralized registry. Provider configurations are stored separately from API keys for security and shareability.

## Commands

### `lc providers install`

Install a provider from the registry.

**Aliases:** `lc p i`

**Usage:**
```bash
lc providers install <name> [OPTIONS]
```

**Arguments:**
- `<name>` - Name of the provider to install

**Options:**
- `-f, --force` - Force reinstall even if already installed

**Examples:**
```bash
# Install OpenAI provider
lc providers install openai

# Force reinstall Anthropic provider
lc p i anthropic --force

# Install Google Gemini
lc p i gemini
```

### `lc providers upgrade`

Update installed providers to their latest versions.

**Aliases:** `lc p up`

**Usage:**
```bash
lc providers upgrade [name]
```

**Arguments:**
- `[name]` - Optional: specific provider to update (updates all if not specified)

**Examples:**
```bash
# Update all installed providers
lc providers upgrade

# Update only OpenAI provider
lc p up openai
```

### `lc providers uninstall`

Remove an installed provider configuration.

**Aliases:** `lc p un`

**Usage:**
```bash
lc providers uninstall <name>
```

**Arguments:**
- `<name>` - Name of the provider to uninstall

**Examples:**
```bash
# Uninstall a provider
lc providers uninstall openai

# Using short alias
lc p un anthropic
```

**Note:** This removes the provider configuration but preserves any API keys in `keys.toml`.

### `lc providers available`

List all providers available in the registry.

**Aliases:** `lc p av`

**Usage:**
```bash
lc providers available [OPTIONS]
```

**Options:**
- `--official` - Show only official providers
- `-t, --tag <tag>` - Filter by tag (e.g., chat, embeddings, vision)

**Examples:**
```bash
# List all available providers
lc providers available

# Show only official providers
lc p av --official

# Filter by chat capability
lc p av --tag chat

# Filter by embeddings support
lc p av --tag embeddings
```

### `lc providers list`

List all installed providers and their authentication status.

**Aliases:** `lc p l`

**Usage:**
```bash
lc providers list
```

**Examples:**
```bash
# List installed providers
lc providers list

# Using short alias
lc p l
```

**Output:**
```
Configured Providers:
  • openai - https://api.openai.com/v1 (API Key: ✓)
  • anthropic - https://api.anthropic.com/v1 (API Key: ✗)
  • gemini - https://generativelanguage.googleapis.com/v1beta (API Key: ✓)
```

### `lc providers add`

Manually add a custom provider (without using the registry).

**Aliases:** `lc p a`

**Usage:**
```bash
lc providers add <name> <url> [OPTIONS]
```

**Arguments:**
- `<name>` - Provider name
- `<url>` - Provider endpoint URL

**Options:**
- `-m, --models-path <path>` - Custom models endpoint path (default: /models)
- `-c, --chat-path <path>` - Custom chat completions endpoint path (default: /chat/completions)

**Examples:**
```bash
# Add a basic provider
lc providers add custom https://api.custom.com

# Add with custom paths
lc p a internal https://llm.internal.com \
  --models-path /v1/models \
  --chat-path /v1/chat
```

### `lc providers update`

Update an existing provider's endpoint URL.

**Aliases:** `lc p u`

**Usage:**
```bash
lc providers update <name> <url>
```

**Examples:**
```bash
# Update provider endpoint
lc providers update custom https://new-api.custom.com
```

### `lc providers remove`

Remove a manually added provider.

**Aliases:** `lc p r`

**Usage:**
```bash
lc providers remove <name>
```

**Examples:**
```bash
# Remove a provider
lc providers remove custom
```

### `lc providers models`

List available models for a provider.

**Aliases:** `lc p m`

**Usage:**
```bash
lc providers models <name> [OPTIONS]
```

**Arguments:**
- `<name>` - Provider name

**Options:**
- `-r, --refresh` - Refresh the models cache

**Examples:**
```bash
# List OpenAI models
lc providers models openai

# Refresh and list models
lc p m anthropic --refresh
```

### `lc providers headers`

Manage custom headers for a provider.

**Aliases:** `lc p h`

**Usage:**
```bash
lc providers headers <provider> <COMMAND>
```

**Subcommands:**

#### `add` - Add a custom header
```bash
lc providers headers <provider> add <name> <value>

# Example
lc p h custom add X-Custom-Auth "secret-token"
```

#### `delete` - Remove a custom header
```bash
lc providers headers <provider> delete <name>

# Example
lc p h custom delete X-Custom-Auth
```

#### `list` - List all custom headers
```bash
lc providers headers <provider> list

# Example
lc p h custom list
```

### `lc providers vars`

Manage provider variables for path templating.

**Aliases:** `lc p v`

**Usage:**
```bash
lc providers vars <provider> <COMMAND>
```

**Subcommands:**

#### `set` - Set a provider variable
```bash
lc providers vars <provider> set <key> <value>

# Example: Set project ID for Vertex AI
lc p v vertex_ai set project "my-project-id"
lc p v vertex_ai set location "us-central1"
```

#### `get` - Get a provider variable
```bash
lc providers vars <provider> get <key>

# Example
lc p v vertex_ai get project
```

#### `list` - List all provider variables
```bash
lc providers vars <provider> list

# Example
lc p v vertex_ai list
```

### `lc providers paths`

Manage API endpoint paths for a provider.

**Aliases:** `lc p path`

**Usage:**
```bash
lc providers paths <provider> <COMMAND>
```

**Subcommands:**

#### `add` - Add or update provider paths
```bash
lc providers paths <provider> add [OPTIONS]

# Options:
# -m, --models <path>     - Models endpoint path
# -c, --chat <path>       - Chat completions path
# -i, --images <path>     - Image generations path
# -e, --embeddings <path> - Embeddings path

# Example
lc p path openai add --images /v1/images/generations
```

#### `delete` - Reset provider paths to defaults
```bash
lc providers paths <provider> delete [OPTIONS]

# Options:
# -m, --models     - Reset models path
# -c, --chat       - Reset chat path
# -i, --images     - Reset images path
# -e, --embeddings - Reset embeddings path

# Example
lc p path openai delete --images
```

#### `list` - List all provider paths
```bash
lc providers paths <provider> list

# Example
lc p path openai list
```

## Provider Registry

The provider registry contains pre-configured providers that can be easily installed. The default registry includes:

### Official Providers
- **openai** - OpenAI's GPT models
- **anthropic** - Anthropic's Claude models
- **gemini** - Google's Gemini models

### Community Providers
- **groq** - High-speed inference
- **together** - Open-source models
- **ollama** - Local LLM inference
- **mistral** - Mistral AI models
- **cohere** - Cohere's language models
- **deepseek** - DeepSeek coding models
- **perplexity** - Models with web search
- **vertex_ai** - Google Cloud Vertex AI
- **amazon_bedrock** - AWS Bedrock

## Authentication

After installing a provider, you need to add its API key:

```bash
# Install provider
lc providers install openai

# Add API key
lc keys add openai
```

See [`lc keys`](./keys.md) for more information about key management.

## Custom Registry

You can use a custom provider registry by setting the environment variable:

```bash
# Use a remote registry
export LC_PROVIDER_REGISTRY_URL="https://your-domain.com/registry"

# Use a local registry
export LC_PROVIDER_REGISTRY_URL="file:///path/to/registry"

# Install from custom registry
lc providers install custom-provider
```

## File Locations

Provider configurations are stored in:
- **macOS**: `~/Library/Application Support/lc/providers/`
- **Linux**: `~/.local/share/lc/providers/`
- **Windows**: `%LOCALAPPDATA%\lc\providers\`

## Examples

### Complete Provider Setup

```bash
# 1. Browse available providers
lc providers available

# 2. Install a provider
lc providers install anthropic

# 3. Add API key
lc keys add anthropic

# 4. Verify installation
lc providers list

# 5. Test the provider
lc -p anthropic -m claude-3-opus "Hello!"
```

### Managing Multiple Providers

```bash
# Install multiple providers
lc p i openai
lc p i anthropic
lc p i gemini

# Add keys for each
lc k a openai
lc k a anthropic
lc k a gemini

# List all providers
lc p l

# Use different providers
lc -p openai "Query for GPT"
lc -p anthropic "Query for Claude"
lc -p gemini "Query for Gemini"
```

### Custom Provider Configuration

```bash
# Add custom provider
lc providers add internal https://llm.internal.com \
  --models-path /api/models \
  --chat-path /api/chat

# Add authentication header
lc providers headers internal add X-API-Key "internal-key"

# Set provider variables
lc providers vars internal set department "engineering"

# Test the provider
lc -p internal "Test query"
```

## See Also

- [`lc keys`]./keys.md - Manage API keys
- [`lc config`]./config.md - General configuration
- [Provider Management Guide]../advanced/provider-management.md - Detailed provider management documentation