The simplest case is to specify the name of a model from
lib/models.ts. Example:
model: "claude-sonnet-4-6"
2. Specifying a model config (letting Smoltalk pick the
model)
You can instead also choose to let Smoltalk pick the model
that it thinks will be best for certain parameters. For
example:
model: { // find the fastest model optimizeFor: ["speed"],
// from either Anthropic or Google, whichever is faster providers: ["anthropic", "google"], limit: { // 1 mil input tokens + 1 mil output tokens together // should cost less than $10 for the models being considered cost: 10, }, }
This can be a good option because as better models come out,
you won't need to update your code. You can just update
Smoltalk and it will pick the best model automatically.
3. Specifying a strategy
Finally, you can instead specify a strategy to execute. For
example:
In this case, Smoltalk will run your request over using both
LLMs simultaneously, and take the response that finishes
first.
You can also choose to specify fallbacks in case the first
model returns an error for some reason. This can be a good way
to try something with a fast model and then use a slower but
more powerful model if the first one fails.
The given model determines both
1. Specifying a model directly
The simplest case is to specify the name of a model from lib/models.ts. Example:
2. Specifying a model config (letting Smoltalk pick the model)
You can instead also choose to let Smoltalk pick the model that it thinks will be best for certain parameters. For example:
This can be a good option because as better models come out, you won't need to update your code. You can just update Smoltalk and it will pick the best model automatically.
3. Specifying a strategy
Finally, you can instead specify a strategy to execute. For example:
In this case, Smoltalk will run your request over using both LLMs simultaneously, and take the response that finishes first.
You can also choose to specify fallbacks in case the first model returns an error for some reason. This can be a good way to try something with a fast model and then use a slower but more powerful model if the first one fails.
You can of course combine strategies together to create more complex behavior: