Skip to content

feat: add first-class Cheaper Inference provider template - #1364

Merged
akramcodez merged 4 commits into
Nano-Collective:mainfrom
aiapienthusiast:feat/cheaperinference-provider
Sep 22, 2026
Merged

akramcodez merged 4 commits into
Nano-Collective:mainfrom
aiapienthusiast:feat/cheaperinference-provider

Conversation

@aiapienthusiast

@aiapienthusiast aiapienthusiast commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds Cheaper Inference (https://api.cheaperinference.com/v1) as a first-class provider template in the setup wizard. It also adds a documentation page.

Cheaper Inference is an OpenAI-compatible gateway. One endpoint and one API key reach models from several upstream providers. It speaks the OpenAI Chat Completions API, so it needs no new SDK path. It flows through the existing generic openai-compatible provider. This change is therefore a wizard template, a docs page and tests.

The change follows #874 (feat: add first-class OrcaRouter provider template), which added OrcaRouter in the same way.

Files changed

File Why
source/wizards/templates/provider-templates.ts New apiKeyTemplate entry: id cheaper-inference, base URL pre-filled, default model claude-sonnet-5.
source/wizards/templates/provider-templates.spec.ts Two tests that mirror the Requesty and OrcaRouter pair: base URL, default model, comma-separated model parsing, default provider name.
docs/configuration/providers/cheaper-inference.md New provider page, listed under Cloud Providers (OpenAI-Compatible).
docs/configuration/providers/index.md Docs nav entry.
.changeset/add-cheaper-inference-provider.md Changeset (minor), because the change is user-facing.

Not included

#874 also added source/ai-sdk-client/providers/orcarouter.ts and a provider-factory.ts branch that attaches HTTP-Referer and X-Title app-attribution headers.

Those headers are the OpenRouter convention. No documentation shows that Cheaper Inference reads them, so this PR does not assert that it does. If it does, the predicate file and the factory branch are a small follow-up.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Docs-only or internal chores need no changeset (or run pnpm changeset --empty to note that intentionally).

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

pnpm test:all did not run to completion. These checks ran on b2ef8f01d507b88c6b67fb83a52505ef39bb87f5:

  • pnpm test:types — pass
  • pnpm test:types:vscode — pass
  • pnpm test:lint — pass, clean
  • pnpm test:knip — pass, hints only
  • pnpm test:ava source/wizards/templates/provider-templates.spec.ts — 44 passed, with the two new cases
  • pnpm test:format — one pre-existing error in source/tools/file-ops/write-file.tsx (import ordering). It is present on the base commit. No file in this PR is flagged.
  • pnpm test:ava (whole suite) — did not finish. The sandbox filesystem filled up and the run was killed. Every test it reported passed, and it printed no failure, but there is no exit code. This is therefore not a pass.
  • pnpm test:audit and pnpm test:security — not run

The two new tests cover template construction, which has no error path. The third box stays unticked.

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Nothing ran through nanocoder itself, so no box is ticked.

A direct check with a real key confirmed the endpoint. GET /v1/models returns the catalogue. A plain chat completion and an SSE stream both answer. The base URL and the key header in this template are the working ones.

A reviewer should confirm the path through nanocoder: the wizard writes the config it should, and a chat completion succeeds from the app.

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md)

No logging was added. The change is a declarative template entry and docs, with no new runtime code path to log from.

The wizard template fills in the base URL for the gateway so only an API key
and a model are needed, and the two tests are the pair the OrcaRouter template
carries: the built config and the default provider name and model.
Minor bump, as every other provider-template addition carries.
A provider page in the shape of the other gateway pages, plus its line in the
provider index.
@github-actions

Copy link
Copy Markdown
Contributor

nc-review: comments — 2 nits

@aiapienthusiast — a few things worth a look, none blocking.

Adds Cheaper Inference as a first-class provider template by appending a single apiKeyTemplate({...}) entry to PROVIDER_TEMPLATES, plus a docs page, a sidebar entry, a changeset, and two tests that mirror the existing OrcaRouter pair. The template definition, tests, and changeset are all well-formed and follow the established patterns; the change is small, justified, and ready to merge modulo one duplicate sidebar_order nit.

⚪ nit · design · docs/configuration/providers/cheaper-inference.md:4

sidebar_order: 19 duplicates docs/configuration/providers/orcarouter.md (and is the same value already shared by groq.md and together.md). Sidebar ordering is a static user-facing sort, not enforced to be unique, but most other provider docs pick distinct numbers; picking an unused value (e.g. 26 or later) would slot the new page cleanly into the existing nav.

⚪ nit · tests · source/wizards/templates/provider-templates.spec.ts:595

The two new tests assert behaviour that the surrounding apiKeyTemplate(...) helper already makes uniform across every consumer (OrcaRouter, Requesty, Atlas Cloud, Together, etc.), so they catch template-id typo or removal but not anything else. A targeted test of the fields the template actually exposes (no apiKeyPrompt, no sdkProvider, default model claude-sonnet-5) would be marginally stronger, but the current shape mirrors the OrcaRouter pair exactly and that is fine — worth noting, not worth blocking.


🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional

Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with /re-review.

@github-actions github-actions Bot added the agent:comments nc-review left non-blocking findings label Sep 17, 2026
Review nit: 19 was already used by orcarouter.md, groq.md and together.md. 26 is unused, so the page
slots in after the existing entries instead of tying with three others.
@aiapienthusiast

Copy link
Copy Markdown
Contributor Author

Both nits looked at.

sidebar_order is now 26, which is unused - 19 was shared with orcarouter.md, groq.md and together.md, so the page slots in after the existing entries instead of tying with three others.

On the tests: agreed that they mostly exercise apiKeyTemplate(...), which is uniform across its consumers. I left them mirroring the OrcaRouter pair on purpose - if this provider ever needs to stop using that helper, the pair is what fails first, and a test that asserts the helper's own output would duplicate the helper's tests. Happy to add field-level assertions (no apiKeyPrompt, no sdkProvider, default model claude-sonnet-5) if you would rather have them here than in the template suite.

@akramcodez
akramcodez merged commit 0d71518 into Nano-Collective:main Sep 22, 2026
16 checks passed
@akramcodez

Copy link
Copy Markdown
Member

Thanks for the PR @aiapienthusiast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:comments nc-review left non-blocking findings area:docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants