Skip to main content
To use Ollama Cloud, you need to set the OLLAMA_API_KEY environment variable. Host is set to https://ollama.com by default.
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:
Full source: cookbook/90_models/ollama/chat/ollama_cloud.py