Add custom provider#50
Merged
madebyaris merged 2 commits intodevfrom Apr 14, 2026
Merged
Conversation
- Enhanced the CLI to allow users to configure custom endpoints for OpenAI and Anthropic-compatible services via the `/custom` command. - Updated the README to include instructions for setting up custom providers and added environment variable support for custom API keys, base URLs, and models. - Implemented a TUI wizard for easier configuration of custom providers. - Modified the provider picker to include the option for custom providers and updated related documentation to reflect these changes. - Added validation for custom provider API keys and base URLs during setup and usage.
- Refactored conditional checks for custom provider base URL in the REPL implementation to enhance code clarity and maintainability. - Updated the TUI to streamline the display of custom provider options and improve user experience during provider setup. - Simplified the onboarding process by refining the handling of custom provider validation and error messages.
There was a problem hiding this comment.
2 issues found across 19 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/plans/custom-provider-compatibility.md">
<violation number="1" location="docs/plans/custom-provider-compatibility.md:5">
P2: This plan describes `Custom` provider support as a new feature even though the repo docs already show it exists; reframe it as extending/refining existing behavior to avoid duplicate implementation work.</violation>
</file>
<file name="crates/common/src/model_caps.rs">
<violation number="1" location="crates/common/src/model_caps.rs:45">
P2: `ProviderKind::Custom` misses the `qwen-vl` multimodal heuristic, causing image-capable Qwen-VL models to be misclassified as non-vision.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
|
||
| ## Goal | ||
|
|
||
| Add a configurable `Custom` provider so users can route `nca` to arbitrary endpoints and choose whether the endpoint speaks an OpenAI-compatible or Anthropic-compatible API. |
There was a problem hiding this comment.
P2: This plan describes Custom provider support as a new feature even though the repo docs already show it exists; reframe it as extending/refining existing behavior to avoid duplicate implementation work.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/plans/custom-provider-compatibility.md, line 5:
<comment>This plan describes `Custom` provider support as a new feature even though the repo docs already show it exists; reframe it as extending/refining existing behavior to avoid duplicate implementation work.</comment>
<file context>
@@ -0,0 +1,21 @@
+
+## Goal
+
+Add a configurable `Custom` provider so users can route `nca` to arbitrary endpoints and choose whether the endpoint speaks an OpenAI-compatible or Anthropic-compatible API.
+
+## Implementation
</file context>
Suggested change
| Add a configurable `Custom` provider so users can route `nca` to arbitrary endpoints and choose whether the endpoint speaks an OpenAI-compatible or Anthropic-compatible API. | |
| Extend the existing `Custom` provider so users can route `nca` to arbitrary endpoints with explicit OpenAI-compatible or Anthropic-compatible behavior. |
| || m.contains("claude-3") | ||
| || m.contains("claude-4") | ||
| || m.contains("gemini") | ||
| || m.contains("vision") |
There was a problem hiding this comment.
P2: ProviderKind::Custom misses the qwen-vl multimodal heuristic, causing image-capable Qwen-VL models to be misclassified as non-vision.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/common/src/model_caps.rs, line 45:
<comment>`ProviderKind::Custom` misses the `qwen-vl` multimodal heuristic, causing image-capable Qwen-VL models to be misclassified as non-vision.</comment>
<file context>
@@ -35,6 +35,15 @@ pub fn model_accepts_native_images(kind: ProviderKind, model: &str) -> bool {
+ || m.contains("claude-3")
+ || m.contains("claude-4")
+ || m.contains("gemini")
+ || m.contains("vision")
+ }
}
</file context>
Suggested change
| || m.contains("vision") | |
| || m.contains("qwen-vl") | |
| || m.contains("vision") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by cubic
Adds a Custom provider so you can connect to any OpenAI- or Anthropic-compatible endpoint. Includes a TUI wizard,
/customcommand, config/env support, key validation, and docs.New Features
/custom <openai|anthropic> <base-url> [api-key] [model];/provider customnow supported.[provider.custom]block (compatibility,base_url,model,temperature,api_key_env); env varsCUSTOM_PROVIDER_API_KEY,CUSTOM_PROVIDER_BASE_URL,CUSTOM_PROVIDER_MODEL,CUSTOM_PROVIDER_COMPATIBILITY.Migration
/provider→ “Add custom provider…” and follow the steps./custom openai https://your-endpoint key model(oranthropic).[provider] default = "custom"[provider.custom] compatibility = "openai" | "anthropic"; base_url = "..."; model = "...".CUSTOM_PROVIDER_API_KEY,CUSTOM_PROVIDER_BASE_URL,CUSTOM_PROVIDER_MODEL,CUSTOM_PROVIDER_COMPATIBILITY.Written for commit 97cc35e. Summary will update on new commits.