Skip to content

Add custom provider#50

Merged
madebyaris merged 2 commits intodevfrom
add-custom-provider
Apr 14, 2026
Merged

Add custom provider#50
madebyaris merged 2 commits intodevfrom
add-custom-provider

Conversation

@madebyaris
Copy link
Copy Markdown
Owner

@madebyaris madebyaris commented Apr 14, 2026

Summary by cubic

Adds a Custom provider so you can connect to any OpenAI- or Anthropic-compatible endpoint. Includes a TUI wizard, /custom command, config/env support, key validation, and docs.

  • New Features

    • New provider: Custom (OpenAI- or Anthropic-compatible) with model/context limits and model catalog support.
    • CLI: /custom <openai|anthropic> <base-url> [api-key] [model]; /provider custom now supported.
    • TUI: Provider picker shows “Custom” and “Add custom provider…” wizard; palette entry added; contextual help with keybindings.
    • Config: new [provider.custom] block (compatibility, base_url, model, temperature, api_key_env); env vars CUSTOM_PROVIDER_API_KEY, CUSTOM_PROVIDER_BASE_URL, CUSTOM_PROVIDER_MODEL, CUSTOM_PROVIDER_COMPATIBILITY.
    • Validation: API key checks for Custom endpoints (OpenAI or Anthropic wire protocol).
    • Docs/README updated; tests added/updated across CLI, common, core, and runtime.
  • Migration

    • TUI: run /provider → “Add custom provider…” and follow the steps.
    • CLI: run /custom openai https://your-endpoint key model (or anthropic).
    • Config (optional):
      • [provider] default = "custom"
      • [provider.custom] compatibility = "openai" | "anthropic"; base_url = "..."; model = "...".
      • Or set env vars: CUSTOM_PROVIDER_API_KEY, CUSTOM_PROVIDER_BASE_URL, CUSTOM_PROVIDER_MODEL, CUSTOM_PROVIDER_COMPATIBILITY.

Written for commit 97cc35e. Summary will update on new commits.

- 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.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

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.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Apr 14, 2026

Choose a reason for hiding this comment

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

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.
Fix with Cubic

|| m.contains("claude-3")
|| m.contains("claude-4")
|| m.contains("gemini")
|| m.contains("vision")
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot Apr 14, 2026

Choose a reason for hiding this comment

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

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")
Fix with Cubic

@madebyaris madebyaris merged commit 080d530 into dev Apr 14, 2026
3 checks passed
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