ai-lcr 0.6.4 → 0.6.5
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/CHANGELOG.md +25 -0
- package/README.md +64 -3
- package/README.zh-CN.md +53 -2
- package/dist/index.cjs +56 -1
- package/dist/index.js +56 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ All notable changes to `ai-lcr` are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/), and the project adheres to
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.6.5] — 2026-06-16
|
|
8
|
+
|
|
9
|
+
Bundled price table now covers the open-weights labs, not just the Western
|
|
10
|
+
proprietary makers — so `autoPrice` resolves Qwen, Kimi, MiniMax, and GLM routes
|
|
11
|
+
out of the box (previously they needed a hand-typed `cost`).
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **`MODEL_PRICES` now includes the open-weights makers** — Qwen (Alibaba /
|
|
16
|
+
`dashscope`), Kimi (Moonshot), MiniMax, and GLM (Z.ai), alongside the existing
|
|
17
|
+
DeepSeek. 55 new first-party list prices (229 → 284 entries), keyed by each
|
|
18
|
+
maker's own bare model id (`qwen-plus`, `kimi-k2.5`, `MiniMax-M2`, `glm-4.6`,
|
|
19
|
+
…). The generator's `ALLOW` set gained `dashscope` / `moonshot` / `minimax` /
|
|
20
|
+
`zai`; no existing price changed.
|
|
21
|
+
|
|
22
|
+
### Notes
|
|
23
|
+
|
|
24
|
+
- These are **first-party** list rates (the maker's own API). A dedicated
|
|
25
|
+
inference *host* (DeepInfra, …) is often cheaper and uses HF-style ids
|
|
26
|
+
(`Qwen/Qwen3-…`) that won't match these bare keys — for an aggregator route,
|
|
27
|
+
keep passing an explicit `cost` or `discount`. The bundled rate is the
|
|
28
|
+
`autoPrice` baseline for the maker's own provider and a reference for the rest.
|
|
29
|
+
- Aggregators (deepinfra, together, fireworks, groq, openrouter) remain
|
|
30
|
+
deliberately excluded from the table — their prices drift per-model.
|
|
31
|
+
|
|
7
32
|
## [0.6.4] — 2026-06-16
|
|
8
33
|
|
|
9
34
|
DX improvements that eliminate per-project boilerplate for consumers.
|
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ const lcr = createLCR({
|
|
|
96
96
|
});
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
The same pattern works for any vendor's native SDK provider — `@ai-sdk/anthropic`, `@ai-sdk/google`, `@ai-sdk/openai`, `@ai-sdk/xai`, and so on.
|
|
99
|
+
The same pattern works for any vendor's native SDK provider — `@ai-sdk/anthropic`, `@ai-sdk/google`, `@ai-sdk/openai`, `@ai-sdk/xai`, and so on. `ProviderEntry` accepts `AnyLanguageModel` — a duck-typed interface (`doGenerate` + `doStream` + `provider` + `modelId`) that any AI SDK model satisfies regardless of spec version (V2 or V3), so you never need `as`-casts at the integration boundary. Native APIs are narrow (only that vendor's models) but featureful; aggregators are broad. **Official-first + aggregator-fallback** is the natural LCR shape.
|
|
100
100
|
|
|
101
101
|
## Cheapest route for open-weights models (DeepInfra)
|
|
102
102
|
|
|
@@ -138,9 +138,50 @@ const lcr = createLCR({
|
|
|
138
138
|
|
|
139
139
|
DeepInfra carries open weights only — no first-party Claude / GPT / Gemini. For those closed models, route through OpenRouter or a discount gateway instead.
|
|
140
140
|
|
|
141
|
+
## Skip the boilerplate (`DEFAULT_PROVIDERS`)
|
|
142
|
+
|
|
143
|
+
Every project that routes through OpenRouter, DeepInfra, TokenMart, DeepSeek, etc. redeclares the same `baseURL` + `apiKeyEnv` pair. `DEFAULT_PROVIDERS` is a bundled dictionary — import what you need instead of copy-pasting URLs:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { DEFAULT_PROVIDERS } from "ai-lcr";
|
|
147
|
+
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
148
|
+
|
|
149
|
+
// Pick the providers you use — type-safe, no hardcoded URLs.
|
|
150
|
+
const deepinfra = createOpenAICompatible({
|
|
151
|
+
name: "deepinfra",
|
|
152
|
+
baseURL: DEFAULT_PROVIDERS.deepinfra.baseURL,
|
|
153
|
+
apiKey: process.env[DEFAULT_PROVIDERS.deepinfra.apiKeyEnv],
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Available providers:
|
|
158
|
+
|
|
159
|
+
| Key | Base URL | Env var |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| `openrouter` | `https://openrouter.ai/api/v1` | `OPENROUTER_API_KEY` |
|
|
162
|
+
| `deepinfra` | `https://api.deepinfra.com/v1/openai` | `DEEPINFRA_API_KEY` |
|
|
163
|
+
| `tokenmart` | `https://model.service-inference.ai/v1` | `INFERENCE_API_KEY` |
|
|
164
|
+
| `deepseek` | `https://api.deepseek.com` | `DEEPSEEK_API_KEY` |
|
|
165
|
+
| `kunavo` | `https://api.kunavo.com/v1` | `KUNAVO_API_KEY` |
|
|
166
|
+
| `runware` | `https://api.runware.ai/v1` | `RUNWARE_API_KEY` |
|
|
167
|
+
| `fal` | `https://queue.fal.run` | `FAL_KEY` |
|
|
168
|
+
|
|
169
|
+
A common pattern is to subset `DEFAULT_PROVIDERS` into a project-local type for compile-time safety:
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
import { DEFAULT_PROVIDERS } from "ai-lcr";
|
|
173
|
+
|
|
174
|
+
type ProviderId = "deepinfra" | "openrouter";
|
|
175
|
+
|
|
176
|
+
export const PROVIDERS = {
|
|
177
|
+
deepinfra: DEFAULT_PROVIDERS.deepinfra,
|
|
178
|
+
openrouter: DEFAULT_PROVIDERS.openrouter,
|
|
179
|
+
} satisfies Record<ProviderId, { baseURL: string; apiKeyEnv: string }>;
|
|
180
|
+
```
|
|
181
|
+
|
|
141
182
|
## Zero-config pricing (`autoPrice`)
|
|
142
183
|
|
|
143
|
-
Typing `cost: { input, output }` for every provider is the tedious part. `autoPrice: true` fills any entry that has no explicit `cost` from a **bundled price table** (`MODEL_PRICES`) — official first-party rates for the native makers (OpenAI, Anthropic, Google, DeepSeek,
|
|
184
|
+
Typing `cost: { input, output }` for every provider is the tedious part. `autoPrice: true` fills any entry that has no explicit `cost` from a **bundled price table** (`MODEL_PRICES`) — official first-party rates for the native makers (OpenAI, Anthropic, Google, xAI, Mistral, plus the open-weights labs DeepSeek, Qwen, Kimi, MiniMax, GLM), keyed by the bare model id you already pass to the provider:
|
|
144
185
|
|
|
145
186
|
```ts
|
|
146
187
|
const lcr = createLCR({
|
|
@@ -161,7 +202,7 @@ Three rules keep it predictable:
|
|
|
161
202
|
|
|
162
203
|
- **Off by default.** Unpriced entries stay unpriced (the pre-existing behavior), so turning `autoPrice` on never silently re-prices a model — and an **explicit `cost` always wins** over the table.
|
|
163
204
|
- **`discount` is the reseller knob.** A flat-% aggregator (Kunavo −20%) becomes `discount: 0.2` instead of a hand-typed number; it scales input, output, and `cacheRead` alike, and only applies when the table fills the entry. Variable-discount providers (TokenMart) still want explicit per-model `cost`.
|
|
164
|
-
- **Native makers only.** The table carries first-party list prices
|
|
205
|
+
- **Native makers only.** The table carries first-party list prices, keyed by each maker's own bare id (`qwen-plus`, `glm-4.6`, `kimi-k2.5`, `MiniMax-M2`). It's the autoPrice baseline when you route through that maker's own API. Open-weights *hosts* (DeepInfra uses HF-style ids like `Qwen/Qwen3-…`) and breadth aggregators (OpenRouter) aren't keyed here — price those with explicit `cost` or `discount`.
|
|
165
206
|
|
|
166
207
|
Look a price up yourself with `getModelPrice("claude-sonnet-4-6")`. The table is generated from [LiteLLM's price map](https://github.com/BerriAI/litellm) (MIT) — refresh with `node scripts/gen-text-prices.mjs`.
|
|
167
208
|
|
|
@@ -315,6 +356,26 @@ const lcr = createLCR({
|
|
|
315
356
|
});
|
|
316
357
|
```
|
|
317
358
|
|
|
359
|
+
### Convention-based sink (`createEnvSink`)
|
|
360
|
+
|
|
361
|
+
If your app uses the standard env vars (`LCR_INGEST_URL`, `LCR_PROJECT`, `LCR_INGEST_KEY`), you don't need to wire `createHttpSink` at all — `createEnvSink` reads them for you and returns a ready-to-use `onCall` handler (or `undefined` when `LCR_INGEST_URL` is unset, so local dev stays quiet):
|
|
362
|
+
|
|
363
|
+
```ts
|
|
364
|
+
import { createEnvSink } from "ai-lcr";
|
|
365
|
+
import { after } from "next/server";
|
|
366
|
+
|
|
367
|
+
export const lcrCallSink = createEnvSink(after);
|
|
368
|
+
// → use as `onCall: lcrCallSink` in createLCR
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
The only required argument is `dispatch` — a framework-specific fire-and-forget runner (Next.js: `after`, Cloudflare: `ctx.waitUntil`, plain servers: `(fn) => fn()`). Env vars:
|
|
372
|
+
|
|
373
|
+
| Var | Required | Description |
|
|
374
|
+
|---|---|---|
|
|
375
|
+
| `LCR_INGEST_URL` | yes (no URL → sink is `undefined`) | Dashboard origin, e.g. `https://lcr.ideamarketfit.com` |
|
|
376
|
+
| `LCR_PROJECT` | no | Project tag merged into each payload; falls back to `SITE_KEY` |
|
|
377
|
+
| `LCR_INGEST_KEY` | no | Bearer token (only if the dashboard sets `INGEST_KEY`) |
|
|
378
|
+
|
|
318
379
|
### The companion dashboard ([`ai-lcr-dashboard`](https://github.com/ai-lcr/ai-lcr-dashboard))
|
|
319
380
|
|
|
320
381
|
<p align="center">
|
package/README.zh-CN.md
CHANGED
|
@@ -96,7 +96,7 @@ const lcr = createLCR({
|
|
|
96
96
|
});
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
同样的模式适用于任何厂商的原生 SDK provider——`@ai-sdk/anthropic`、`@ai-sdk/google`、`@ai-sdk/openai`、`@ai-sdk/xai`
|
|
99
|
+
同样的模式适用于任何厂商的原生 SDK provider——`@ai-sdk/anthropic`、`@ai-sdk/google`、`@ai-sdk/openai`、`@ai-sdk/xai` 等等。`ProviderEntry` 接受 `AnyLanguageModel`——一个鸭子类型接口(`doGenerate` + `doStream` + `provider` + `modelId`),任何 AI SDK model 无论 V2 还是 V3 spec 都满足,集成边界无需 `as` 强转。原生 API 覆盖窄(只有该厂商自己的模型)但特性全;聚合器覆盖广。**官方优先 + 聚合器兜底** 正是 LCR 最自然的形态。
|
|
100
100
|
|
|
101
101
|
## 开源权重模型的最便宜路由(DeepInfra)
|
|
102
102
|
|
|
@@ -138,6 +138,47 @@ const lcr = createLCR({
|
|
|
138
138
|
|
|
139
139
|
DeepInfra 只承载开源权重——没有第一方 Claude / GPT / Gemini。那些闭源模型请走 OpenRouter 或折扣中转。
|
|
140
140
|
|
|
141
|
+
## 省掉样板代码(`DEFAULT_PROVIDERS`)
|
|
142
|
+
|
|
143
|
+
每个路由 OpenRouter、DeepInfra、TokenMart、DeepSeek 等的项目都要重复声明相同的 `baseURL` + `apiKeyEnv`。`DEFAULT_PROVIDERS` 是一份内置字典——import 你需要的那几个就行,不用再复制粘贴 URL:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { DEFAULT_PROVIDERS } from "ai-lcr";
|
|
147
|
+
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
148
|
+
|
|
149
|
+
// 按需取——类型安全,无硬编码 URL。
|
|
150
|
+
const deepinfra = createOpenAICompatible({
|
|
151
|
+
name: "deepinfra",
|
|
152
|
+
baseURL: DEFAULT_PROVIDERS.deepinfra.baseURL,
|
|
153
|
+
apiKey: process.env[DEFAULT_PROVIDERS.deepinfra.apiKeyEnv],
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
可用 provider:
|
|
158
|
+
|
|
159
|
+
| Key | Base URL | Env 变量 |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| `openrouter` | `https://openrouter.ai/api/v1` | `OPENROUTER_API_KEY` |
|
|
162
|
+
| `deepinfra` | `https://api.deepinfra.com/v1/openai` | `DEEPINFRA_API_KEY` |
|
|
163
|
+
| `tokenmart` | `https://model.service-inference.ai/v1` | `INFERENCE_API_KEY` |
|
|
164
|
+
| `deepseek` | `https://api.deepseek.com` | `DEEPSEEK_API_KEY` |
|
|
165
|
+
| `kunavo` | `https://api.kunavo.com/v1` | `KUNAVO_API_KEY` |
|
|
166
|
+
| `runware` | `https://api.runware.ai/v1` | `RUNWARE_API_KEY` |
|
|
167
|
+
| `fal` | `https://queue.fal.run` | `FAL_KEY` |
|
|
168
|
+
|
|
169
|
+
常见用法是取 `DEFAULT_PROVIDERS` 的子集,并声明一个项目级类型保证编译安全:
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
import { DEFAULT_PROVIDERS } from "ai-lcr";
|
|
173
|
+
|
|
174
|
+
type ProviderId = "deepinfra" | "openrouter";
|
|
175
|
+
|
|
176
|
+
export const PROVIDERS = {
|
|
177
|
+
deepinfra: DEFAULT_PROVIDERS.deepinfra,
|
|
178
|
+
openrouter: DEFAULT_PROVIDERS.openrouter,
|
|
179
|
+
} satisfies Record<ProviderId, { baseURL: string; apiKeyEnv: string }>;
|
|
180
|
+
```
|
|
181
|
+
|
|
141
182
|
## 它如何路由
|
|
142
183
|
|
|
143
184
|
1. **最便宜优先。** provider 按顺序依次尝试——把它们排成最便宜优先,或设置 `autoSort: true` 让它按 `cost` 自动排序。
|
|
@@ -221,7 +262,17 @@ interface CallRecord {
|
|
|
221
262
|
|
|
222
263
|
**节约怎么算才诚实:** `baselineKind` 说明 `baselineUsd` 是哪种基线——文本是**链尾兜底 provider 的列表价**(`"last-leg"`,故意不取最贵的一条:prompt 缓存可能让标价更便宜的那家在缓存重的调用上反而更贵,取最大值会凭空造出"节约");媒体是**模型厂商官方第一方价**(`"official"`,按实际秒数算),查不到官方价时退化为你配置里最贵的路由(`"priciest-route"`,自我参照,仅说明跨 provider 价差)。
|
|
223
264
|
|
|
224
|
-
**送进收集器:** `createHttpSink` 把每条记录 POST 到任意 endpoint(serverless 上传 Next.js 的 `after` 作 `dispatch`
|
|
265
|
+
**送进收集器:** `createHttpSink` 把每条记录 POST 到任意 endpoint(serverless 上传 Next.js 的 `after` 作 `dispatch` 防止被掐断)。如果你用标准环境变量(`LCR_INGEST_URL`、`LCR_PROJECT`、`LCR_INGEST_KEY`),`createEnvSink` 全部替你读好——三行搞定:
|
|
266
|
+
|
|
267
|
+
```ts
|
|
268
|
+
import { createEnvSink } from "ai-lcr";
|
|
269
|
+
import { after } from "next/server";
|
|
270
|
+
export const lcrCallSink = createEnvSink(after);
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
`LCR_INGEST_URL` 不设 → sink 是 `undefined`,本地开发自动静默。唯一必传参数是 `dispatch`——框架相关的 fire-and-forget runner(Next.js: `after`;Cloudflare: `ctx.waitUntil`;长驻服务: `(fn) => fn()`)。
|
|
274
|
+
|
|
275
|
+
配套的自托管 dashboard [`ai-lcr-dashboard`](https://github.com/ai-lcr/ai-lcr-dashboard)(Next.js + Postgres,Vercel 一键部署)专为这些记录而建:花费 vs 节约趋势、各 provider failover 健康度、媒体 $/秒 与 $/张、以及**价格漂移面板**——某条 model@provider 路由的实报账单与价格表偏差超过 ±20% 时点名示警(约 100× 基本就是美元当美分的笔误)。只存元数据,不存 prompt 和输出。
|
|
225
276
|
|
|
226
277
|
## 支持的 provider
|
|
227
278
|
|
package/dist/index.cjs
CHANGED
|
@@ -1003,6 +1003,16 @@ var MODEL_PRICES = {
|
|
|
1003
1003
|
"gemini-gemma-2-9b-it": { input: 0.35, output: 1.05 },
|
|
1004
1004
|
"gemini-pro-latest": { input: 1.25, output: 10, cacheRead: 0.125 },
|
|
1005
1005
|
"gemini-robotics-er-1.5-preview": { input: 0.3, output: 2.5 },
|
|
1006
|
+
"glm-4-32b-0414-128k": { input: 0.1, output: 0.1 },
|
|
1007
|
+
"glm-4.5": { input: 0.6, output: 2.2 },
|
|
1008
|
+
"glm-4.5-air": { input: 0.2, output: 1.1 },
|
|
1009
|
+
"glm-4.5-airx": { input: 1.1, output: 4.5 },
|
|
1010
|
+
"glm-4.5-x": { input: 2.2, output: 8.9 },
|
|
1011
|
+
"glm-4.5v": { input: 0.6, output: 1.8 },
|
|
1012
|
+
"glm-4.6": { input: 0.6, output: 2.2, cacheRead: 0.11 },
|
|
1013
|
+
"glm-4.7": { input: 0.6, output: 2.2, cacheRead: 0.11 },
|
|
1014
|
+
"glm-5": { input: 1, output: 3.2, cacheRead: 0.2 },
|
|
1015
|
+
"glm-5-code": { input: 1.2, output: 5, cacheRead: 0.3 },
|
|
1006
1016
|
"gpt-3.5-turbo": { input: 0.5, output: 1.5 },
|
|
1007
1017
|
"gpt-3.5-turbo-0125": { input: 0.5, output: 1.5 },
|
|
1008
1018
|
"gpt-3.5-turbo-1106": { input: 1, output: 2 },
|
|
@@ -1117,6 +1127,18 @@ var MODEL_PRICES = {
|
|
|
1117
1127
|
"grok-code-fast-1": { input: 0.2, output: 1.5, cacheRead: 0.02 },
|
|
1118
1128
|
"grok-code-fast-1-0825": { input: 0.2, output: 1.5, cacheRead: 0.02 },
|
|
1119
1129
|
"grok-vision-beta": { input: 5, output: 15 },
|
|
1130
|
+
"kimi-k2-0711-preview": { input: 0.6, output: 2.5, cacheRead: 0.15 },
|
|
1131
|
+
"kimi-k2-0905-preview": { input: 0.6, output: 2.5, cacheRead: 0.15 },
|
|
1132
|
+
"kimi-k2-thinking": { input: 0.6, output: 2.5, cacheRead: 0.15 },
|
|
1133
|
+
"kimi-k2-thinking-turbo": { input: 1.15, output: 8, cacheRead: 0.15 },
|
|
1134
|
+
"kimi-k2-turbo-preview": { input: 1.15, output: 8, cacheRead: 0.15 },
|
|
1135
|
+
"kimi-k2.5": { input: 0.6, output: 3, cacheRead: 0.1 },
|
|
1136
|
+
"kimi-k2.6": { input: 0.95, output: 4, cacheRead: 0.16 },
|
|
1137
|
+
"kimi-latest": { input: 2, output: 5, cacheRead: 0.15 },
|
|
1138
|
+
"kimi-latest-128k": { input: 2, output: 5, cacheRead: 0.15 },
|
|
1139
|
+
"kimi-latest-32k": { input: 1, output: 3, cacheRead: 0.15 },
|
|
1140
|
+
"kimi-latest-8k": { input: 0.2, output: 2, cacheRead: 0.15 },
|
|
1141
|
+
"kimi-thinking-preview": { input: 0.6, output: 2.5, cacheRead: 0.15 },
|
|
1120
1142
|
"labs-devstral-small-2512": { input: 0.1, output: 0.3 },
|
|
1121
1143
|
"magistral-medium-1-2-2509": { input: 2, output: 5 },
|
|
1122
1144
|
"magistral-medium-2506": { input: 2, output: 5 },
|
|
@@ -1125,6 +1147,12 @@ var MODEL_PRICES = {
|
|
|
1125
1147
|
"magistral-small-1-2-2509": { input: 0.5, output: 1.5 },
|
|
1126
1148
|
"magistral-small-2506": { input: 0.5, output: 1.5 },
|
|
1127
1149
|
"magistral-small-latest": { input: 0.5, output: 1.5 },
|
|
1150
|
+
"MiniMax-M2": { input: 0.3, output: 1.2, cacheRead: 0.03 },
|
|
1151
|
+
"MiniMax-M2.1": { input: 0.3, output: 1.2, cacheRead: 0.03 },
|
|
1152
|
+
"MiniMax-M2.1-lightning": { input: 0.3, output: 2.4, cacheRead: 0.03 },
|
|
1153
|
+
"MiniMax-M2.5": { input: 0.3, output: 1.2, cacheRead: 0.03 },
|
|
1154
|
+
"MiniMax-M2.5-lightning": { input: 0.3, output: 2.4, cacheRead: 0.03 },
|
|
1155
|
+
"MiniMax-M3": { input: 0.6, output: 2.4, cacheRead: 0.12 },
|
|
1128
1156
|
"ministral-3-14b-2512": { input: 0.2, output: 0.2 },
|
|
1129
1157
|
"ministral-3-3b-2512": { input: 0.1, output: 0.1 },
|
|
1130
1158
|
"ministral-3-8b-2512": { input: 0.15, output: 0.15 },
|
|
@@ -1145,6 +1173,16 @@ var MODEL_PRICES = {
|
|
|
1145
1173
|
"mistral-small-3-2-2506": { input: 0.06, output: 0.18 },
|
|
1146
1174
|
"mistral-small-latest": { input: 0.06, output: 0.18 },
|
|
1147
1175
|
"mistral-tiny": { input: 0.25, output: 0.25 },
|
|
1176
|
+
"moonshot-v1-128k": { input: 2, output: 5 },
|
|
1177
|
+
"moonshot-v1-128k-0430": { input: 2, output: 5 },
|
|
1178
|
+
"moonshot-v1-128k-vision-preview": { input: 2, output: 5 },
|
|
1179
|
+
"moonshot-v1-32k": { input: 1, output: 3 },
|
|
1180
|
+
"moonshot-v1-32k-0430": { input: 1, output: 3 },
|
|
1181
|
+
"moonshot-v1-32k-vision-preview": { input: 1, output: 3 },
|
|
1182
|
+
"moonshot-v1-8k": { input: 0.2, output: 2 },
|
|
1183
|
+
"moonshot-v1-8k-0430": { input: 0.2, output: 2 },
|
|
1184
|
+
"moonshot-v1-8k-vision-preview": { input: 0.2, output: 2 },
|
|
1185
|
+
"moonshot-v1-auto": { input: 2, output: 5 },
|
|
1148
1186
|
"o1": { input: 15, output: 60, cacheRead: 7.5 },
|
|
1149
1187
|
"o1-2024-12-17": { input: 15, output: 60, cacheRead: 7.5 },
|
|
1150
1188
|
"o3": { input: 2, output: 8, cacheRead: 0.5 },
|
|
@@ -1161,7 +1199,24 @@ var MODEL_PRICES = {
|
|
|
1161
1199
|
"open-mixtral-8x7b": { input: 0.7, output: 0.7 },
|
|
1162
1200
|
"pixtral-12b-2409": { input: 0.15, output: 0.15 },
|
|
1163
1201
|
"pixtral-large-2411": { input: 2, output: 6 },
|
|
1164
|
-
"pixtral-large-latest": { input: 2, output: 6 }
|
|
1202
|
+
"pixtral-large-latest": { input: 2, output: 6 },
|
|
1203
|
+
"qwen-coder": { input: 0.3, output: 1.5 },
|
|
1204
|
+
"qwen-max": { input: 1.6, output: 6.4 },
|
|
1205
|
+
"qwen-plus": { input: 0.4, output: 1.2 },
|
|
1206
|
+
"qwen-plus-2025-01-25": { input: 0.4, output: 1.2 },
|
|
1207
|
+
"qwen-plus-2025-04-28": { input: 0.4, output: 1.2 },
|
|
1208
|
+
"qwen-plus-2025-07-14": { input: 0.4, output: 1.2 },
|
|
1209
|
+
"qwen-turbo": { input: 0.05, output: 0.2 },
|
|
1210
|
+
"qwen-turbo-2024-11-01": { input: 0.05, output: 0.2 },
|
|
1211
|
+
"qwen-turbo-2025-04-28": { input: 0.05, output: 0.2 },
|
|
1212
|
+
"qwen-turbo-latest": { input: 0.05, output: 0.2 },
|
|
1213
|
+
"qwen3-next-80b-a3b-instruct": { input: 0.15, output: 1.2 },
|
|
1214
|
+
"qwen3-next-80b-a3b-thinking": { input: 0.15, output: 1.2 },
|
|
1215
|
+
"qwen3-vl-235b-a22b-instruct": { input: 0.4, output: 1.6 },
|
|
1216
|
+
"qwen3-vl-235b-a22b-thinking": { input: 0.4, output: 4 },
|
|
1217
|
+
"qwen3-vl-32b-instruct": { input: 0.16, output: 0.64 },
|
|
1218
|
+
"qwen3-vl-32b-thinking": { input: 0.16, output: 2.87 },
|
|
1219
|
+
"qwq-plus": { input: 0.8, output: 2.4 }
|
|
1165
1220
|
};
|
|
1166
1221
|
|
|
1167
1222
|
// src/media-official.ts
|
package/dist/index.js
CHANGED
|
@@ -949,6 +949,16 @@ var MODEL_PRICES = {
|
|
|
949
949
|
"gemini-gemma-2-9b-it": { input: 0.35, output: 1.05 },
|
|
950
950
|
"gemini-pro-latest": { input: 1.25, output: 10, cacheRead: 0.125 },
|
|
951
951
|
"gemini-robotics-er-1.5-preview": { input: 0.3, output: 2.5 },
|
|
952
|
+
"glm-4-32b-0414-128k": { input: 0.1, output: 0.1 },
|
|
953
|
+
"glm-4.5": { input: 0.6, output: 2.2 },
|
|
954
|
+
"glm-4.5-air": { input: 0.2, output: 1.1 },
|
|
955
|
+
"glm-4.5-airx": { input: 1.1, output: 4.5 },
|
|
956
|
+
"glm-4.5-x": { input: 2.2, output: 8.9 },
|
|
957
|
+
"glm-4.5v": { input: 0.6, output: 1.8 },
|
|
958
|
+
"glm-4.6": { input: 0.6, output: 2.2, cacheRead: 0.11 },
|
|
959
|
+
"glm-4.7": { input: 0.6, output: 2.2, cacheRead: 0.11 },
|
|
960
|
+
"glm-5": { input: 1, output: 3.2, cacheRead: 0.2 },
|
|
961
|
+
"glm-5-code": { input: 1.2, output: 5, cacheRead: 0.3 },
|
|
952
962
|
"gpt-3.5-turbo": { input: 0.5, output: 1.5 },
|
|
953
963
|
"gpt-3.5-turbo-0125": { input: 0.5, output: 1.5 },
|
|
954
964
|
"gpt-3.5-turbo-1106": { input: 1, output: 2 },
|
|
@@ -1063,6 +1073,18 @@ var MODEL_PRICES = {
|
|
|
1063
1073
|
"grok-code-fast-1": { input: 0.2, output: 1.5, cacheRead: 0.02 },
|
|
1064
1074
|
"grok-code-fast-1-0825": { input: 0.2, output: 1.5, cacheRead: 0.02 },
|
|
1065
1075
|
"grok-vision-beta": { input: 5, output: 15 },
|
|
1076
|
+
"kimi-k2-0711-preview": { input: 0.6, output: 2.5, cacheRead: 0.15 },
|
|
1077
|
+
"kimi-k2-0905-preview": { input: 0.6, output: 2.5, cacheRead: 0.15 },
|
|
1078
|
+
"kimi-k2-thinking": { input: 0.6, output: 2.5, cacheRead: 0.15 },
|
|
1079
|
+
"kimi-k2-thinking-turbo": { input: 1.15, output: 8, cacheRead: 0.15 },
|
|
1080
|
+
"kimi-k2-turbo-preview": { input: 1.15, output: 8, cacheRead: 0.15 },
|
|
1081
|
+
"kimi-k2.5": { input: 0.6, output: 3, cacheRead: 0.1 },
|
|
1082
|
+
"kimi-k2.6": { input: 0.95, output: 4, cacheRead: 0.16 },
|
|
1083
|
+
"kimi-latest": { input: 2, output: 5, cacheRead: 0.15 },
|
|
1084
|
+
"kimi-latest-128k": { input: 2, output: 5, cacheRead: 0.15 },
|
|
1085
|
+
"kimi-latest-32k": { input: 1, output: 3, cacheRead: 0.15 },
|
|
1086
|
+
"kimi-latest-8k": { input: 0.2, output: 2, cacheRead: 0.15 },
|
|
1087
|
+
"kimi-thinking-preview": { input: 0.6, output: 2.5, cacheRead: 0.15 },
|
|
1066
1088
|
"labs-devstral-small-2512": { input: 0.1, output: 0.3 },
|
|
1067
1089
|
"magistral-medium-1-2-2509": { input: 2, output: 5 },
|
|
1068
1090
|
"magistral-medium-2506": { input: 2, output: 5 },
|
|
@@ -1071,6 +1093,12 @@ var MODEL_PRICES = {
|
|
|
1071
1093
|
"magistral-small-1-2-2509": { input: 0.5, output: 1.5 },
|
|
1072
1094
|
"magistral-small-2506": { input: 0.5, output: 1.5 },
|
|
1073
1095
|
"magistral-small-latest": { input: 0.5, output: 1.5 },
|
|
1096
|
+
"MiniMax-M2": { input: 0.3, output: 1.2, cacheRead: 0.03 },
|
|
1097
|
+
"MiniMax-M2.1": { input: 0.3, output: 1.2, cacheRead: 0.03 },
|
|
1098
|
+
"MiniMax-M2.1-lightning": { input: 0.3, output: 2.4, cacheRead: 0.03 },
|
|
1099
|
+
"MiniMax-M2.5": { input: 0.3, output: 1.2, cacheRead: 0.03 },
|
|
1100
|
+
"MiniMax-M2.5-lightning": { input: 0.3, output: 2.4, cacheRead: 0.03 },
|
|
1101
|
+
"MiniMax-M3": { input: 0.6, output: 2.4, cacheRead: 0.12 },
|
|
1074
1102
|
"ministral-3-14b-2512": { input: 0.2, output: 0.2 },
|
|
1075
1103
|
"ministral-3-3b-2512": { input: 0.1, output: 0.1 },
|
|
1076
1104
|
"ministral-3-8b-2512": { input: 0.15, output: 0.15 },
|
|
@@ -1091,6 +1119,16 @@ var MODEL_PRICES = {
|
|
|
1091
1119
|
"mistral-small-3-2-2506": { input: 0.06, output: 0.18 },
|
|
1092
1120
|
"mistral-small-latest": { input: 0.06, output: 0.18 },
|
|
1093
1121
|
"mistral-tiny": { input: 0.25, output: 0.25 },
|
|
1122
|
+
"moonshot-v1-128k": { input: 2, output: 5 },
|
|
1123
|
+
"moonshot-v1-128k-0430": { input: 2, output: 5 },
|
|
1124
|
+
"moonshot-v1-128k-vision-preview": { input: 2, output: 5 },
|
|
1125
|
+
"moonshot-v1-32k": { input: 1, output: 3 },
|
|
1126
|
+
"moonshot-v1-32k-0430": { input: 1, output: 3 },
|
|
1127
|
+
"moonshot-v1-32k-vision-preview": { input: 1, output: 3 },
|
|
1128
|
+
"moonshot-v1-8k": { input: 0.2, output: 2 },
|
|
1129
|
+
"moonshot-v1-8k-0430": { input: 0.2, output: 2 },
|
|
1130
|
+
"moonshot-v1-8k-vision-preview": { input: 0.2, output: 2 },
|
|
1131
|
+
"moonshot-v1-auto": { input: 2, output: 5 },
|
|
1094
1132
|
"o1": { input: 15, output: 60, cacheRead: 7.5 },
|
|
1095
1133
|
"o1-2024-12-17": { input: 15, output: 60, cacheRead: 7.5 },
|
|
1096
1134
|
"o3": { input: 2, output: 8, cacheRead: 0.5 },
|
|
@@ -1107,7 +1145,24 @@ var MODEL_PRICES = {
|
|
|
1107
1145
|
"open-mixtral-8x7b": { input: 0.7, output: 0.7 },
|
|
1108
1146
|
"pixtral-12b-2409": { input: 0.15, output: 0.15 },
|
|
1109
1147
|
"pixtral-large-2411": { input: 2, output: 6 },
|
|
1110
|
-
"pixtral-large-latest": { input: 2, output: 6 }
|
|
1148
|
+
"pixtral-large-latest": { input: 2, output: 6 },
|
|
1149
|
+
"qwen-coder": { input: 0.3, output: 1.5 },
|
|
1150
|
+
"qwen-max": { input: 1.6, output: 6.4 },
|
|
1151
|
+
"qwen-plus": { input: 0.4, output: 1.2 },
|
|
1152
|
+
"qwen-plus-2025-01-25": { input: 0.4, output: 1.2 },
|
|
1153
|
+
"qwen-plus-2025-04-28": { input: 0.4, output: 1.2 },
|
|
1154
|
+
"qwen-plus-2025-07-14": { input: 0.4, output: 1.2 },
|
|
1155
|
+
"qwen-turbo": { input: 0.05, output: 0.2 },
|
|
1156
|
+
"qwen-turbo-2024-11-01": { input: 0.05, output: 0.2 },
|
|
1157
|
+
"qwen-turbo-2025-04-28": { input: 0.05, output: 0.2 },
|
|
1158
|
+
"qwen-turbo-latest": { input: 0.05, output: 0.2 },
|
|
1159
|
+
"qwen3-next-80b-a3b-instruct": { input: 0.15, output: 1.2 },
|
|
1160
|
+
"qwen3-next-80b-a3b-thinking": { input: 0.15, output: 1.2 },
|
|
1161
|
+
"qwen3-vl-235b-a22b-instruct": { input: 0.4, output: 1.6 },
|
|
1162
|
+
"qwen3-vl-235b-a22b-thinking": { input: 0.4, output: 4 },
|
|
1163
|
+
"qwen3-vl-32b-instruct": { input: 0.16, output: 0.64 },
|
|
1164
|
+
"qwen3-vl-32b-thinking": { input: 0.16, output: 2.87 },
|
|
1165
|
+
"qwq-plus": { input: 0.8, output: 2.4 }
|
|
1111
1166
|
};
|
|
1112
1167
|
|
|
1113
1168
|
// src/media-official.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-lcr",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Least Cost Routing for LLMs — route every model call to the cheapest available provider, fall back automatically, and track real cost. Built for the Vercel AI SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|