The typescript sdk does currently not support model routing, only model selection.
If you don't have it installed already, install the airouter-sdk package using npm or the dependency manager of your choice:
npm install @airouter.io/airouter-sdk
In order to retrieve the best model for your request without performing any routing, do the following. This allows you to use the model from your preferred hosting service and leaves you in full control over the actual execution.
Set the api key to the one you generated. Then proceed to call the AiRouter client:
import { AiRouter } from "@airouter.io/airouter-sdk"
const airouter = new AiRouter(
'<YOUR-API-KEY>',
)
const bestModel = await airouter.getBestModel({
messages: [{ role: "user", content: "Hey how are you doing?" }],
})
const bestModelFullPrivacy = await airouter.getBestModel({
embedding: ['<EMBEDDING>'],
embeddingModel: "text-embedding-3-small",
})
The example above shows how to create an instance of the ai router client in typescript and how to get the best model using messages and using embeddings (full privacy mode).