What is Model as String?
It’s useful - Instead of importing and instantiating model classes, you can simply use a string identifier to specify which model you want to use. This makes it incredibly easy to switch between models, configure models via environment variables, or dynamically select models at runtime. With Model as String, you can skip the boilerplate code and get straight to building. Just specify the provider and model ID in a simple string format, and Upsonic handles the rest.Format
The string format follows this pattern:- provider: The model provider name (case-insensitive)
- model_id: The specific model identifier
"openai/gpt-4o""anthropic/claude-sonnet-4-6""google/gemini-2.0-flash-exp""groq/llama-3.3-70b-versatile""deepseek/deepseek-chat""ollama/llama3.2"
Examples
Basic Usage with Agent
Switching Models Easily
Environment-Based Configuration
Dynamic Model Selection
Universal Usage: Model as String can be used anywhere you would normally use a Model class instance - in Agents, Teams, Direct LLM Calls, and more. It’s a drop-in replacement that works everywhere.

