Skip to content

Commit 1157925

Browse files
authored
readme: add cloud models usage and examples (#595)
1 parent 0008226 commit 1157925

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,82 @@ for chunk in stream:
5050
print(chunk['message']['content'], end='', flush=True)
5151
```
5252

53+
## Cloud Models
54+
55+
Run larger models by offloading to Ollama’s cloud while keeping your local workflow.
56+
57+
- Supported models: `deepseek-v3.1:671b-cloud`, `gpt-oss:20b-cloud`, `gpt-oss:120b-cloud`, `kimi-k2:1t-cloud`, `qwen3-coder:480b-cloud`, `kimi-k2-thinking` See [Ollama Models - Cloud](https://ollama.com/search?c=cloud) for more information
58+
59+
### Run via local Ollama
60+
61+
1) Sign in (one-time):
62+
63+
```
64+
ollama signin
65+
```
66+
67+
2) Pull a cloud model:
68+
69+
```
70+
ollama pull gpt-oss:120b-cloud
71+
```
72+
73+
3) Make a request:
74+
75+
```python
76+
from ollama import Client
77+
78+
client = Client()
79+
80+
messages = [
81+
{
82+
'role': 'user',
83+
'content': 'Why is the sky blue?',
84+
},
85+
]
86+
87+
for part in client.chat('gpt-oss:120b-cloud', messages=messages, stream=True):
88+
print(part.message.content, end='', flush=True)
89+
```
90+
91+
### Cloud API (ollama.com)
92+
93+
Access cloud models directly by pointing the client at `https://ollama.com`.
94+
95+
1) Create an API key from [ollama.com](https://ollama.com/settings/keys) , then set:
96+
97+
```
98+
export OLLAMA_API_KEY=your_api_key
99+
```
100+
101+
2) (Optional) List models available via the API:
102+
103+
```
104+
curl https://ollama.com/api/tags
105+
```
106+
107+
3) Generate a response via the cloud API:
108+
109+
```python
110+
import os
111+
from ollama import Client
112+
113+
client = Client(
114+
host='https://ollama.com',
115+
headers={'Authorization': 'Bearer ' + os.environ.get('OLLAMA_API_KEY')}
116+
)
117+
118+
messages = [
119+
{
120+
'role': 'user',
121+
'content': 'Why is the sky blue?',
122+
},
123+
]
124+
125+
for part in client.chat('gpt-oss:120b', messages=messages, stream=True):
126+
print(part.message.content, end='', flush=True)
127+
```
128+
53129
## Custom client
54130
A custom client can be created by instantiating `Client` or `AsyncClient` from `ollama`.
55131

0 commit comments

Comments
 (0)