Skip to content

feat(provider): add cheapaimodel - #2476

Merged
zerob13 merged 1 commit into
ThinkInAIXYZ:devfrom
nicho810:feat/provider-cheapaimodel
Oct 29, 2026
Merged

zerob13 merged 1 commit into
ThinkInAIXYZ:devfrom
nicho810:feat/provider-cheapaimodel

Conversation

@nicho810

@nicho810 nicho810 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Adds cheapaimodel as a built-in, disabled-by-default OpenAI-compatible provider. cheapaimodel (https://cheapaimodel.ai) is a pay-per-token API gateway for open-weight models (DeepSeek, GLM, Kimi) plus Grok, at https://api.cheapaimodel.ai/v1 (POST /chat/completions, GET /models). I work on cheapaimodel.

It needs no special provider class. The registry entry is OPENAI_BASE with credentialStrategy: 'api-key' and embeddingStrategy: 'none', so it resolves to the existing openai-compatible runtime with modelSource: 'openai' and checkStrategy: 'fetch-models', the same shape as AtmoRouter (#2464). GET /v1/models requires the API key, which fetch-models sends.

Files changed

File Change
src/main/provider/defaults.ts DEFAULT_PROVIDERS entry (enable: false), after CloudGPU
src/main/provider/providerRegistry.ts PROVIDER_ID_REGISTRY definition
src/renderer/src/assets/llm-icons/cheapaimodel.svg new icon (our own mark, same as our favicon)
src/renderer/src/components/icons/modelIconRegistry.ts icon import + modelIcons key
README.md, README.zh.md, README.jp.md provider grid cell after CloudGPU
test/main/provider/defaultProviders.test.ts asserts the defaults entry
test/main/provider/basicApiKeyProviders.test.ts asserts the resolved definition

Insertions only. resources/model-db/providers.json is not touched, because the provider uses live /models discovery.

Website links point at browsable pages; all four returned 200 on 2026-10-28:

field URL
official https://cheapaimodel.ai/?utm_source=deepchat
apiKey https://console.cheapaimodel.ai/keys?utm_source=deepchat
docs https://cheapaimodel.ai/docs?utm_source=deepchat
models https://cheapaimodel.ai/models?utm_source=deepchat

Testing

Run locally (macOS, pnpm 10.34.5, dependencies installed with --frozen-lockfile --ignore-scripts):

Command Result
pnpm vitest run --config vitest.config.ts test/main/provider 75 files, 1044 tests passed
pnpm vitest run --config vitest.config.renderer.ts test/renderer/components/ModelIcon.test.ts 8 passed
pnpm run format:check clean
pnpm run lint clean
pnpm run typecheck:node / typecheck:web clean
pnpm run i18n clean, no new keys
pnpm run icons:check clean

Not run: pnpm run dev and pnpm run build (no Electron binary with --ignore-scripts).

Live test

Run on 2026-10-28 (UTC) against https://api.cheapaimodel.ai/v1 with a real cheapaimodel key. The key is not included in this PR or its logs.

Through DeepChat's own provider code: a temporary vitest file, not committed, built AiSdkProvider from the new DEFAULT_PROVIDERS entry, with the same Electron, logger, proxy and providerDbLoader mocks as basicApiKeyProviders.test.ts, but with the AI SDK not mocked, so the calls went over the network.

  • check() (the fetch-models strategy) returned isOk: true in 1.40s. With a fake key it returned isOk: false with Invalid token.
  • fetchModels() returned all 5 models in 0.87s, mapped with providerId: 'cheapaimodel'.

Prompt Reply with exactly: pong, temperature 0.2 (1 for kimi-k3, see below), max tokens 256:

Model completions() coreStream() (total / first text) Stream events Response
deepseek-v4-1-flash 2.59s 2.46s / 2.46s reasoning, text, usage, stop pong
glm-5.3 2.64s 2.64s / 2.58s reasoning, text, usage, stop pong
glm-5.3-flash 1.49s 1.75s / 1.58s reasoning, text, usage, stop pong
kimi-k3 3.64s 2.47s / 2.47s reasoning, text, usage, stop pong
grok-4.7 2.34s 3.42s / 3.31s text, usage, stop pong

kimi-k3 only accepts its own sampling values (temperature 0.6 or 1; 0.2 returns a 400), the same rule as on Moonshot's API, so users need to set its temperature in the model settings.

Summary by CodeRabbit

  • New Features
    • Added CheapAIModel to the supported model provider list and provider settings, with its website and setup links.
    • CheapAIModel uses an OpenAI-compatible API and requires an API key. It is disabled by default.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 970916aa-d4eb-4d05-ba28-28ea2205f8bd
Commits

Reviewing files that changed from the base of the PR and between b62eb0d and 24899ba.

Files ignored due to path filters: 1
  • src/renderer/src/assets/llm-icons/cheapaimodel.svg is excluded by !**/*.svg
Files selected for processing: 8
  • README.jp.md
  • README.md
  • README.zh.md
  • src/main/provider/defaults.ts
  • src/main/provider/providerRegistry.ts
  • src/renderer/src/components/icons/modelIconRegistry.ts
  • test/main/provider/basicApiKeyProviders.test.ts
  • test/main/provider/defaultProviders.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The change adds cheapaimodel as a disabled, OpenAI-compatible provider with API-key credentials. It adds the provider’s icon and lists it in the English, Japanese, and Chinese README files. Tests cover the provider definition and default configuration.

Changes: cheapaimodel provider support

Layer / File(s) Summary
Provider configuration and tests
src/main/provider/defaults.ts, src/main/provider/providerRegistry.ts, test/main/provider/basicApiKeyProviders.test.ts, test/main/provider/defaultProviders.test.ts
The provider defaults and registry add cheapaimodel as an OpenAI-compatible provider with API-key credentials and embedding support disabled. Tests check the provider definition and default configuration.
Provider icon and README entries
src/renderer/src/components/icons/modelIconRegistry.ts, README.md, README.jp.md, README.zh.md
The icon registry maps cheapaimodel to its icon. The README files add a cheapaimodel provider entry.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: zerob13

Merge Risk: Minimal · up to 24899

The cheapaimodel provider addition is consistent across configuration, runtime registration, icon assets, and localized documentation.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding cheapaimodel as a provider.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 5 files. (3 skipped: 3 unsupported.)

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

⚠️ This pull request has been flagged as potential spam (promotional) by CodeRabbit slop detection and should be reviewed carefully.

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.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verdict: approve

This adds cheapaimodel as a disabled, OpenAI-compatible built-in provider. The change is registration only: one DEFAULT_PROVIDERS entry, one PROVIDER_ID_REGISTRY entry, an icon, three README cells and two tests. There is no new provider class and no change to shared provider behavior. The entry ships with enable: false, so nothing changes for current users until someone turns it on. No breaking change.

What I checked

  • Shape: the same as AtmoRouter (#2464). OPENAI_BASE plus credentialStrategy: 'api-key' and embeddingStrategy: 'none' resolves to openai-compatible / modelSource: 'openai' / checkStrategy: 'fetch-models', which is what the new test asserts.
  • The connection check really validates a key. GET https://api.cheapaimodel.ai/v1/models returns 401 without a key today, so fetch-models cannot pass with a wrong key. This is the difference from apimodels.app (#2454), where the model list was public and a bad key still passed.
  • Icon: a 336-byte static SVG with no script. It is registered in modelIcons and deliberately left out of monoIconUrls, the same as atmorouter.svg, which also has its own dark background. Dark-mode inversion is skipped, which is what you want here.
  • Links: cheapaimodel.ai, console.cheapaimodel.ai/keys, /docs and /models all return 200.
  • Tests: test/main/provider/defaultProviders.test.ts and basicApiKeyProviders.test.ts → 85 passed locally. oxfmt --check, oxlint and icons:check are clean on the changed files.
  • CI: both workflow runs were waiting for first-time-contributor approval; I approved them. PR Check and Package Check are now green at 24899ba9.

Minor notes, not blocking

  1. modelSource: 'openai' lists every id the gateway returns. Today that is five chat models, so nothing is mislabeled. If cheapaimodel later publishes image, audio or embedding ids, they will show up in the picker as chat models — the failure mode reported in #2454. A chat-only filter can wait until the catalog actually contains those.
  2. The README provider table's last row now has seven cells while the earlier rows have four or five. It renders, but that row is wider than the rest. Optional cleanup.
  3. Capability flags (reasoning, tools, vision) resolve through the global model-id fallback in src/main/provider/modelCapabilities.ts (getModelMatch → findModelAcrossProvidersMatch), because cheapaimodel has no entry in resources/model-db/providers.json. All five ids in your live test already exist there under other providers, so the flags come from those entries. AtmoRouter works the same way. Nothing to change; this is only why the provider behaves correctly without a catalog entry.

Sources

  • Reviewed commit: 24899ba998998acdd78dd383cde48805e1de1a54
  • Provider defaults: src/main/provider/defaults.ts:682
  • Registry: src/main/provider/providerRegistry.ts:336
  • Model URL and default catalog mapping: src/main/provider/providers/aiSdkProvider.ts:756-769, 1080-1105
  • Capability fallback: src/main/provider/modelCapabilities.ts:529-590

@zerob13
zerob13 merged commit 48c5460 into ThinkInAIXYZ:dev Oct 29, 2026
12 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.

2 participants