Skip to content

feat(llm): add built-in Ollama Cloud provider preset#1

Open
chethanuk wants to merge 2 commits into
mainfrom
fix/issue-305-ollama-cloud-provider
Open

feat(llm): add built-in Ollama Cloud provider preset#1
chethanuk wants to merge 2 commits into
mainfrom
fix/issue-305-ollama-cloud-provider

Conversation

@chethanuk

@chethanuk chethanuk commented Jul 5, 2026

Copy link
Copy Markdown
Owner

User description

Description

Adds a built-in ollama-cloud provider preset to the registry in internal/llm/providers.go, so Ollama Cloud can be selected directly instead of hand-configured as a custom provider.

The preset uses the OpenAI-compatible protocol against https://ollama.com/v1, reading the API key from OLLAMA_API_KEY (sent as Authorization: Bearer <key>, the shared default for OpenAI-protocol entries — no per-provider AuthHeader). It ships two models, gpt-oss:120b and gpt-oss:20b. The base URL, env var, and model naming match Ollama Cloud's documented OpenAI-compatible endpoint.

Opened against my own fork first as a staging/review step.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

gofmt -l reports no diffs, go vet ./internal/llm/ is clean, and go test ./internal/llm/ passes (176 tests). Coverage includes the existing TestListProviders_Order (updated for the new sorted position) and a new TestLookupProvider_OllamaCloudDetails that pins Protocol, BaseURL, EnvVar, empty AuthHeader, and each model name individually.

Whether Ollama Cloud's OpenAI endpoint reliably supports the tool-calls flow that ocr review needs is a runtime/e2e concern, out of scope for this preset addition.

  • make test passes locally
  • Manual testing (describe below)

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA

Related Issues

Closes alibaba#305


CodeAnt-AI Description

Add Ollama Cloud as a built-in LLM provider

What Changed

  • Added Ollama Cloud as a selectable provider instead of requiring a custom setup
  • The new provider uses Ollama Cloud’s OpenAI-compatible endpoint and reads the API key from OLLAMA_API_KEY
  • Included the two Ollama Cloud models: gpt-oss:120b and gpt-oss:20b
  • Updated tests to cover the new provider in the provider list and verify its connection details and model names

Impact

✅ Easier Ollama Cloud setup
✅ Fewer custom provider configurations
✅ Clearer provider selection for Ollama Cloud users

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • New Features

    • Added built-in support for the Ollama Cloud provider.
    • Added access to the gpt-oss:120b and gpt-oss:20b models through Ollama Cloud.
  • Tests

    • Added coverage validating Ollama Cloud discovery, configuration, and model availability.

@codeant-ai

codeant-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-305-ollama-cloud-provider

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jul 5, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for a new LLM provider, 'ollama-cloud', to the registry, including its configuration details and supported models. It also updates the provider list order test and adds a new unit test to verify the 'ollama-cloud' provider details. There are no review comments, and the changes look correct, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@codeant-ai

codeant-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@greptile-apps

greptile-apps Bot commented Jul 5, 2026

Copy link
Copy Markdown

Greptile Summary

Adds an ollama-cloud preset to the built-in provider registry, using the OpenAI-compatible protocol against https://ollama.com/v1 with OLLAMA_API_KEY, and updates tests to reflect the new total provider count and sorted position.

  • internal/llm/providers.go: New ollama-cloud entry appended to registry with two models (gpt-oss:120b, gpt-oss:20b); all existing struct fields (Protocol, BaseURL, EnvVar, AuthHeader) follow the same pattern as other OpenAI-compatible providers.
  • internal/llm/providers_test.go: TestListProviders_Order updated to include ollama-cloud in the alphabetically-sorted expectation list; new TestLookupProvider_OllamaCloudDetails validates all fields and both model names individually, matching the established coverage pattern.

Confidence Score: 5/5

Safe to merge — the change is a pure registry addition with no behavioural changes to existing providers or shared logic.

The diff touches only two files: a new struct literal appended to a static slice and its corresponding tests. No shared code paths, authentication logic, or data-handling routines are modified. The new test covers all provider fields and verifies both model names by value, matching the coverage pattern of TestLookupProvider_PreservesModelOrder for anthropic.

No files require special attention.

Important Files Changed

Filename Overview
internal/llm/providers.go New ollama-cloud provider block added with correct protocol, base URL, env var, and two models; follows established struct conventions exactly.
internal/llm/providers_test.go Order assertion updated to include ollama-cloud; new detail test covers Protocol, BaseURL, EnvVar, AuthHeader, and each model name individually — consistent with the existing pattern.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User selects provider] --> B{LookupProvider}
    B -->|"ollama-cloud"| C[ollama-cloud entry\nProtocol: openai\nBaseURL: https://ollama.com/v1\nEnvVar: OLLAMA_API_KEY]
    C --> D{Model chosen}
    D --> E["gpt-oss:120b"]
    D --> F["gpt-oss:20b"]
    E --> G[OpenAI-compatible request\nAuthorization: Bearer OLLAMA_API_KEY]
    F --> G
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[User selects provider] --> B{LookupProvider}
    B -->|"ollama-cloud"| C[ollama-cloud entry\nProtocol: openai\nBaseURL: https://ollama.com/v1\nEnvVar: OLLAMA_API_KEY]
    C --> D{Model chosen}
    D --> E["gpt-oss:120b"]
    D --> F["gpt-oss:20b"]
    E --> G[OpenAI-compatible request\nAuthorization: Bearer OLLAMA_API_KEY]
    F --> G
Loading

Reviews (2): Last reviewed commit: "test: strengthen ollama-cloud preset ass..." | Re-trigger Greptile

Comment thread internal/llm/providers_test.go Outdated
Add an ollama-cloud entry to the provider registry: OpenAI protocol,
base URL https://ollama.com/v1, env OLLAMA_API_KEY, models gpt-oss:120b
and gpt-oss:20b. Values match Ollama Cloud's OpenAI-compatible endpoint.
Tests cover provider order/count and per-field lookup details.

Closes alibaba#305
@chethanuk
chethanuk force-pushed the fix/issue-305-ollama-cloud-provider branch from bdb12ad to c1e3265 Compare July 6, 2026 11:08

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

chethanuk has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

…urce

Move the ollama-cloud provider block from the end of the registry slice to
immediately after minimax (before baidu-qianfan), per PR alibaba#310 review nit from
@lizhengfeng101. ListProviders() already sorts output, so this only affects
source layout, not runtime order; TestListProviders_Order stays green.

Kept Protocol: "openai" as a string literal to match every sibling entry in
the registry (minimax, baidu-qianfan, etc. all use the literal, not the
ProtocolOpenAIChatCompletions constant).
@codeant-ai

codeant-ai Bot commented Jul 15, 2026

Copy link
Copy Markdown

CodeAnt AI is running Incremental review

@codeant-ai

codeant-ai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:M This PR changes 30-99 lines, ignoring generated files and removed size:M This PR changes 30-99 lines, ignoring generated files labels Jul 15, 2026
@codeant-ai

codeant-ai Bot commented Jul 15, 2026

Copy link
Copy Markdown

CodeAnt AI Incremental review completed.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add built-in Ollama Cloud provider preset

1 participant