ModelsChatRankingDocs
DocsAPI ReferenceSDK Reference
DocsAPI ReferenceSDK Reference
  • Overview
    • Quickstart
    • Principles
    • Models
    • FAQ
    • Enterprise
  • Models & Routing
    • Auto Model Selection
    • Model Fallbacks
    • Provider Selection
  • Features
    • Presets
    • Tool Calling
    • Structured Outputs
    • Message Transforms
    • Model Routing
    • Zero Completion Insurance
    • ZDR
    • App Attribution
LogoLogo
ModelsChatRankingDocs
On this page
  • How to Use
  • Response
Models & Routing

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.

Was this page helpful?
Previous

Model Fallbacks

Automatic failover between models
Next
Built with