@extrafemi-ai/lodestone 0.9.0 → 0.9.1
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 +5 -0
- package/README.md +1 -1
- package/dist/lodestone.js +5 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Versions before 1.0 may change between minor releases; each change that could break a caller is marked **breaking**.
|
|
4
4
|
|
|
5
|
+
## 0.9.1
|
|
6
|
+
|
|
7
|
+
- **Fixed: a fallback provider's calls are counted at its own list's price.** Lodestone estimated a call's cost from OpenRouter's catalogue only, so a call on a fallback that does not report its cost (Cencori, Requesty and others) was counted at the flat hold ($0.01 by default), even when that provider's own model list has prices. A spend limit was therefore far stricter than needed for cheap calls (seen on 18 Nov 2026: one `gpt-4o-mini` call of 26 tokens counted as $0.01). It now uses the calling provider's own list when it has one; with no price, the hold still counts.
|
|
8
|
+
- **`cencori()` has answered a live call** (18 Nov 2026: `gpt-4o-mini`, about 4 s), failover, a withdrawn model dropped by its live list, discovery with a price limit, and the `private` rule were all seen working.
|
|
9
|
+
|
|
5
10
|
## 0.9.0
|
|
6
11
|
|
|
7
12
|
- **Google self-healing.** `google()` can now list Google's models (`listModels`), so a fallback on the Gemini API keeps its chain alive like OpenRouter's and Anthropic's. A model Google no longer lists is dropped, and with `discover: { replaceRetired: true }` it is swapped for the newest model of the same line: `flash`, `flash-lite` or `pro`, read from the id (`gemini-2.0-flash` is a `flash`) and ranked by version number, since Google publishes no release dates. It never crosses lines, never picks a preview, dated copy, speech, image, live or embedding model, and `checkModels()` reports every swap. Google's list says nothing about lifecycle, so a model Google still lists but has stopped serving is not noticed ahead of time: the call fails and the next fallback is tried. Providers can now give `lineOf(id)` for this; `CatalogModel` has an optional `version`. Not yet called against the real Google endpoint: the field names follow Google's models.list reference and the logic is tested on fake responses.
|
package/README.md
CHANGED
|
@@ -171,7 +171,7 @@ OpenRouter is the default, but one provider's outage should not stop your tool.
|
|
|
171
171
|
| `llmapi()` | [LLM API](https://llmapi.ai) | Gateway to 150+ chat models. Lists price; ignores its image, video and speech models. |
|
|
172
172
|
| `groq()`, `cerebras()` | Groq, Cerebras | Fast inference with free tiers. Use `free: true` so they are not counted against a spend limit. |
|
|
173
173
|
| `omniakey()` | [OmniaKey](https://omniakey.com) | A prepaid gateway for text, image, video and music models, with an OpenAI-compatible text endpoint. Text and JSON calls only here. Its model list needs a key and mixes chat with image, video and music models, so name your models. Not yet called live: the account's first chat call was refused for insufficient quota. |
|
|
174
|
-
| `cencori()` | [Cencori](https://cencori.com) | A gateway to chat models from OpenAI, Anthropic, Google, xAI, Mistral, DeepSeek and Meta, with an OpenAI-compatible endpoint. Its docs say it logs the full prompt and response of every request and do not say whether prompts are trained on or kept, so a call marked `private` skips it unless you vouch for it with `privacy: 'no-training'`. Its
|
|
174
|
+
| `cencori()` | [Cencori](https://cencori.com) | A gateway to chat models from OpenAI, Anthropic, Google, xAI, Mistral, DeepSeek and Meta, with an OpenAI-compatible endpoint. Seen answering a live call (18 Nov 2026). Its model list needs a key and is read live (63 available chat models among 95 entries): Lodestone keeps them with their price and context, so `discover: { fill }` works with it and a call is counted at its listed price. Its docs say it logs the full prompt and response of every request and do not say whether prompts are trained on or kept, so a call marked `private` skips it unless you vouch for it with `privacy: 'no-training'`. Its rate limits were not found, and it is not marked `free`. |
|
|
175
175
|
| `openai()`, `mistral()`, `together()` | the providers themselves | |
|
|
176
176
|
| `ollama()` | a local server | Free and private. |
|
|
177
177
|
| `anthropic()`, `google()` | direct | Not OpenAI-style, so they have their own adapters. Both read the provider's model list ([Anthropic](#anthropic-self-healing), [Google](#google-self-healing)). `anthropic()` leaves the temperature out, because Anthropic's current models reject one (Claude 4.7 and later answer 400 to a non-default value, and API version 2026-10-21 removes it); pass `anthropic({ sendTemperature: true })` for an older model that still accepts one. Model ids are retired on a schedule (`claude-sonnet-4-20250514` was retired on 15 June 2026). `anthropic()` reads Anthropic's own model list, so a retired id is dropped from the chain and one with a retirement date within a week is left out; see [Anthropic self-healing](#anthropic-self-healing). Keep a second model or provider in the chain as well, so a retired id costs one attempt, not the call. |
|
package/dist/lodestone.js
CHANGED
|
@@ -91,10 +91,12 @@ export function createLodestone(config = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
/** What a call cost, estimated from the model's catalogue price, for providers that do not report it. */
|
|
94
|
-
async function estimateCost(model, usage) {
|
|
94
|
+
async function estimateCost(model, usage, provider) {
|
|
95
95
|
if (!usage)
|
|
96
96
|
return undefined;
|
|
97
|
-
|
|
97
|
+
// A fallback provider's own list has its own ids and prices (OpenRouter's would not know `gpt-4o-mini`); without one, OpenRouter's catalogue.
|
|
98
|
+
const own = provider ? [...fbCatalogs].find(([fb]) => fb.provider === provider)?.[1] : undefined;
|
|
99
|
+
const m = (await (own ?? catalog).load().catch(() => null))?.find((x) => x.id === model);
|
|
98
100
|
const inP = Number(m?.pricing?.prompt);
|
|
99
101
|
const outP = Number(m?.pricing?.completion);
|
|
100
102
|
return Number.isFinite(inP) && Number.isFinite(outP) ? usage.inputTokens * inP + usage.outputTokens * outP : undefined;
|
|
@@ -253,7 +255,7 @@ export function createLodestone(config = {}) {
|
|
|
253
255
|
const finish = async (provider, model, reply, phase, free = false) => {
|
|
254
256
|
const result = { text: reply.text, provider: provider.name, model, usage: reply.usage };
|
|
255
257
|
if (phase && !free && config.spend && (!callerKey || (phase === 'paid' && opts.spendCap))) {
|
|
256
|
-
const costUsd = reply.usage?.costUsd ?? (await estimateCost(model, reply.usage));
|
|
258
|
+
const costUsd = reply.usage?.costUsd ?? (await estimateCost(model, reply.usage, provider));
|
|
257
259
|
const hold = held;
|
|
258
260
|
const id = hold && hold.provider === provider.name && hold.model === model ? hold.id : crypto.randomUUID();
|
|
259
261
|
held = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@extrafemi-ai/lodestone",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Calls AI models so your tool keeps working when a model is withdrawn, slow, rate-limited or down: failover across providers, self-updating model lists, spend limits.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|