ollama_cloud.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your Ollama API key
4
Run the example
Save the code above as
ollama_cloud.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Run gpt-oss:120b on Ollama Cloud with OLLAMA_API_KEY instead of a local Ollama server.
"""To use Ollama Cloud, you need to set the OLLAMA_API_KEY environment variable. Host is set to https://ollama.com by default."""
from agno.agent import Agent
from agno.models.ollama import Ollama
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
model=Ollama(id="gpt-oss:120b-cloud"),
)
agent.print_response("What is the capital of France?", stream=True)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
pass
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U agno ollama
Export your Ollama API key
export OLLAMA_API_KEY="your_ollama_api_key_here"
$Env:OLLAMA_API_KEY="your_ollama_api_key_here"
Run the example
ollama_cloud.py, then run:python ollama_cloud.py
Was this page helpful?