Commit d1ae15a
Add Ollama Cloud provider
Ollama's hosted service (https://ollama.com) exposes OpenAI-compatible
endpoints at /v1 with Bearer-token auth. Add :ollama_cloud as a dedicated
provider inheriting from the existing Ollama provider so chat, streaming,
media, and dynamic model listing all work unchanged, while correctly
reporting as remote, requiring an API key, and defaulting api_base to
https://ollama.com/v1.
Two class-level overrides are load-bearing:
- `slug` returns "ollama_cloud" — the default "ollamacloud" would
mismatch the :ollama_cloud registration symbol and break
Model::Info#provider lookups.
- `assume_models_exist?` returns true — cloud models are dynamic and
not in the static registry; the existing Ollama provider gets the
same shortcut via its `local?` flag, which OllamaCloud correctly
returns false for.
Models.dev already catalogs Ollama Cloud under the key "ollama-cloud",
so the MODELS_DEV_PROVIDER_MAP entry wires its 37 models into the
shared registry with full metadata (context_window, max_output_tokens,
capabilities). Adding ollama_cloud_api_key to models.rake's
configure_from_env lets the maintainer's next `rake models:update`
populate the shipped models.json.
Verified live against the hosted API: /v1/models returns the expected
OpenAI list shape, sync and streaming chat both work on gpt-oss:120b,
ConfigurationError is raised when the key is missing, and
`RubyLLM.models.refresh!` populates 38 entries (37 from models.dev +
1 additional from the live provider listing).
8 VCR cassettes recorded (4 basic chat, 1 streaming, 3 thinking). Two
reasoning-model quirks match the existing ollama/qwen3 skip pattern:
system-prompt replacement and streaming-vs-sync token count drift.
Resolves #740.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4371a1b commit d1ae15a
23 files changed
Lines changed: 858 additions & 2 deletions
File tree
- docs
- _getting_started
- lib
- ruby_llm
- providers
- tasks
- spec
- fixtures/vcr_cassettes
- ruby_llm
- providers
- support
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| |||
166 | 170 | | |
167 | 171 | | |
168 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
169 | 195 | | |
170 | 196 | | |
171 | 197 | | |
| |||
484 | 510 | | |
485 | 511 | | |
486 | 512 | | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
487 | 517 | | |
488 | 518 | | |
489 | 519 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
Lines changed: 123 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments