Skip to content

feat(web): add Runcrate as an LLM provider - #342

Open
heydryft wants to merge 1 commit into
AmoyLab:mainfrom
heydryft:feat/runcrate-provider
Open

heydryft wants to merge 1 commit into
AmoyLab:mainfrom
heydryft:feat/runcrate-provider

Conversation

@heydryft

@heydryft heydryft commented Oct 28, 2026 •

Copy link
Copy Markdown

Summary

Adds Runcrate to the built-in LLM provider list of the web console. Runcrate serves an OpenAI-compatible inference API at https://api.runcrate.ai/v1 (/chat/completions with streaming and tools, /models), so the provider uses the existing OpenAI-compatible request path (sdkType: 'openai') and needs no new client code.

Keys are created on the API keys page and look like rc_live_.... The full model list is on the pricing page.

Changes

  • web/src/config/llm-providers/runcrate.ts: provider card (OpenAI SDK type, model fetcher on, default base URL placeholder https://api.runcrate.ai/v1, check model deepseek-ai/DeepSeek-V4.1-Flash), registered in llm-providers/index.ts.
  • web/src/config/ai-models/runcrate.ts: six chat models with context window, max output, tool, reasoning and vision flags and pricing in USD per 1M tokens, all read from GET https://api.runcrate.ai/v1/models: DeepSeek V4.1 Flash, GLM 5.3 Flash, GLM 5.3, Qwen3.8 Flash, gpt-oss 120B, Kimi K2.6. Registered in ai-models/index.ts.
  • web/src/config/llm-providers-adapter.ts: default base URL and check model.
  • web/public/icons/providers/runcrate.svg, ProviderIcons.tsx, providerMappings.ts: provider icon.
  • web/src/i18n/locales/{en,zh}/translation.json: provider description.

Testing

Run in web/:

  • pnpm exec tsc: exit 0, no errors.
  • pnpm exec eslint <the 7 touched .ts/.tsx files> --max-warnings 0: exit 0.
  • pnpm build (tsc && vite build): built, exit 0.
  • Live check through the console's own chat code: a throwaway script (not committed) run with bun called llmChatService.sendMessage for provider id runcrate with a real key and no base URL override, so the URL came from getDefaultBaseURL('runcrate'). getModelsByProvider('runcrate') returned the six model ids above. Each request went to https://api.runcrate.ai/v1/chat/completions with stream: true:
    • deepseek-ai/DeepSeek-V4.1-Flash: stream completed, reply "pong"
    • zai-org/GLM-5.3-Flash: stream completed, reply "pong"

The UI was not opened in a browser.

This PR was prepared with AI assistance: an AI coding agent wrote the change and ran the checks above.

Disclosure: I work on Runcrate.

Summary by Sourcery

Integrate Runcrate into the web console as a fully discoverable OpenAI-compatible LLM provider.

New Features:

  • Add Runcrate as a built-in OpenAI-compatible LLM provider with configurable API access and model discovery.
  • Expose six Runcrate chat models with capabilities, context limits, and pricing metadata.
  • Add Runcrate branding and localized provider descriptions to the web console.

Tests:

  • Validate the Runcrate integration with TypeScript, ESLint, production build, and live streaming chat checks.

@sourcery-ai

sourcery-ai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR integrates Runcrate without new client code by routing it through the existing OpenAI-compatible LLM path, configuring its default endpoint and check model, registering six dynamically discoverable chat models with metadata, and adding localized provider presentation and branding. Review should focus on the correctness and durability of the externally sourced model capabilities/pricing, provider registration consistency, and UI behavior; the author reports typecheck, lint, build, and live streaming checks, but no browser-level UI validation.

Sequence diagram for Runcrate model discovery and streaming chat

sequenceDiagram
    participant Console as WebConsole
    participant Service as llmChatService
    participant Adapter as ProviderAdapter
    participant Runcrate as RuncrateAPI

    Console->>Service: getModelsByProvider(runcrate)
    Service->>Runcrate: GET /v1/models
    Runcrate-->>Service: Six model definitions
    Service-->>Console: Runcrate model list

    Console->>Service: sendMessage(runcrate)
    Service->>Adapter: getDefaultBaseURL(runcrate)
    Adapter-->>Service: https://api.runcrate.ai/v1
    Service->>Runcrate: POST /v1/chat/completions with stream true
    Runcrate-->>Service: Streaming completion
    Service-->>Console: Streamed assistant response
Loading

File-Level Changes

Change Details Files
Adds Runcrate as a built-in OpenAI-compatible provider with default endpoint and health-check model configuration.
  • Defines the provider card with OpenAI SDK routing, model discovery, proxy settings, URLs, and localized descriptions.
  • Registers the provider across the default provider, model, and export lists.
  • Configures the default API base URL and connectivity-check model.
web/src/config/llm-providers/runcrate.ts
web/src/config/llm-providers/index.ts
web/src/config/llm-providers-adapter.ts
web/src/i18n/locales/en/translation.json
web/src/i18n/locales/zh/translation.json
Adds six enabled Runcrate chat models with capability metadata and token pricing.
  • Defines model IDs, display names, context/output limits, reasoning/tool/vision capabilities, and USD input/output pricing.
  • Registers the model collection for provider lookup, global model lists, default models, and exports.
  • Review that the provider's advertised model IDs and metadata remain aligned with the Runcrate /models response and pricing.
web/src/config/ai-models/runcrate.ts
web/src/config/ai-models/index.ts
Adds Runcrate branding to provider icon resolution.
  • Adds the SVG asset and icon component export.
  • Maps the Runcrate provider keyword to its icon.
web/public/icons/providers/runcrate.svg
web/src/components/ProviderIcon/ProviderIcons.tsx
web/src/components/ProviderIcon/providerMappings.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've found 3 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="web/src/config/ai-models/runcrate.ts" line_range="18" />
<code_context>
+    id: 'deepseek-ai/DeepSeek-V4.1-Flash',
+    maxOutput: 1_048_576,
+    pricing: {
+      input: 0.147,
+      output: 0.441,
+    },
</code_context>
<issue_to_address>
**Runcrate prices appear 1,000× higher**

When runcrate model cards are converted through `getProviderModels`, `convertToLLMModel` marks prices below 1 as `per_1k_tokens` even though Runcrate supplies USD per 1M tokens, so callers see costs 1,000 times too high.

Update the conversion to preserve Runcrate’s per-million-token pricing unit.

Also at `web/src/config/ai-models/runcrate.ts:35`, `web/src/config/ai-models/runcrate.ts:51`, `web/src/config/ai-models/runcrate.ts:67`, `web/src/config/ai-models/runcrate.ts:83`, `web/src/config/ai-models/runcrate.ts:100`.
</issue_to_address>

### Comment 2
<location path="web/src/config/llm-providers/runcrate.ts" line_range="5" />
<code_context>
+
+// ref: https://www.runcrate.ai/inference/pricing
+const Runcrate: ModelProviderCard = {
+  chatModels: [],
+  checkModel: 'deepseek-ai/DeepSeek-V4.1-Flash',
+  description: 'Runcrate 提供兼容 OpenAI 的推理 API,可调用 DeepSeek、GLM、Qwen、Kimi、gpt-oss 等开放权重模型。',
</code_context>
<issue_to_address>
**Built-in model metadata stays hidden**

When a user views Runcrate’s built-in model list rather than fetching models from the API, the provider card supplies no chat models, so the built-in provider list cannot display the six models’ context, capability, and pricing metadata; registering those cards in the separate AI-model catalog does not populate this provider card.

Populate the provider card’s `chatModels` from the Runcrate catalog, or connect the catalog to the UI that presents built-in models.

Also at `web/src/config/ai-models/index.ts:99`.
</issue_to_address>

### Comment 3
<location path="web/src/config/llm-providers/runcrate.ts" line_range="7" />
<code_context>
+const Runcrate: ModelProviderCard = {
+  chatModels: [],
+  checkModel: 'deepseek-ai/DeepSeek-V4.1-Flash',
+  description: 'Runcrate 提供兼容 OpenAI 的推理 API,可调用 DeepSeek、GLM、Qwen、Kimi、gpt-oss 等开放权重模型。',
+  disableBrowserRequest: true,
+  id: 'runcrate',
</code_context>
<issue_to_address>
**English users see Chinese description**

`Runcrate.description` is hard-coded in Chinese and is passed through directly by `convertLobeProviderToTemplate`; the added locale entries do not replace it because `getProviderDescription` has no call sites. English users therefore see a Chinese provider description.

Resolve the provider description from the active locale when building or rendering the provider entry instead of storing a single Chinese string.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread web/src/config/ai-models/runcrate.ts Resolved
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