Skip to content

Feat/ollama cloud integration#890

Open
Gazi2050 wants to merge 5 commits intoGitlawb:mainfrom
Gazi2050:feat/ollama-cloud-integration
Open

Feat/ollama cloud integration#890
Gazi2050 wants to merge 5 commits intoGitlawb:mainfrom
Gazi2050:feat/ollama-cloud-integration

Conversation

@Gazi2050
Copy link
Copy Markdown

Summary

  • Add Ollama Cloud as a new provider option via ollama.com/v1 endpoint
  • Support OLLAMA_API_KEY authentication for cloud-hosted models
  • Implement provider detection, profile setup, and API integration across CLI, scripts, and service layers
  • Fix Ollama API compatibility: handle stream options, max_tokens parameter translation, and auth headers

Impact

User-facing impact:

  • Users can now configure and use Ollama Cloud models alongside local Ollama
  • New provider choice in setup wizard: "Ollama Cloud" with guided API key entry
  • Auto-detection of Ollama Cloud when OLLAMA_API_KEY is set
  • Support for models listed at https://ollama.com/search?c=cloud

Developer/maintainer impact:

  • New ollama-cloud provider profile type and environment handling
  • Auth header injection for all Ollama Cloud API calls (both sync and streaming)
  • API parameter normalization (max_tokens, stream_options) now distinguishes Ollama from other providers
  • Increased timeout tolerance for cloud-based latency (3s → 10s for tags; 5s → 15s for model listing)

Testing

  • bun run build
  • bun run smoke
  • Focused tests:
    • Provider bootstrap with --provider ollama-cloud --api-key <key>
    • Provider wizard Ollama Cloud flow (API key + model selection)
    • Model listing and detection via ollama.com endpoint
    • Streaming and non-streaming chat with cloud models
    • Stream options and max_tokens translation for Ollama (local and cloud)
    • Authorization header presence in all HTTP calls

Notes

  • Provider/model path tested: Ollama Cloud with gpt-oss:120b (default) and other available cloud models
  • Known limitation: Cloud-specific pricing (cost_per_1k_tokens) marked as TBD pending Ollama's pricing structure
  • API detection: isLikelyOllamaEndpoint() now recognizes ollama.com domains
  • Priority order: OLLAMA_API_KEY detection runs before local probe to respect explicit cloud intent
  • Backward compatibility: Local Ollama unchanged; all stream_options and parameter handling validated against both paths

Copy link
Copy Markdown
Collaborator

@gnanam1990 gnanam1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! A few things before we can take another look:

  1. pnpm-lock.yaml shouldn't be committed — this repo uses bun. Please remove it and keep the bun lockfile as the source of truth.
  2. The python/ollama_provider.py and python/smart_router.py files look unrelated to this integration (no TS code references them). Could you drop them, or explain what they're for?
  3. The branch currently has merge conflicts with main — please rebase.

Once those are cleaned up the scope becomes much easier to review. Appreciate the work on getting cloud support in.

@Gazi2050 Gazi2050 force-pushed the feat/ollama-cloud-integration branch from f8b1488 to 04ac279 Compare April 26, 2026 17:38
@Gazi2050 Gazi2050 requested a review from gnanam1990 April 26, 2026 17:41
@jatmn
Copy link
Copy Markdown
Collaborator

jatmn commented Apr 27, 2026

this will likely be impacted by #910 i think

Copy link
Copy Markdown
Collaborator

@gnanam1990 gnanam1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the prior feedback — python files cleanup and Ollama handling fixes look good. Tested locally on commit 04ac279:

  • Build: passes
  • Test suite: 1596 pass, 5 fail. Only one failure is caused by this PR — the rest reproduce on main.

The PR-caused failure (src/tests/bugfixes.test.ts > 'Gemini store field fix > isGeminiMode is imported and used in openaiShim'):

The body.store comment block in openaiShim.ts was rewritten and no longer contains the substring "mistral and gemini don't recognize body.store" that the existing test asserts on. Functional behavior is fine (the guard still includes Mistral and Gemini), but the comment-text assertion now breaks.

Two ways to fix, either is fine:

  1. Restore the original phrasing somewhere in the comment so the .toContain check passes.
  2. Update the test to match the new comment (e.g. assert on don't recognize body.store without the "mistral and gemini" prefix).

No red-flag rule hits — OLLAMA_API_KEY is a clean addition, nothing tengu/USER_TYPE/Anthropic-fingerprint-related. Once the test is green again I'm happy to approve.

@Gazi2050 Gazi2050 requested a review from gnanam1990 April 29, 2026 13:45
gnanam1990
gnanam1990 previously approved these changes May 1, 2026
Copy link
Copy Markdown
Collaborator

@gnanam1990 gnanam1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix! Pulled the branch:

  • bun test src/__tests__/bugfixes.test.ts → 26/26 pass
  • Full suite: 1713 pass, 2 fail — both failures reproduce on main (detectProvider — modelOverride from --model flag), unrelated to this PR
  • Build clean, no openclaude red flags (no tengu_*, no Anthropic fingerprints, OLLAMA_API_KEY is a clean env-only addition)
  • Main merged in cleanly

The remaining functional assertions in that test (isGeminiMode() usage + the isMistral || isGeminiMode() guard regex) still cover the real behavior, so dropping the comment-text assertion is fine.

LGTM 🚀

@jatmn
Copy link
Copy Markdown
Collaborator

jatmn commented May 2, 2026

#910, please rebase and fix conflicts. providers/gateways have changed.

@Gazi2050 Gazi2050 force-pushed the feat/ollama-cloud-integration branch from ab9c06c to 92e16f0 Compare May 3, 2026 17:10
@Gazi2050 Gazi2050 requested a review from gnanam1990 May 3, 2026 17:12
@jatmn
Copy link
Copy Markdown
Collaborator

jatmn commented May 3, 2026

I would request that this be rescoped considerably narrower.

This PR is mostly to add a new provider, but feature creeps exponentially to changing many parts of the framework and how it functions.

While im not against updating or improving the framework, it shouldn't be bundled with a provider addition.

@Gazi2050 Gazi2050 closed this May 3, 2026
@Gazi2050 Gazi2050 reopened this May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants