All tutorials
Track 3·Providers & Integration

Swap to a cloud provider

Run the same agent on a hosted provider. Provider, model, and API key live in .env. Moving between providers is a config change, not a code change.

beginner5 min
Video coming soon
Browse this tutorial's folder in tutorials-pygithub.com/OpenSymbolicAI/tutorials-py/tree/main/03-cloud-provider

Before you start

The same Calculator agent from Track 1 runs on a hosted provider. Provider, model, and API key all live in .env so switching providers is a config change, not a code change.

1. Configure#

Copy the template and fill in your key:

bash
cp .env.example .env

.env sets which provider and model to use, plus the matching API key:

bash
LLM_PROVIDER=fireworks
LLM_MODEL=accounts/fireworks/models/gpt-oss-120b
FIREWORKS_API_KEY=fw_...

main.py reads all three from the environment. The calculator.py agent and its primitives are unchanged from Track 1.

2. Run it#

bash
uv run main.py

Output:

text
53

3. Switch providers#

Edit .env. To use OpenAI instead of Fireworks:

diff
- LLM_PROVIDER=fireworks
- LLM_MODEL=accounts/fireworks/models/gpt-oss-120b
+ LLM_PROVIDER=openai
+ LLM_MODEL=gpt-4.1-nano
ProviderLLM_PROVIDERExample LLM_MODELKey env var
OpenAIopenaigpt-4.1-nanoOPENAI_API_KEY
Anthropicanthropicclaude-haiku-4-5ANTHROPIC_API_KEY
Groqgroqllama-3.3-70b-versatileGROQ_API_KEY
Fireworksfireworksaccounts/fireworks/models/gpt-oss-120bFIREWORKS_API_KEY

Model names change over time, so check the provider's own docs for current options.

Takeaway#

Local or cloud, Fireworks or OpenAI, the choice is configuration. Your primitives, plan logic, and task stay put.