@xberg-io/opencode-liter-llm 2.2.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/ai-rulez-bundle.json +25 -16
- package/.opencode/ai-rulez-content.js +3 -3
- package/.opencode/commands/liter-llm-chat.md +14 -0
- package/.opencode/commands/liter-llm-stream.md +14 -0
- package/.opencode/plugins/liter-llm.js +9 -21
- package/.opencode/skills/liter-llm/SKILL.md +18 -24
- package/.opencode/skills/liter-llm/index.md +10 -0
- package/.opencode/skills/{calling-llms → liter-llm-calling-llms}/SKILL.md +13 -7
- package/.opencode/skills/liter-llm-calling-llms/index.md +10 -0
- package/.opencode/skills/{embeddings-and-search → liter-llm-embeddings-and-search}/SKILL.md +3 -3
- package/.opencode/skills/liter-llm-embeddings-and-search/index.md +10 -0
- package/.opencode/skills/{running-the-proxy → liter-llm-running-the-proxy}/SKILL.md +3 -3
- package/.opencode/skills/liter-llm-running-the-proxy/index.md +10 -0
- package/.opencode/skills/{streaming-responses → liter-llm-streaming-responses}/SKILL.md +3 -3
- package/.opencode/skills/liter-llm-streaming-responses/index.md +10 -0
- package/.opencode/skills/{tool-calling → liter-llm-tool-calling}/SKILL.md +3 -3
- package/.opencode/skills/liter-llm-tool-calling/index.md +10 -0
- package/.opencode/skills/liter-llm-using-the-mcp-server/SKILL.md +91 -0
- package/.opencode/skills/liter-llm-using-the-mcp-server/index.md +10 -0
- package/.pi/prompts/liter-llm-chat.md +14 -0
- package/.pi/prompts/liter-llm-stream.md +14 -0
- package/.pi/skills/liter-llm/SKILL.md +208 -0
- package/.pi/skills/liter-llm/index.md +10 -0
- package/.pi/skills/liter-llm-calling-llms/SKILL.md +75 -0
- package/.pi/skills/liter-llm-calling-llms/index.md +10 -0
- package/.pi/skills/liter-llm-embeddings-and-search/SKILL.md +81 -0
- package/.pi/skills/liter-llm-embeddings-and-search/index.md +10 -0
- package/.pi/skills/liter-llm-running-the-proxy/SKILL.md +74 -0
- package/.pi/skills/liter-llm-running-the-proxy/index.md +10 -0
- package/.pi/skills/liter-llm-streaming-responses/SKILL.md +63 -0
- package/.pi/skills/liter-llm-streaming-responses/index.md +10 -0
- package/.pi/skills/liter-llm-tool-calling/SKILL.md +77 -0
- package/.pi/skills/liter-llm-tool-calling/index.md +10 -0
- package/.pi/skills/liter-llm-using-the-mcp-server/SKILL.md +91 -0
- package/.pi/skills/liter-llm-using-the-mcp-server/index.md +10 -0
- package/README.md +151 -14
- package/package.json +76 -21
- package/scripts/mcp-launch.sh +6 -5
- package/.opencode/skills/using-the-mcp-server/SKILL.md +0 -63
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"plugin": "liter-llm",
|
|
2
3
|
"mcp": {
|
|
3
4
|
"liter-llm": {
|
|
4
5
|
"type": "local",
|
|
@@ -11,33 +12,41 @@
|
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
14
|
"skills": {
|
|
14
|
-
"calling-llms": {
|
|
15
|
-
"name": "calling-llms",
|
|
16
|
-
"description": "Use when sending chat completions through liter-llm and routing to a specific provider via the `provider/model` prefix. Covers the chat call shape, provider routing, model_hint, message roles, and error categories."
|
|
17
|
-
},
|
|
18
|
-
"embeddings-and-search": {
|
|
19
|
-
"name": "embeddings-and-search",
|
|
20
|
-
"description": "Use when generating embeddings, calling the 12 web-search providers, or running OCR over documents with the 4 OCR providers through liter-llm. Covers embed, search, and ocr methods plus reranking."
|
|
21
|
-
},
|
|
22
15
|
"liter-llm": {
|
|
23
16
|
"name": "liter-llm",
|
|
24
17
|
"description": "Universal LLM API client for 174 providers with native bindings for 14 languages. Use when writing code that calls LLM APIs via liter-llm in Python, TypeScript, Rust, Go, Java, C#, Ruby, PHP, Elixir, WASM, or C, when running the OpenAI-compatible proxy, or when calling LLMs through the MCP server. Covers chat, streaming, tool calling, embeddings, image generation, speech, transcription, moderation, web search, OCR, reranking, provider routing, middleware, and configuration."
|
|
25
18
|
},
|
|
26
|
-
"
|
|
27
|
-
"name": "
|
|
19
|
+
"liter-llm-calling-llms": {
|
|
20
|
+
"name": "liter-llm-calling-llms",
|
|
21
|
+
"description": "Use when sending chat completions through liter-llm and routing to a specific provider via the `provider/model` prefix. Covers the chat call shape, provider routing, model_hint, message roles, and error categories."
|
|
22
|
+
},
|
|
23
|
+
"liter-llm-embeddings-and-search": {
|
|
24
|
+
"name": "liter-llm-embeddings-and-search",
|
|
25
|
+
"description": "Use when generating embeddings, calling the 12 web-search providers, or running OCR over documents with the 4 OCR providers through liter-llm. Covers embed, search, and ocr methods plus reranking."
|
|
26
|
+
},
|
|
27
|
+
"liter-llm-running-the-proxy": {
|
|
28
|
+
"name": "liter-llm-running-the-proxy",
|
|
28
29
|
"description": "Use when running the `liter-llm api` OpenAI-compatible gateway — virtual keys, per-key rate limits, budgets, cost tracking, and model routing. Covers the TOML config and the 22 REST endpoints."
|
|
29
30
|
},
|
|
30
|
-
"streaming-responses": {
|
|
31
|
-
"name": "streaming-responses",
|
|
31
|
+
"liter-llm-streaming-responses": {
|
|
32
|
+
"name": "liter-llm-streaming-responses",
|
|
32
33
|
"description": "Use when streaming tokens incrementally from an LLM via liter-llm over SSE or async iterators. Covers chat_stream, delta handling, and null-content chunks."
|
|
33
34
|
},
|
|
34
|
-
"tool-calling": {
|
|
35
|
-
"name": "tool-calling",
|
|
35
|
+
"liter-llm-tool-calling": {
|
|
36
|
+
"name": "liter-llm-tool-calling",
|
|
36
37
|
"description": "Use when defining functions/tools for an LLM to call through liter-llm, or requesting structured JSON outputs. Covers tool schemas, tool_calls handling, and response formats."
|
|
37
38
|
},
|
|
38
|
-
"using-the-mcp-server": {
|
|
39
|
-
"name": "using-the-mcp-server",
|
|
39
|
+
"liter-llm-using-the-mcp-server": {
|
|
40
|
+
"name": "liter-llm-using-the-mcp-server",
|
|
40
41
|
"description": "Use when calling LLM APIs through the liter-llm MCP server's 22 tools, and to decide when MCP beats the CLI or SDK. Covers the tool surface, the auto-installing launcher, and authentication."
|
|
41
42
|
}
|
|
43
|
+
},
|
|
44
|
+
"commands": {
|
|
45
|
+
"liter-llm-chat": {
|
|
46
|
+
"description": "Call an LLM provider using liter-llm"
|
|
47
|
+
},
|
|
48
|
+
"liter-llm-stream": {
|
|
49
|
+
"description": "Stream responses with liter-llm"
|
|
50
|
+
}
|
|
42
51
|
}
|
|
43
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
2
|
-
// Content-Hash: blake3:
|
|
3
|
-
// Source-Hash: blake3:
|
|
2
|
+
// Content-Hash: blake3:011ec20caa671eb4bd4e886b09e15f720a786de4bf747419efd0690889fc5549
|
|
3
|
+
// Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
4
4
|
// Schema-Version: v1
|
|
5
5
|
|
|
6
6
|
// Generated by ai-rulez. Registers the skills, commands, agents, and MCP servers bundled with
|
|
@@ -77,7 +77,7 @@ async function load() {
|
|
|
77
77
|
try {
|
|
78
78
|
const info = bundle.skills?.[entry.name] ?? {};
|
|
79
79
|
skills.push({
|
|
80
|
-
id: entry.name,
|
|
80
|
+
id: bundle.plugin ? `${bundle.plugin}/${entry.name}` : entry.name,
|
|
81
81
|
name: info.name || entry.name,
|
|
82
82
|
description: info.description,
|
|
83
83
|
path: file,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Call an LLM provider using liter-llm
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
7
|
+
Content-Hash: blake3:dc58c1c881db41b233402714bcc5ae0ca87dde33b30ae97d010db865ea6aa26b
|
|
8
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
9
|
+
Schema-Version: v1
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
Help with this chat task: $ARGUMENTS
|
|
13
|
+
|
|
14
|
+
Read the calling-llms skill. Choose a provider/model, use the supported SDK or proxy request shape, and read API keys from environment variables. Never print keys.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Stream responses with liter-llm
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
7
|
+
Content-Hash: blake3:aade12ea079f7659ca4d5976f09836820f645def49f3ded510aed0f4159e38b6
|
|
8
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
9
|
+
Schema-Version: v1
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
Implement this streaming task: $ARGUMENTS
|
|
13
|
+
|
|
14
|
+
Read the streaming-responses skill. Use the selected language binding or proxy streaming API, handle incremental responses and errors, and avoid buffering the whole result.
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
// AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
2
|
-
// Content-Hash: blake3:
|
|
3
|
-
// Source-Hash: blake3:
|
|
2
|
+
// Content-Hash: blake3:eac402ec4f52f0113d2ea1d6d4d29f413c019f2486fd223e3825ccbdf5c1efb4
|
|
3
|
+
// Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
4
4
|
// Schema-Version: v1
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* OpenCode-specific plugin entrypoint.
|
|
8
|
-
*
|
|
9
|
-
* ai-rulez copies this source module into the generated OpenCode package.
|
|
10
|
-
* Shared skills, commands, agents, and MCP configuration belong in their normal
|
|
11
|
-
* `.ai-rulez` sources; add only OpenCode-specific tools or hooks here.
|
|
12
|
-
*
|
|
13
|
-
* To extend this plugin:
|
|
14
|
-
* 1. Import `tool` from `@opencode-ai/plugin`.
|
|
15
|
-
* 2. Define tool arguments with `tool.schema` and validate every external
|
|
16
|
-
* input.
|
|
17
|
-
* 3. Return the OpenCode hooks object from this function.
|
|
18
|
-
* 4. Preview with `ai-rulez generate --plugin --dry-run` before regenerating.
|
|
19
|
-
*
|
|
20
|
-
* Pass subprocess arguments as an array. Never interpolate external input into
|
|
21
|
-
* a shell command.
|
|
22
|
-
*/
|
|
23
|
-
const LiterLlmPlugin = () => ({});
|
|
6
|
+
import { registerBundledContent } from "../ai-rulez-content.js";
|
|
24
7
|
|
|
25
|
-
export default
|
|
8
|
+
export default {
|
|
9
|
+
id: "liter-llm",
|
|
10
|
+
async setup(ctx) {
|
|
11
|
+
await registerBundledContent(ctx);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
description: >-
|
|
4
|
-
Universal LLM API client for 174 providers with native bindings for 14
|
|
5
|
-
languages. Use when writing code that calls LLM APIs via liter-llm in Python,
|
|
6
|
-
TypeScript, Rust, Go, Java, C#, Ruby, PHP, Elixir, WASM, or C, when running
|
|
7
|
-
the OpenAI-compatible proxy, or when calling LLMs through the MCP server.
|
|
8
|
-
Covers chat, streaming, tool calling, embeddings, image generation, speech,
|
|
9
|
-
transcription, moderation, web search, OCR, reranking, provider routing,
|
|
10
|
-
middleware, and configuration.
|
|
2
|
+
description: Universal LLM API client for 174 providers with native bindings for 14 languages. Use when writing code that calls LLM APIs via liter-llm in Python, TypeScript, Rust, Go, Java, C#, Ruby, PHP, Elixir, WASM, or C, when running the OpenAI-compatible proxy, or when calling LLMs through the MCP server. Covers chat, streaming, tool calling, embeddings, image generation, speech, transcription, moderation, web search, OCR, reranking, provider routing, middleware, and configuration.
|
|
11
3
|
license: MIT
|
|
12
4
|
metadata:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
author: xberg-io
|
|
6
|
+
version: "0.1.0"
|
|
7
|
+
repository: https://github.com/xberg-io/liter-llm
|
|
8
|
+
name: liter-llm
|
|
16
9
|
---
|
|
17
10
|
|
|
18
11
|
<!--
|
|
19
12
|
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
20
|
-
Content-Hash: blake3:
|
|
21
|
-
Source-Hash: blake3:
|
|
13
|
+
Content-Hash: blake3:d6c306e983d2305d8037cb8f4e973ff21eeb0e3ed4a5ac342c4c7dbfae965836
|
|
14
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
22
15
|
Schema-Version: v1
|
|
23
16
|
-->
|
|
24
17
|
|
|
@@ -37,7 +30,7 @@ Gemini, Groq, Mistral, Cohere, AWS Bedrock, Azure, and many more).
|
|
|
37
30
|
and file operations.
|
|
38
31
|
- **Provider routing** — `provider/model` prefix selects the backend
|
|
39
32
|
(`openai/gpt-4o`, `anthropic/claude-sonnet-4-20250514`,
|
|
40
|
-
`gemini/gemini-2.0-flash`). Set `model_hint` to
|
|
33
|
+
`gemini/gemini-2.0-flash`). Set a full `provider/model` as `model_hint` to choose the client provider.
|
|
41
34
|
- **Middleware** — response caching, rate limiting (RPM/TPM), cost tracking,
|
|
42
35
|
budget enforcement (`hard` / `soft`), fallback chains, circuit-breaker
|
|
43
36
|
cooldown, and background health checks.
|
|
@@ -70,8 +63,7 @@ building software; the proxy when centralizing access for multiple consumers.
|
|
|
70
63
|
brew install xberg-io/tap/liter-llm
|
|
71
64
|
|
|
72
65
|
# or run it without a persistent install (the CLI proxy package self-installs the binary)
|
|
73
|
-
|
|
74
|
-
uvx --from liter-llm-cli liter-llm --help
|
|
66
|
+
pnpm dlx @xberg-io/liter-llm-cli@2.2.3 --help
|
|
75
67
|
|
|
76
68
|
# or download a prebuilt binary from the latest GitHub release:
|
|
77
69
|
# https://github.com/xberg-io/liter-llm/releases/latest
|
|
@@ -126,9 +118,11 @@ ChatCompletionRequest.from_json('{"model":"gemini/gemini-2.0-flash","messages":[
|
|
|
126
118
|
ChatCompletionRequest.from_json('{"model":"groq/llama3-70b","messages":[...]}')
|
|
127
119
|
```
|
|
128
120
|
|
|
129
|
-
|
|
130
|
-
`GEMINI_API_KEY`, `GROQ_API_KEY`, `MISTRAL_API_KEY`, `
|
|
131
|
-
credentials for Bedrock.
|
|
121
|
+
Client construction resolves credentials for its selected provider from environment variables: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`,
|
|
122
|
+
`GEMINI_API_KEY`, `GROQ_API_KEY`, `MISTRAL_API_KEY`, `COHERE_API_KEY`, and AWS
|
|
123
|
+
credentials for Bedrock. Create a separate client for each provider with matching
|
|
124
|
+
`model_hint` and credentials. Request prefixes change routing but reuse the client
|
|
125
|
+
API key; they do not select a new environment key per request.
|
|
132
126
|
|
|
133
127
|
## Configuration
|
|
134
128
|
|
|
@@ -140,7 +134,7 @@ from the cwd upward.
|
|
|
140
134
|
```toml
|
|
141
135
|
# liter-llm.toml
|
|
142
136
|
api_key = "${OPENAI_API_KEY}"
|
|
143
|
-
model_hint = "openai"
|
|
137
|
+
model_hint = "openai/gpt-4o"
|
|
144
138
|
timeout_secs = 120
|
|
145
139
|
max_retries = 5
|
|
146
140
|
|
|
@@ -161,7 +155,7 @@ tpm = 100000
|
|
|
161
155
|
|--------|---------|-------------|
|
|
162
156
|
| `api_key` | required | Provider key, wrapped in `SecretString` (never logged). |
|
|
163
157
|
| `base_url` | from registry | Override the provider base URL. |
|
|
164
|
-
| `model_hint` | none |
|
|
158
|
+
| `model_hint` | none | Full provider/model used to select the client provider and credentials. |
|
|
165
159
|
| `timeout_secs` | 60 | Request timeout in seconds. |
|
|
166
160
|
| `max_retries` | 3 | Retries on 429/5xx with exponential backoff. |
|
|
167
161
|
| `cache` | none | `max_entries`, `ttl_seconds`. |
|
|
@@ -196,8 +190,8 @@ and Responses API (`create_response`, `retrieve_response`, `cancel_response`).
|
|
|
196
190
|
|
|
197
191
|
## Common pitfalls
|
|
198
192
|
|
|
199
|
-
1. **Provider
|
|
200
|
-
|
|
193
|
+
1. **Provider routing** — use `"provider/model"` to select a request backend. Bare
|
|
194
|
+
model names fall back to the configured client provider (OpenAI by default).
|
|
201
195
|
2. **API keys are SecretString** — never logged or serialized. Read from env
|
|
202
196
|
vars; never hardcode.
|
|
203
197
|
3. **Python methods are async** — `await` inside an async context.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
3
|
+
Content-Hash: blake3:60957d0aa8465f2855ee8ec0ad10f311a31f8a64822760eb1bfbe7d1a559255b
|
|
4
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
5
|
+
Schema-Version: v1
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Concepts
|
|
9
|
+
|
|
10
|
+
* [Liter Llm](SKILL.md) - Universal LLM API client for 174 providers with native bindings for 14 languages. Use when writing code that calls LLM APIs via liter-llm in Python, TypeScript, Rust, Go, Java, C#, Ruby, PHP, Elixir, WASM, or C, when running the OpenAI-compatible proxy, or when calling LLMs through the MCP server. Covers chat, streaming, tool calling, embeddings, image generation, speech, transcription, moderation, web search, OCR, reranking, provider routing, middleware, and configuration.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: calling-llms
|
|
3
2
|
description: Use when sending chat completions through liter-llm and routing to a specific provider via the `provider/model` prefix. Covers the chat call shape, provider routing, model_hint, message roles, and error categories.
|
|
3
|
+
name: liter-llm-calling-llms
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!--
|
|
7
7
|
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
8
|
-
Content-Hash: blake3:
|
|
9
|
-
Source-Hash: blake3:
|
|
8
|
+
Content-Hash: blake3:d45c8ad7f731f0e0bc91646e677fd7c89b6af31e38944bff4302e7e242a12906
|
|
9
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
10
10
|
Schema-Version: v1
|
|
11
11
|
-->
|
|
12
12
|
|
|
@@ -42,16 +42,18 @@ The model string's prefix selects the provider; build a request per backend:
|
|
|
42
42
|
|
|
43
43
|
```python
|
|
44
44
|
ChatCompletionRequest.from_json('{"model":"anthropic/claude-sonnet-4-20250514","messages":[...]}')
|
|
45
|
-
ChatCompletionRequest.from_json('{"model":"
|
|
45
|
+
ChatCompletionRequest.from_json('{"model":"gemini/gemini-2.0-flash","messages":[...]}')
|
|
46
46
|
ChatCompletionRequest.from_json('{"model":"groq/llama3-70b","messages":[...]}')
|
|
47
47
|
ChatCompletionRequest.from_json('{"model":"mistral/mistral-large-latest","messages":[...]}')
|
|
48
48
|
ChatCompletionRequest.from_json('{"model":"bedrock/anthropic.claude-v2","messages":[...]}')
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
Set `model_hint` at construction to
|
|
51
|
+
Set a full `provider/model` as `model_hint` at construction to select the client
|
|
52
|
+
provider and credential source. Requests without a recognized prefix fall back to
|
|
53
|
+
that client provider:
|
|
52
54
|
|
|
53
55
|
```python
|
|
54
|
-
client = create_client(api_key="
|
|
56
|
+
client = create_client(api_key=os.environ["OPENAI_API_KEY"], model_hint="openai/gpt-4o")
|
|
55
57
|
# the request model can now omit the provider prefix:
|
|
56
58
|
request = ChatCompletionRequest.from_json('{"model":"gpt-4o","messages":[...]}')
|
|
57
59
|
await client.chat(request) # routes to OpenAI
|
|
@@ -61,7 +63,11 @@ await client.chat(request) # routes to OpenAI
|
|
|
61
63
|
|
|
62
64
|
- Keys come from env vars (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, …); never
|
|
63
65
|
hardcode them.
|
|
64
|
-
- Without a prefix
|
|
66
|
+
- Without a recognized prefix, requests fall back to the client's configured provider;
|
|
67
|
+
a client without `model_hint` defaults to OpenAI.
|
|
68
|
+
- Environment credentials are selected when constructing the client, not independently
|
|
69
|
+
for every request. Use a separate client with matching `model_hint` and credentials
|
|
70
|
+
for each provider. A prefix changes routing but does not switch the client's API key.
|
|
65
71
|
- Python errors are typed exceptions exported from `liter_llm`:
|
|
66
72
|
`AuthenticationError`, `RateLimitedError`, `BadRequestError`,
|
|
67
73
|
`ContextWindowExceededError`, `ContentPolicyError`, `NotFoundError`,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
3
|
+
Content-Hash: blake3:9f87cef1b6478cba89e995bc6d58c203c63ad6668e495f5cda9aeca30caf20f0
|
|
4
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
5
|
+
Schema-Version: v1
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Concepts
|
|
9
|
+
|
|
10
|
+
* [Calling Llms](SKILL.md) - Use when sending chat completions through liter-llm and routing to a specific provider via the `provider/model` prefix. Covers the chat call shape, provider routing, model_hint, message roles, and error categories.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: embeddings-and-search
|
|
3
2
|
description: Use when generating embeddings, calling the 12 web-search providers, or running OCR over documents with the 4 OCR providers through liter-llm. Covers embed, search, and ocr methods plus reranking.
|
|
3
|
+
name: liter-llm-embeddings-and-search
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!--
|
|
7
7
|
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
8
|
-
Content-Hash: blake3:
|
|
9
|
-
Source-Hash: blake3:
|
|
8
|
+
Content-Hash: blake3:b5eb4ea6ac25a0cf5bda7f68424924e9760e43055ad34b314f5030588a6c3fc8
|
|
9
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
10
10
|
Schema-Version: v1
|
|
11
11
|
-->
|
|
12
12
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
3
|
+
Content-Hash: blake3:06bd68d2dd91f5a85234a7fa75f4e8f90c5bed83ff6200cf601fc12814c38ddb
|
|
4
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
5
|
+
Schema-Version: v1
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Concepts
|
|
9
|
+
|
|
10
|
+
* [Embeddings And Search](SKILL.md) - Use when generating embeddings, calling the 12 web-search providers, or running OCR over documents with the 4 OCR providers through liter-llm. Covers embed, search, and ocr methods plus reranking.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: running-the-proxy
|
|
3
2
|
description: Use when running the `liter-llm api` OpenAI-compatible gateway — virtual keys, per-key rate limits, budgets, cost tracking, and model routing. Covers the TOML config and the 22 REST endpoints.
|
|
3
|
+
name: liter-llm-running-the-proxy
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!--
|
|
7
7
|
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
8
|
-
Content-Hash: blake3:
|
|
9
|
-
Source-Hash: blake3:
|
|
8
|
+
Content-Hash: blake3:b0a0178eae0e6882ae032983d8927142b6db16add6ab9cab391538db2f202eb4
|
|
9
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
10
10
|
Schema-Version: v1
|
|
11
11
|
-->
|
|
12
12
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
3
|
+
Content-Hash: blake3:157fa991ddf536a4cd3c9413a6bf2f44b25762efcb64ad3f7732731e4cb2f14e
|
|
4
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
5
|
+
Schema-Version: v1
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Concepts
|
|
9
|
+
|
|
10
|
+
* [Running The Proxy](SKILL.md) - Use when running the `liter-llm api` OpenAI-compatible gateway — virtual keys, per-key rate limits, budgets, cost tracking, and model routing. Covers the TOML config and the 22 REST endpoints.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: streaming-responses
|
|
3
2
|
description: Use when streaming tokens incrementally from an LLM via liter-llm over SSE or async iterators. Covers chat_stream, delta handling, and null-content chunks.
|
|
3
|
+
name: liter-llm-streaming-responses
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!--
|
|
7
7
|
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
8
|
-
Content-Hash: blake3:
|
|
9
|
-
Source-Hash: blake3:
|
|
8
|
+
Content-Hash: blake3:6de558b3f33f35e9e7ef76dc64d4ebd199a8a831dc28e306698f18fc16933b4e
|
|
9
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
10
10
|
Schema-Version: v1
|
|
11
11
|
-->
|
|
12
12
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
3
|
+
Content-Hash: blake3:614ded1eb401cb2a27434f2b901aa4cab62f6be4964c0882783e21592ebb347e
|
|
4
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
5
|
+
Schema-Version: v1
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Concepts
|
|
9
|
+
|
|
10
|
+
* [Streaming Responses](SKILL.md) - Use when streaming tokens incrementally from an LLM via liter-llm over SSE or async iterators. Covers chat_stream, delta handling, and null-content chunks.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: tool-calling
|
|
3
2
|
description: Use when defining functions/tools for an LLM to call through liter-llm, or requesting structured JSON outputs. Covers tool schemas, tool_calls handling, and response formats.
|
|
3
|
+
name: liter-llm-tool-calling
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
<!--
|
|
7
7
|
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
8
|
-
Content-Hash: blake3:
|
|
9
|
-
Source-Hash: blake3:
|
|
8
|
+
Content-Hash: blake3:f26049693a8fa3229f675eefc4097cfa0aeb669a5744967a7ab3614009a80310
|
|
9
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
10
10
|
Schema-Version: v1
|
|
11
11
|
-->
|
|
12
12
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
3
|
+
Content-Hash: blake3:27b7d413268994b2de57be9cce2eba3277c235244cf4dd3d8018746f2b98eeed
|
|
4
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
5
|
+
Schema-Version: v1
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Concepts
|
|
9
|
+
|
|
10
|
+
* [Tool Calling](SKILL.md) - Use when defining functions/tools for an LLM to call through liter-llm, or requesting structured JSON outputs. Covers tool schemas, tool_calls handling, and response formats.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Use when calling LLM APIs through the liter-llm MCP server's 22 tools, and to decide when MCP beats the CLI or SDK. Covers the tool surface, the auto-installing launcher, and authentication.
|
|
3
|
+
name: liter-llm-using-the-mcp-server
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!--
|
|
7
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
8
|
+
Content-Hash: blake3:6925dd58f9790a1cc57f093167cf3b430886393ff3792d28003f15269b5546a2
|
|
9
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
10
|
+
Schema-Version: v1
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
# Using the MCP Server
|
|
14
|
+
|
|
15
|
+
The `liter-llm` MCP server exposes 22 tools that mirror the proxy's REST
|
|
16
|
+
endpoints, so an MCP-compatible client (Claude Code, Claude Desktop) can call
|
|
17
|
+
174 LLM providers as tools with no glue code.
|
|
18
|
+
|
|
19
|
+
## Standalone skill installation
|
|
20
|
+
|
|
21
|
+
Installing this skill alone does not register an MCP server or include the plugin launcher.
|
|
22
|
+
Install the CLI (for example, `brew install xberg-io/tap/liter-llm`), then configure your MCP client with
|
|
23
|
+
`liter-llm mcp --transport stdio` as its stdio command. The full product plugin supplies registration where
|
|
24
|
+
the runtime supports MCP.
|
|
25
|
+
|
|
26
|
+
## How it runs in this plugin
|
|
27
|
+
|
|
28
|
+
The plugin auto-registers the server. Its command is the bundled launcher
|
|
29
|
+
`scripts/mcp-launch.sh`, which execs `liter-llm mcp --transport stdio`. On first
|
|
30
|
+
run the launcher resolves a `liter-llm` binary: it reuses one on `PATH`, then
|
|
31
|
+
tries `npx`/`uvx`, then Homebrew, then downloads a prebuilt
|
|
32
|
+
from the tool's latest GitHub release. Override with
|
|
33
|
+
`LITER_LLM_LAUNCHER=auto|npx|uvx|brew|download`.
|
|
34
|
+
|
|
35
|
+
To run it manually:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
liter-llm mcp --transport stdio # for Claude Code / Claude Desktop
|
|
39
|
+
liter-llm mcp --transport http --port 3001
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Configure model routing
|
|
43
|
+
|
|
44
|
+
Provider-backed tools use the proxy model registry. Create `liter-llm-proxy.toml` in the
|
|
45
|
+
working directory, or pass `--config /absolute/path/liter-llm-proxy.toml` when launching:
|
|
46
|
+
|
|
47
|
+
```toml
|
|
48
|
+
[[models]]
|
|
49
|
+
name = "gpt-4o"
|
|
50
|
+
provider_model = "openai/gpt-4o"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Supply `OPENAI_API_KEY` in the MCP process environment, then call `chat` using the
|
|
54
|
+
configured name `gpt-4o`. `list_models` shows configured names; an unknown model is a
|
|
55
|
+
request error. Missing credentials are also reported on provider-backed requests.
|
|
56
|
+
Gemini filters host credentials: install with `--skip-settings` and configure the selected
|
|
57
|
+
provider through `gemini extensions config liter-llm "OpenAI key"`. Local stdio does not
|
|
58
|
+
need a separate proxy virtual key.
|
|
59
|
+
|
|
60
|
+
## The 22 tools
|
|
61
|
+
|
|
62
|
+
Modality tools: `chat`, `embed`, `generate_image`, `speech`, `transcribe`,
|
|
63
|
+
`moderate`, `rerank`, `search`, `ocr`.
|
|
64
|
+
|
|
65
|
+
Model listing: `list_models`.
|
|
66
|
+
|
|
67
|
+
File operations: `create_file`, `list_files`, `retrieve_file`, `delete_file`,
|
|
68
|
+
`file_content`.
|
|
69
|
+
|
|
70
|
+
Batch operations: `create_batch`, `list_batches`, `retrieve_batch`,
|
|
71
|
+
`cancel_batch`.
|
|
72
|
+
|
|
73
|
+
Responses API: `create_response`, `retrieve_response`, `cancel_response`.
|
|
74
|
+
|
|
75
|
+
## Authentication
|
|
76
|
+
|
|
77
|
+
Local stdio trusts the invoking local client by default, so the registered command starts
|
|
78
|
+
without extra proxy authentication configuration. Provider API keys still come from environment
|
|
79
|
+
variables and are needed for provider-backed requests.
|
|
80
|
+
|
|
81
|
+
To apply a restricted virtual key, configure `mcp.stdio_key_id`; an unknown key fails startup.
|
|
82
|
+
Set `mcp.stdio_trust_local = false` to require an explicit virtual key. HTTP transport retains
|
|
83
|
+
its authentication policy; the local stdio default does not disable HTTP authorization.
|
|
84
|
+
|
|
85
|
+
## When to prefer MCP over the CLI or SDK
|
|
86
|
+
|
|
87
|
+
- **Prefer MCP** inside an agent session: the agent invokes tools directly, with
|
|
88
|
+
no code to write or process to manage.
|
|
89
|
+
- **Prefer the SDK** when building application software in a specific language.
|
|
90
|
+
- **Prefer the proxy** when many apps or teams need a shared OpenAI-compatible
|
|
91
|
+
endpoint with keys, budgets, and rate limits.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
3
|
+
Content-Hash: blake3:f82f5f5a906c27ad7e64d5944e1ab1c02685f1df4d61b3b312a8b1d474dfb465
|
|
4
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
5
|
+
Schema-Version: v1
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Concepts
|
|
9
|
+
|
|
10
|
+
* [Using The Mcp Server](SKILL.md) - Use when calling LLM APIs through the liter-llm MCP server's 22 tools, and to decide when MCP beats the CLI or SDK. Covers the tool surface, the auto-installing launcher, and authentication.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Call an LLM provider using liter-llm
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
7
|
+
Content-Hash: blake3:dc58c1c881db41b233402714bcc5ae0ca87dde33b30ae97d010db865ea6aa26b
|
|
8
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
9
|
+
Schema-Version: v1
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
Help with this chat task: $ARGUMENTS
|
|
13
|
+
|
|
14
|
+
Read the calling-llms skill. Choose a provider/model, use the supported SDK or proxy request shape, and read API keys from environment variables. Never print keys.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Stream responses with liter-llm
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
|
|
7
|
+
Content-Hash: blake3:aade12ea079f7659ca4d5976f09836820f645def49f3ded510aed0f4159e38b6
|
|
8
|
+
Source-Hash: blake3:88c87867f5079f6c8fcb582aee913cca4f6feefe541c5361d2307a9b45233f97
|
|
9
|
+
Schema-Version: v1
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
Implement this streaming task: $ARGUMENTS
|
|
13
|
+
|
|
14
|
+
Read the streaming-responses skill. Use the selected language binding or proxy streaming API, handle incremental responses and errors, and avoid buffering the whole result.
|