Code
ollama_cloud.py
Usage
1
Set up your virtual environment
2
Set up Ollama Cloud API Key
Sign up at ollama.com and get your API key, then export it:
3
Install dependencies
4
Run Agent
Save the code above as
ollama_cloud.py, then run:Key Features
- No local setup required: Models run on Ollama’s hosted infrastructure.
- Automatic configuration: When
api_keyis set, the host defaults tohttps://ollama.com. - Model selection: See available cloud models in the Ollama library.