Select best LLM for your query
Select the optimal LLM to handle your query based on Not Diamond's routing algorithm.
This endpoint analyzes your messages and returns the best-suited model from your specified models. The router considers factors like query complexity, model capabilities, cost, and latency based on your preferences.
Key Features:
- Intelligent routing across multiple LLM providers
- Support for custom routers trained on your evaluation data
- Optional cost/latency optimization
- Function calling support for compatible models
Usage:
- Pass your messages in OpenAI format (array of objects with 'role' and 'content')
- Specify which LLM providers you want to route between
- Optionally provide a preference_id to use a custom router that you've trained
- Receive a recommended model and session_id
- Use the session_id to submit feedback and improve routing for non-hashed sessions
Related Endpoints:
- POST /v2/preferences/userPreferenceCreate - Create a preference ID for personalized routing
- POST /v2/pzn/trainCustomRouter - Train a custom router on your evaluation data
Query parameters
Optional format type. Use 'openrouter' to accept and return OpenRouter-format model identifiers
Optional format type. Use 'openrouter' to accept and return OpenRouter-format model identifiers
Request body
Example request
{
"llm_providers": [
{
"model": "gpt-4o",
"provider": "openai"
},
{
"model": "claude-sonnet-4-5-20250929",
"provider": "anthropic"
},
{
"model": "gemini-2.5-flash",
"provider": "google"
}
],
"tradeoff": "cost"
}Response
Successfully selected optimal model
Example response
{
"providers": [
{
"model": "gpt-4o",
"provider": "openai"
}
],
"session_id": "00000000-0000-0000-0000-000000000000"
}Changes
Changed in 1 of the 2 revisions of this API.2
- ○
added the optional property
detail/items/ctxto the response with the422statusresponse-optional-property-added
- ○
added the optional property
detail/items/inputto the response with the422statusresponse-optional-property-added
- ○