smoltalk 0.8.3 → 0.8.4
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/README.md +72 -0
- package/dist/models.d.ts +58 -0
- package/dist/models.js +60 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -335,6 +335,78 @@ a `hostedTools` catalog (`getHostedTools()`); the published file is kept current
|
|
|
335
335
|
by a daily CI job that translates [models.dev](https://models.dev) into
|
|
336
336
|
smoltalk's shape.
|
|
337
337
|
|
|
338
|
+
## Custom models & pricing
|
|
339
|
+
|
|
340
|
+
If you use a model that isn't in smoltalk's baked-in catalog (a self-hosted
|
|
341
|
+
model, a brand-new release, an OpenAI-compatible endpoint), smoltalk has no
|
|
342
|
+
pricing for it and the `cost` field is simply omitted from the result — nothing
|
|
343
|
+
errors, you just get `usage` without `cost`. Teach it the price and cost
|
|
344
|
+
tracking starts working.
|
|
345
|
+
|
|
346
|
+
**One model — `registerTextModel` (recommended).** Register once at startup:
|
|
347
|
+
|
|
348
|
+
```ts
|
|
349
|
+
import { registerTextModel, textSync } from "smoltalk";
|
|
350
|
+
|
|
351
|
+
registerTextModel({
|
|
352
|
+
modelName: "my-model",
|
|
353
|
+
provider: "openai-compat", // must match the provider you call with (see below)
|
|
354
|
+
inputTokenCost: 0.5, // USD per 1M input tokens
|
|
355
|
+
outputTokenCost: 1.5, // USD per 1M output tokens
|
|
356
|
+
cachedInputTokenCost: 0.05, // optional
|
|
357
|
+
cacheCreationInputTokenCost: 0.625, // optional
|
|
358
|
+
maxInputTokens: 128000, // required by the type, even if you only want pricing
|
|
359
|
+
maxOutputTokens: 8192,
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
const res = await textSync({
|
|
363
|
+
model: "my-model",
|
|
364
|
+
provider: "openai-compat",
|
|
365
|
+
baseUrl: { openAiCompat: "https://my-endpoint/v1" },
|
|
366
|
+
messages,
|
|
367
|
+
});
|
|
368
|
+
// res.value.cost is now populated from the rates above.
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**Per-call only — `config.modelData`.** When you can't register globally (e.g.
|
|
372
|
+
per-tenant rates), pass a minimal blob for a single call. It layers over the
|
|
373
|
+
baseline exactly like a refresh blob:
|
|
374
|
+
|
|
375
|
+
```ts
|
|
376
|
+
import { textSync, type ModelDataBlob } from "smoltalk";
|
|
377
|
+
|
|
378
|
+
const modelData: ModelDataBlob = {
|
|
379
|
+
schemaVersion: 1,
|
|
380
|
+
generatedAt: new Date().toISOString(),
|
|
381
|
+
hostedTools: [],
|
|
382
|
+
models: [
|
|
383
|
+
{
|
|
384
|
+
type: "text",
|
|
385
|
+
modelName: "my-model",
|
|
386
|
+
provider: "openai-compat",
|
|
387
|
+
maxInputTokens: 128000,
|
|
388
|
+
maxOutputTokens: 8192,
|
|
389
|
+
inputTokenCost: 0.5,
|
|
390
|
+
outputTokenCost: 1.5,
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
await textSync({ model: "my-model", provider: "openai-compat", messages, modelData });
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**The provider must match.** The registry is keyed by `provider:modelName`, so
|
|
399
|
+
the `provider` you register (or put in the blob) has to equal the `provider` you
|
|
400
|
+
pass at call time. Registering `my-model` under `"openai-compat"` but calling it
|
|
401
|
+
with `provider: "openrouter"` looks up a different key, finds no price, and
|
|
402
|
+
silently drops the `cost` field. When in doubt, register under the same provider
|
|
403
|
+
string you call with.
|
|
404
|
+
|
|
405
|
+
Overriding an entry that *is* in the catalog works the same way — merges are
|
|
406
|
+
field-by-field (see "Refreshing model data" above), so registering just
|
|
407
|
+
`inputTokenCost` / `outputTokenCost` for a known model updates only those fields
|
|
408
|
+
and leaves its limits and capabilities intact.
|
|
409
|
+
|
|
338
410
|
## Hosted tools catalog
|
|
339
411
|
|
|
340
412
|
Each cloud provider offers server-side "hosted" tools (web search, code
|
package/dist/models.d.ts
CHANGED
|
@@ -1228,6 +1228,35 @@ export declare const textModels: readonly [{
|
|
|
1228
1228
|
readonly costUnit: "characters";
|
|
1229
1229
|
readonly disabled: true;
|
|
1230
1230
|
readonly provider: "google";
|
|
1231
|
+
}, {
|
|
1232
|
+
readonly type: "text";
|
|
1233
|
+
readonly modelName: "claude-fable-5";
|
|
1234
|
+
readonly description: "Anthropic's most capable widely released model, for the most demanding reasoning and long-horizon agentic work. Thinking is always on (cannot be disabled); the raw chain of thought is never returned. Requires 30-day data retention (not available under zero data retention). 1M context window, 128K max output.";
|
|
1235
|
+
readonly maxInputTokens: 1000000;
|
|
1236
|
+
readonly maxOutputTokens: 128000;
|
|
1237
|
+
readonly inputTokenCost: 10;
|
|
1238
|
+
readonly cachedInputTokenCost: 1;
|
|
1239
|
+
readonly cacheCreationInputTokenCost: 12.5;
|
|
1240
|
+
readonly outputTokenCost: 50;
|
|
1241
|
+
readonly reasoning: {
|
|
1242
|
+
readonly thinkingStyle: "adaptive";
|
|
1243
|
+
readonly levels: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
1244
|
+
readonly defaultLevel: "high";
|
|
1245
|
+
readonly canDisable: false;
|
|
1246
|
+
readonly outputsThinking: true;
|
|
1247
|
+
readonly outputsSignatures: true;
|
|
1248
|
+
};
|
|
1249
|
+
readonly modalities: {
|
|
1250
|
+
readonly input: readonly ["text", "image", "pdf"];
|
|
1251
|
+
readonly output: readonly ["text"];
|
|
1252
|
+
};
|
|
1253
|
+
readonly knowledge: "2026-01";
|
|
1254
|
+
readonly releaseDate: "2026-06-09";
|
|
1255
|
+
readonly lastUpdated: "2026-06-09";
|
|
1256
|
+
readonly family: "claude-fable";
|
|
1257
|
+
readonly openWeights: false;
|
|
1258
|
+
readonly temperatureSupported: false;
|
|
1259
|
+
readonly provider: "anthropic";
|
|
1231
1260
|
}, {
|
|
1232
1261
|
readonly type: "text";
|
|
1233
1262
|
readonly modelName: "claude-opus-4-8";
|
|
@@ -1310,6 +1339,35 @@ export declare const textModels: readonly [{
|
|
|
1310
1339
|
readonly openWeights: false;
|
|
1311
1340
|
readonly temperatureSupported: true;
|
|
1312
1341
|
readonly provider: "anthropic";
|
|
1342
|
+
}, {
|
|
1343
|
+
readonly type: "text";
|
|
1344
|
+
readonly modelName: "claude-sonnet-5";
|
|
1345
|
+
readonly description: "The best combination of speed and intelligence in the Sonnet tier, with near-Opus quality on coding and agentic work. Adaptive thinking on by default; supports the full low/medium/high/xhigh/max effort range. New tokenizer (~30% more tokens for the same text vs Sonnet 4.6). Standard pricing $3/$15; introductory $2/$10 per MTok through 2026-08-31. 1M context window, 128K max output.";
|
|
1346
|
+
readonly maxInputTokens: 1000000;
|
|
1347
|
+
readonly maxOutputTokens: 128000;
|
|
1348
|
+
readonly inputTokenCost: 3;
|
|
1349
|
+
readonly cachedInputTokenCost: 0.3;
|
|
1350
|
+
readonly cacheCreationInputTokenCost: 3.75;
|
|
1351
|
+
readonly outputTokenCost: 15;
|
|
1352
|
+
readonly reasoning: {
|
|
1353
|
+
readonly thinkingStyle: "adaptive";
|
|
1354
|
+
readonly levels: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
1355
|
+
readonly defaultLevel: "high";
|
|
1356
|
+
readonly canDisable: true;
|
|
1357
|
+
readonly outputsThinking: true;
|
|
1358
|
+
readonly outputsSignatures: true;
|
|
1359
|
+
};
|
|
1360
|
+
readonly modalities: {
|
|
1361
|
+
readonly input: readonly ["text", "image", "pdf"];
|
|
1362
|
+
readonly output: readonly ["text"];
|
|
1363
|
+
};
|
|
1364
|
+
readonly knowledge: "2026-01";
|
|
1365
|
+
readonly releaseDate: "2026-06-30";
|
|
1366
|
+
readonly lastUpdated: "2026-06-30";
|
|
1367
|
+
readonly family: "claude-sonnet";
|
|
1368
|
+
readonly openWeights: false;
|
|
1369
|
+
readonly temperatureSupported: false;
|
|
1370
|
+
readonly provider: "anthropic";
|
|
1313
1371
|
}, {
|
|
1314
1372
|
readonly type: "text";
|
|
1315
1373
|
readonly modelName: "claude-sonnet-4-6";
|
package/dist/models.js
CHANGED
|
@@ -1206,6 +1206,36 @@ export const textModels = [
|
|
|
1206
1206
|
disabled: true,
|
|
1207
1207
|
provider: "google",
|
|
1208
1208
|
},
|
|
1209
|
+
{
|
|
1210
|
+
type: "text",
|
|
1211
|
+
modelName: "claude-fable-5",
|
|
1212
|
+
description: "Anthropic's most capable widely released model, for the most demanding reasoning and long-horizon agentic work. Thinking is always on (cannot be disabled); the raw chain of thought is never returned. Requires 30-day data retention (not available under zero data retention). 1M context window, 128K max output.",
|
|
1213
|
+
maxInputTokens: 1000000,
|
|
1214
|
+
maxOutputTokens: 128000,
|
|
1215
|
+
inputTokenCost: 10,
|
|
1216
|
+
cachedInputTokenCost: 1,
|
|
1217
|
+
cacheCreationInputTokenCost: 12.5,
|
|
1218
|
+
outputTokenCost: 50,
|
|
1219
|
+
reasoning: {
|
|
1220
|
+
thinkingStyle: "adaptive",
|
|
1221
|
+
levels: ["low", "medium", "high", "xhigh", "max"],
|
|
1222
|
+
defaultLevel: "high",
|
|
1223
|
+
canDisable: false,
|
|
1224
|
+
outputsThinking: true,
|
|
1225
|
+
outputsSignatures: true,
|
|
1226
|
+
},
|
|
1227
|
+
modalities: {
|
|
1228
|
+
input: ["text", "image", "pdf"],
|
|
1229
|
+
output: ["text"],
|
|
1230
|
+
},
|
|
1231
|
+
knowledge: "2026-01",
|
|
1232
|
+
releaseDate: "2026-06-09",
|
|
1233
|
+
lastUpdated: "2026-06-09",
|
|
1234
|
+
family: "claude-fable",
|
|
1235
|
+
openWeights: false,
|
|
1236
|
+
temperatureSupported: false,
|
|
1237
|
+
provider: "anthropic",
|
|
1238
|
+
},
|
|
1209
1239
|
{
|
|
1210
1240
|
type: "text",
|
|
1211
1241
|
modelName: "claude-opus-4-8",
|
|
@@ -1291,6 +1321,36 @@ export const textModels = [
|
|
|
1291
1321
|
temperatureSupported: true,
|
|
1292
1322
|
provider: "anthropic",
|
|
1293
1323
|
},
|
|
1324
|
+
{
|
|
1325
|
+
type: "text",
|
|
1326
|
+
modelName: "claude-sonnet-5",
|
|
1327
|
+
description: "The best combination of speed and intelligence in the Sonnet tier, with near-Opus quality on coding and agentic work. Adaptive thinking on by default; supports the full low/medium/high/xhigh/max effort range. New tokenizer (~30% more tokens for the same text vs Sonnet 4.6). Standard pricing $3/$15; introductory $2/$10 per MTok through 2026-08-31. 1M context window, 128K max output.",
|
|
1328
|
+
maxInputTokens: 1000000,
|
|
1329
|
+
maxOutputTokens: 128000,
|
|
1330
|
+
inputTokenCost: 3,
|
|
1331
|
+
cachedInputTokenCost: 0.3,
|
|
1332
|
+
cacheCreationInputTokenCost: 3.75,
|
|
1333
|
+
outputTokenCost: 15,
|
|
1334
|
+
reasoning: {
|
|
1335
|
+
thinkingStyle: "adaptive",
|
|
1336
|
+
levels: ["low", "medium", "high", "xhigh", "max"],
|
|
1337
|
+
defaultLevel: "high",
|
|
1338
|
+
canDisable: true,
|
|
1339
|
+
outputsThinking: true,
|
|
1340
|
+
outputsSignatures: true,
|
|
1341
|
+
},
|
|
1342
|
+
modalities: {
|
|
1343
|
+
input: ["text", "image", "pdf"],
|
|
1344
|
+
output: ["text"],
|
|
1345
|
+
},
|
|
1346
|
+
knowledge: "2026-01",
|
|
1347
|
+
releaseDate: "2026-06-30",
|
|
1348
|
+
lastUpdated: "2026-06-30",
|
|
1349
|
+
family: "claude-sonnet",
|
|
1350
|
+
openWeights: false,
|
|
1351
|
+
temperatureSupported: false,
|
|
1352
|
+
provider: "anthropic",
|
|
1353
|
+
},
|
|
1294
1354
|
{
|
|
1295
1355
|
type: "text",
|
|
1296
1356
|
modelName: "claude-sonnet-4-6",
|