Skip to main content

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
Examples:
  • "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

.env file:

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.

Made with Love 💚

At Upsonic, we’re always thinking about developers. We know that simplicity and developer experience matter just as much as features and performance. Model as String is one of the many ways we try to make your life easier. No more boilerplate imports, no more complex configurations - just a simple string and you’re ready to go. Because we believe that the best tools are the ones that get out of your way and let you focus on building amazing things. We build Upsonic with love, for developers who love to build.