cloud.mdx 4.35 KB
Newer Older
1
2
3
4
---
title: Cloud
sidebarTitle: Cloud
---
5

6
<Info>Ollama's cloud is currently in preview.</Info>
7

8
## Cloud Models
9

10
Ollama's cloud models are a new kind of model in Ollama that can run without a powerful GPU. Instead, cloud models are automatically offloaded to Ollama's cloud service while offering the same capabilities as local models, making it possible to keep using your local tools while running larger models that wouldn't fit on a personal computer.
11

12
13
14
### Supported models

For a list of supported models, see Ollama's [model library](https://ollama.com/search?c=cloud).
15
16
17
18
19
20
21
22

### Running Cloud models

Ollama's cloud models require an account on [ollama.com](https://ollama.com). To sign in or create an account, run:

```
ollama signin
```
23

24
25
<Tabs>
  <Tab title="CLI">
26

27
To run a cloud model, open the terminal and run:
28

29
30
```
ollama run gpt-oss:120b-cloud
31
32
```

33
34
35
36
  </Tab>
  <Tab title="Python">

First, pull a cloud model so it can be accessed:
37

38
```
39
ollama pull gpt-oss:120b-cloud
40
41
```

42
Next, install [Ollama's Python library](https://github.com/ollama/ollama-python):
43

44
```
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
pip install ollama
```

Next, create and run a simple Python script:

```python
from ollama import Client

client = Client()

messages = [
  {
    'role': 'user',
    'content': 'Why is the sky blue?',
  },
]

for part in client.chat('gpt-oss:120b-cloud', messages=messages, stream=True):
  print(part['message']['content'], end='', flush=True)
```

  </Tab>
  <Tab title="JavaScript">

First, pull a cloud model so it can be accessed:

```
ollama pull gpt-oss:120b-cloud
```

Next, install [Ollama's JavaScript library](https://github.com/ollama/ollama-js):

```
npm i ollama
```

Then use the library to run a cloud model:

```typescript
import { Ollama } from "ollama";

const ollama = new Ollama();

const response = await ollama.chat({
  model: "gpt-oss:120b-cloud",
  messages: [{ role: "user", content: "Explain quantum computing" }],
  stream: true,
});

for await (const part of response) {
  process.stdout.write(part.message.content);
}
```

  </Tab>
  <Tab title="cURL">

First, pull a cloud model so it can be accessed:

```
ollama pull gpt-oss:120b-cloud
```

Run the following cURL command to run the command via Ollama's API:

```
curl http://localhost:11434/api/chat -d '{
  "model": "gpt-oss:120b-cloud",
  "messages": [{
    "role": "user",
    "content": "Why is the sky blue?"
  }],
  "stream": false
}'
119
```
120

121
122
  </Tab>
</Tabs>
123

124
## Cloud API access
125

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
Cloud models can also be accessed directly on ollama.com's API. In this mode, ollama.com acts as a remote Ollama host.

### Authentication

For direct access to ollama.com's API, first create an [API key](https://ollama.com/settings/keys).

Then, set the `OLLAMA_API_KEY` environment variable to your API key.

```
export OLLAMA_API_KEY=your_api_key
```

### Listing models

For models available directly via Ollama's API, models can be listed via:

```
curl https://ollama.com/api/tags
```

### Generating a response

<Tabs>
  <Tab title="Python">

First, install [Ollama's Python library](https://github.com/ollama/ollama-python)

```
pip install ollama
```

Then make a request

```python
import os
from ollama import Client

client = Client(
    host="https://ollama.com",
    headers={'Authorization': 'Bearer ' + os.environ.get('OLLAMA_API_KEY')}
)

messages = [
  {
    'role': 'user',
    'content': 'Why is the sky blue?',
  },
]

for part in client.chat('gpt-oss:120b', messages=messages, stream=True):
  print(part['message']['content'], end='', flush=True)
```

  </Tab>
  <Tab title="JavaScript">

First, install [Ollama's JavaScript library](https://github.com/ollama/ollama-js):

```
npm i ollama
```

Next, make a request to the model:

```typescript
import { Ollama } from "ollama";

const ollama = new Ollama({
  host: "https://ollama.com",
  headers: {
    Authorization: "Bearer " + process.env.OLLAMA_API_KEY,
  },
});

const response = await ollama.chat({
  model: "gpt-oss:120b",
  messages: [{ role: "user", content: "Explain quantum computing" }],
  stream: true,
});

for await (const part of response) {
  process.stdout.write(part.message.content);
}
```

  </Tab>
  <Tab title="cURL">

Generate a response via Ollama's chat API:

```
curl https://ollama.com/api/chat \
  -H "Authorization: Bearer $OLLAMA_API_KEY" \
  -d '{
    "model": "gpt-oss:120b",
    "messages": [{
      "role": "user",
      "content": "Why is the sky blue?"
    }],
    "stream": false
  }'
```

  </Tab>
</Tabs>