/modelSelect

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:

  1. Pass your messages in OpenAI format (array of objects with 'role' and 'content')
  2. Specify which LLM providers you want to route between
  3. Optionally provide a preference_id to use a custom router that you've trained
  4. Receive a recommended model and session_id
  5. Use the session_id to submit feedback and improve routing

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 Params

Optional format type. Use 'openrouter' to accept and return OpenRouter-format model identifiers

Body Params
messages
required

Array of message objects in OpenAI format (with 'role' and 'content' keys)

llm_providers
array
required

List of LLM providers to route between. Specify at least one provider in format {provider, model}

Llm Providers*
tools

OpenAI-format function calling tools

boolean
Defaults to false

Whether to hash message content for privacy

string
Defaults to accuracy

Optimization metric for model selection

Maximum number of models to consider for routing. If not specified, considers all provided models

Optimization tradeoff strategy. Use 'cost' to prioritize cost savings or 'latency' to prioritize speed

Preference ID for personalized routing. Create one via POST /v2/preferences/userPreferenceCreate

Previous session ID to link related requests

Responses

400

Invalid request (e.g., no providers specified, invalid preference_id)

401

Authentication failed

404

Preference ID not found

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json