# Auto Router

## Get Model Selection

> Returns the optimal model recommendation for a given prompt without making the actual completion request. Uses FastRouter's intelligent routing engine.\
> \
> \*\*Available at both:\*\*\
> \- \`POST <https://api.fastrouter.ai/api/v1/model/selection\\`\\>
> \- \`POST <https://api.fastrouter.ai/v1/model/selection\\`\\>
> \
> Set model to \`fastrouter/auto\` for automatic selection.

```json
{"openapi":"3.1.0","info":{"title":"FastRouter API Reference","version":"1.0.0"},"tags":[{"name":"Model Selection","description":"Get the optimal model recommendation for a given prompt without making the actual completion request. Uses FastRouter's intelligent routing engine."}],"servers":[{"url":"https://api.fastrouter.ai","description":"Production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"FastRouter API Key. Get yours at https://fastrouter.ai\n\nFormat: `Authorization: Bearer YOUR_API_KEY`"}},"responses":{"BadRequestError":{"description":"Bad Request - The request is malformed. This could be due to missing parameters, invalid formats, or CORS issues.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}},"UnauthorizedError":{"description":"Invalid Credentials - Your API key is invalid, disabled, or your OAuth session has expired. Check your credentials.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}},"InternalServerError":{"description":"Internal Error - Something went wrong on our side. Retry the request, and contact support if the issue persists.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}}}},"paths":{"/api/v1/model/selection":{"post":{"operationId":"getModelSelection","tags":["Model Selection"],"summary":"Get Model Selection","description":"Returns the optimal model recommendation for a given prompt without making the actual completion request. Uses FastRouter's intelligent routing engine.\n\n**Available at both:**\n- `POST https://api.fastrouter.ai/api/v1/model/selection`\n- `POST https://api.fastrouter.ai/v1/model/selection`\n\nSet model to `fastrouter/auto` for automatic selection.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","messages"],"properties":{"model":{"type":"string","description":"Set to `fastrouter/auto` for auto selection, or provide a specific model ID."},"messages":{"type":"array","description":"Conversation messages. The routing engine analyzes these to determine the optimal model.","minItems":1,"items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["system","user","assistant"]},"content":{"type":"string"}}}}}}}}},"responses":{"200":{"description":"Model selection result","content":{"application/json":{"schema":{"type":"object","properties":{"selected_model":{"type":"string","description":"The recommended model ID"},"assigned_tags":{"type":"array","items":{"type":"string"},"description":"Tags assigned to the prompt"},"top_candidates":{"type":"array","items":{"type":"string"},"description":"Top candidate models"},"selection_strategy":{"type":"string","enum":["auto","explicit"]},"error":{"type":"string","description":"Error message if selection encountered issues"}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fastrouter.ai/api-reference/auto-router.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
