Auto Model Selection

Automatically choose the best model for your prompt

The Auto Router is a special model ID that automatically chooses between selected high-quality models based on your prompt, powered by NotDiamond.

How to Use

Simply set your model to openrouter/auto and OpenRouter will intelligently select the best model for your specific prompt.

1import { OpenRouter } from '@openrouter/sdk';
2
3const openRouter = new OpenRouter({
4 apiKey: '<OPENROUTER_API_KEY>',
5});
6
7const completion = await openRouter.chat.send({
8 model: 'openrouter/auto',
9 messages: [
10 {
11 role: 'user',
12 content: 'What is the meaning of life?',
13 },
14 ],
15});
16
17console.log(completion.choices[0].message.content);

Response

The resulting generation will have model set to the model that was actually used for your request, allowing you to track which model was selected.