Ollama Cloud
Code
1from kern.agent import Agent2from kern.models.ollama import Ollama34agent = Agent(5 model=Ollama(id="gpt-oss:120b-cloud", host="https://ollama.com"),6)78agent.print_response("How many r's in the word 'strawberry'?", stream=True)Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet up Ollama Cloud API Key
Sign up at ollama.com and get your API key, then export it:
1export OLLAMA_API_KEY=your_api_key_hereInstall dependencies
1uv pip install -U ollama kern-aiRun Agent
1python cookbook/11_models/ollama/ollama_cloud.pyKey Features
- No local setup required: Access powerful models instantly without downloading or managing local installations
- Production-ready: Enterprise-grade infrastructure with reliable uptime and performance
- Wide model selection: Access to powerful models including GPT-OSS and other optimized cloud models
- Automatic configuration: When
api_keyis provided, the host automatically defaults tohttps://ollama.com