Skip to content

Add AI provider configurations for local and cloud models - #248

Merged
shunkakinoki merged 2 commits into
mainfrom
add-ai-provider-configs
Sep 30, 2025
Merged

Add AI provider configurations for local and cloud models#248
shunkakinoki merged 2 commits into
mainfrom
add-ai-provider-configs

Conversation

@shunkakinoki

Copy link
Copy Markdown
Owner

Summary

  • Added LM Studio local provider configuration with Qwen3 Coder 30B model
  • Added Ollama local provider configuration with gpt-oss-20b model
  • Enhanced OpenRouter provider with fallback configuration for Kimi K2 model
  • Updated opencode.jsonc with comprehensive AI provider setup

@coderabbitai

coderabbitai Bot commented Sep 30, 2025

Copy link
Copy Markdown

Warning

Rate limit exceeded

@shunkakinoki has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d08fd81 and f7700ce.

📒 Files selected for processing (1)
  • home-manager/modules/opencode/opencode.jsonc (1 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for multiple AI providers, including local/offline backends.
    • Introduced configurable routing to choose provider order without fallbacks.
    • Provided predefined model options with human-readable names.
    • Enabled automatic updates for the provider configuration.

Walkthrough

Adds provider configuration to opencode.jsonc with autoupdate enabled, defining lmstudio, ollama, and openrouter providers, their options (e.g., baseURL, provider order, allow_fallbacks), and model mappings. Establishes routing policy for openrouter with nested provider order.

Changes

Cohort / File(s) Summary
Opencode provider configuration
home-manager/modules/opencode/opencode.jsonc
Added autoupdate: true, introduced providers (lmstudio, ollama, openrouter) with options (baseURL, provider/order, allow_fallbacks) and model definitions; configured openrouter routing with ordered provider list and fallback disabled.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Opencode as Opencode Module
  participant Router as Provider Router
  participant LM as lmstudio
  participant OL as ollama
  participant OR as openrouter
  participant BaseTen as baseten (via openrouter)

  User->>Opencode: Request(model, prompt)
  Opencode->>Router: Select provider per config
  alt Models mapped to lmstudio
    Router->>LM: Invoke with baseURL
    LM-->>Opencode: Response
  else Models mapped to ollama
    Router->>OL: Invoke with baseURL
    OL-->>Opencode: Response
  else Routed via openrouter
    Router->>OR: Invoke (allow_fallbacks=false)
    OR->>BaseTen: Provider(order[0])
    BaseTen-->>OR: Response
    OR-->>Opencode: Response
  end
  Opencode-->>User: Result
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitched my ears at configs new,
Three burrows mapped, a tidy view—
LM hums, Olla_ma purrs,
Router chooses, never blurs.
No fallback hops, just ordered trails,
Autoupdate wind fills my sails.
Thump-thump! The pipeline never fails.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title accurately summarizes the main change by indicating the addition of AI provider configurations for both local and cloud models, aligning with the modifications in opencode.jsonc.
Description Check ✅ Passed The pull request description directly relates to the changeset by listing each provider configuration added and the updated file, matching the modifications in opencode.jsonc.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

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

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands the AI model provider options within the 'opencode' system by introducing configurations for local models via LM Studio and Ollama, alongside a refinement of the existing OpenRouter cloud provider. The changes aim to offer greater flexibility and control over which AI models can be utilized, catering to both local development and specific cloud-based model requirements.

Highlights

  • LM Studio Local Provider: Added configuration for LM Studio as a local AI provider, including the 'Qwen3 Coder 30B' model.
  • Ollama Local Provider: Integrated Ollama as another local AI provider, configured with the 'gpt-oss-20b' model.
  • OpenRouter Enhancement: Enhanced the OpenRouter provider configuration to include specific fallback settings for the 'Kimi K2' model, ensuring it uses 'baseten' and disallows fallbacks.
  • Centralized AI Provider Setup: Updated the 'opencode.jsonc' file to centralize and comprehensively define these new and enhanced AI provider configurations.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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

Copy link
Copy Markdown
Contributor

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 configurations for several AI providers, including local providers like LM Studio and Ollama, and enhances the OpenRouter configuration. The changes are well-structured. I've identified a couple of areas for improvement: one is a potential logical error in the OpenRouter configuration where allow_fallbacks is set to false despite the PR description suggesting otherwise, and the other is a minor inconsistency in the baseURL for local providers. Addressing these points will improve the correctness and consistency of the configuration.

"order": [
"baseten"
],
"allow_fallbacks": false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The pull request description states that this change enhances the OpenRouter provider with a fallback configuration. However, allow_fallbacks is set to false, which explicitly disables this feature. If the intent is to allow OpenRouter to use other providers for the kimi-k2 model when baseten is unavailable, this value should be set to true.

							"allow_fallbacks": true

"npm": "@ai-sdk/openai-compatible",
"name": "LM Studio (local)",
"options": {
"baseURL": "http://127.0.0.1:1234/v1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

For consistency with the ollama provider configuration (line 23), which uses localhost, consider using localhost here as well instead of 127.0.0.1. While both are functionally similar on most systems, using a consistent hostname for local services improves the readability and maintainability of the configuration file.

				"baseURL": "http://localhost:1234/v1"

coderabbitai[bot]
coderabbitai Bot previously requested changes Sep 30, 2025

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dab312b and d08fd81.

📒 Files selected for processing (1)
  • home-manager/modules/opencode/opencode.jsonc (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
home-manager/**

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Keep home-manager configurations under home-manager/

Files:

  • home-manager/modules/opencode/opencode.jsonc
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
  • GitHub Check: e2e-run (MacOS, macos-latest)
  • GitHub Check: docker-build-push (linux/amd64, -amd64, amd64)
  • GitHub Check: nix-nixos
  • GitHub Check: nix-darwin
  • GitHub Check: nix-linux
🔇 Additional comments (4)
home-manager/modules/opencode/opencode.jsonc (4)

5-5: Verify autoupdate behavior and implications.

The autoupdate flag is enabled but it's unclear what will be automatically updated (configuration, providers, models, or the application itself). Automatic updates could introduce breaking changes or unexpected behavior.

Consider documenting what this flag controls or verify that automatic updates align with your stability requirements.


7-18: LM Studio provider configuration looks good.

The local provider configuration is properly structured with appropriate localhost URL and model mapping. Ensure that LM Studio is running and accessible at http://127.0.0.1:1234/v1 when this configuration is used.


31-44: OpenRouter provider configuration differs from local providers.

The openrouter provider configuration lacks npm and options.baseURL fields present in the lmstudio and ollama providers. This is likely intentional if openrouter is a built-in provider, but please verify this is the expected structure.


34-40: Fallback disabled may impact reliability.

The allow_fallbacks: false setting for the kimi-k2 model means if the "baseten" provider is unavailable, the request will fail rather than trying alternative providers. This could reduce reliability.

Consider whether this is the desired behavior or if allowing fallbacks would provide better resilience.

Comment on lines +19 to +30
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"name": "Ollama (local)",
"options": {
"baseURL": "http://localhost:11434/v1"
},
"models": {
"openai/gpt-oss-20b": {
"name": "OpenAI: gpt-oss-20b"
}
}
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Ollama provider configuration is correct, but verify model naming.

The Ollama configuration is properly structured. However, the model identifier "openai/gpt-oss-20b" with display name "OpenAI: gpt-oss-20b" may be confusing since "gpt-oss-20b" doesn't appear to be an official OpenAI model. Verify that:

  1. The model identifier matches what Ollama expects
  2. The "OpenAI:" prefix in the display name accurately represents the model's origin

🏁 Script executed:

#!/bin/bash
# Description: Search for documentation or references to gpt-oss-20b model in the codebase
# to verify if this is an established naming convention

rg -i "gpt-oss-20b" -C 3

Length of output: 924


🌐 Web query:

Does Ollama support a model named "gpt-oss-20b" and what is its correct model identifier?

💡 Result:

Yes. Ollama supports OpenAI's 20B gpt-oss model. The correct Ollama model identifier is gpt-oss:20b (often shown as "gpt-oss-20b" in prose, but use gpt-oss:20b in the Ollama CLI). [1][2]

Sources:
[1] Ollama model page for gpt-oss:20b.
[2] Ollama blog / docs showing usage (examples: ollama run gpt-oss:20b).


Use the proper Ollama model naming

  • In home-manager/modules/opencode/opencode.jsonc (lines 19–30), change the model key from
    "openai/gpt-oss-20b"
    to
    "gpt-oss:20b".
  • Update the display name from
    "OpenAI: gpt-oss-20b"
    to something like
    "Ollama: gpt-oss:20b".
🤖 Prompt for AI Agents
In home-manager/modules/opencode/opencode.jsonc around lines 19 to 30 the Ollama
model is using the incorrect key and display name; change the model key from
"openai/gpt-oss-20b" to "gpt-oss:20b" and update the display name from "OpenAI:
gpt-oss-20b" to a vendor-appropriate label such as "Ollama: gpt-oss:20b" so the
configuration uses the proper Ollama model identifier and clear naming.

@shunkakinoki
shunkakinoki enabled auto-merge (squash) September 30, 2025 14:25
@shunkakinoki
shunkakinoki merged commit 3ab9937 into main Sep 30, 2025
18 checks passed
@shunkakinoki
shunkakinoki deleted the add-ai-provider-configs branch September 30, 2025 15:20
@shunkakinoki
shunkakinoki restored the add-ai-provider-configs branch September 30, 2025 15:27
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.

1 participant