Model Selection Criteria
How to select the optimal AI model for your Routstr requests
Model Selection in Routstr
When using Routstr’s API, you have several options for selecting which AI model to use for your requests. This guide explains the available options and best practices.
Specifying a Model
You can directly specify which model to use in your API requests:
Common model options include:
gpt-4
- OpenAI’s GPT-4 modelllama-3-70b-chat
- Meta’s Llama 3 (70B parameter) chat modelclaude-3-opus
- Anthropic’s Claude 3 Opus model
Using the Default Route
If you don’t specify a model, Routstr will route your request to an appropriate model based on your request content and model availability:
The default routing considers:
- Availability: Which models are currently accessible and responding quickly
- Cost: Models with lower token prices may be preferred
- Capability: The complexity of your request may route to more powerful models
Choosing Models Based on Capabilities
Different models have different capabilities. For specialized tasks, use the appropriate model:
For Text Generation
For Code Generation
For Image Understanding (Vision)
Model Parameters
You can customize how a model generates responses by adjusting parameters:
Common parameters include:
temperature
: Controls randomness (0.0 to 1.0, lower is more deterministic)max_tokens
: Maximum length of the generated responsetop_p
: Nucleus sampling parameter (0.0 to 1.0)top_k
: Limits vocabulary to top k options (only for some models)presence_penalty
: Reduces repetition of previously mentioned topicsfrequency_penalty
: Reduces repetition of frequently used tokens
Model Pricing
Different models have different pricing per token:
Model | Input Price (per 1K tokens) | Output Price (per 1K tokens) |
---|---|---|
gpt-3.5-turbo | $0.0005 | $0.0015 |
gpt-4 | $0.03 | $0.06 |
claude-3-opus | $0.015 | $0.075 |
llama-3-70b | $0.0007 | $0.0014 |
Consider the balance between model capability and price for your use case.
Using the Python OpenAI Client
If you’re using Python, you can use the OpenAI client to select models:
Best Practices
- Start with a general-purpose model like
gpt-3.5-turbo
for basic tasks - Upgrade to more powerful models for complex reasoning or specialized tasks
- Use vision models when working with images
- Balance cost and capability - only use expensive models when needed
- Be specific in your prompts about quality and format requirements