Skip to content

feat(providers): add Lyceum pay-per-use provider + credit quota tracking - #12474

Merged
diegosouzapw merged 3 commits into
diegosouzapw:release/v3.8.51from
PixmaNts:feat/lyceum-provider
Sep 22, 2026
Merged

diegosouzapw merged 3 commits into
diegosouzapw:release/v3.8.51from
PixmaNts:feat/lyceum-provider

Conversation

@PixmaNts

@PixmaNts PixmaNts commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Lyceum (lyceum.technology) as a first-class OpenAI-compatible, usage-based (pay-per-token, like OpenRouter) inference provider, with a credit-balance quota fetcher.

Lyceum exposes an OpenAI-compatible surface at https://api.lyceum.technology/openai/v1 (/chat/completions, /embeddings, /models) authenticated with a lk_… Bearer key, and a documented credit-balance endpoint for pay-per-use tracking.

What it adds

  • Registry entry (registry/lyceum): buildOpenAiCompatibleRegistryEntry with base https://api.lyceum.technology/openai/v1/chat/completions, live /models discovery, passthroughModels. The generic DefaultExecutor handles chat/embeddings — no custom executor or translator needed.
  • API-key metadata card + AGGREGATOR_PROVIDER_IDS + PROVIDER_ENDPOINTS.
  • Credit quota fetcher (lyceumQuotaFetcher.ts): reads GET /api/v2/external/billing/credits (available_credits / used_credits / remaining_credits), surfaced as a credits window in Dashboard › Limits and quota-aware preflight. Registered via quotaTrackersBatch (keeps chat.ts frozen). Fails open on auth/network/shape errors.
  • Usage leaf + dispatcher case + USAGE_FETCHER_PROVIDERS / USAGE_SUPPORTED_PROVIDERS / PROVIDER_LIMITS_APIKEY_PROVIDERS + dashboard label/order.
  • Tests: registry-shape assertions (free-tier-providers-wave1-c) + a 16-case quota fetcher/usage suite (parser, Bearer auth, 401/403 & network fail-open, cache TTL, exhaustion, preflight proceed/block, usage rows).
  • Docs: changelog fragment, regenerated PROVIDER_REFERENCE.md, provider count 354 → 355 across README / AGENTS / llm.txt (+42 i18n mirrors) / SVGs, and an in-convention file-size-baseline bump for the gateways.ts catalog entry.

Verified live

Confirmed against the real Lyceum API before implementing:

  • GET /openai/v1/models → OpenAI {object:"list", data:[{id, owned_by}]} shape.
  • POST /openai/v1/chat/completions (lyceum/simple) → HTTP 200, standard OpenAI response + usage.
  • GET /api/v2/external/billing/credits → {available_credits, used_credits, remaining_credits, monthly_free_credits, purchased_credits, …} with a lk_ key.

Testing

  • tests/unit/lyceum-quota-fetcher.test.ts (16/16) + free-tier-providers-wave1-c lyceum assertions (3/3).
  • Regression: free-tier-providers-phase3-integration (10/10), -wave5-integration (4/4), generic-quota-fetcher (10/10), provider-limits-ui (25/25).
  • npm run typecheck:core, check:provider-consistency, check:file-size, check:docs-all all clean; new files lint-clean.

@diegosouzapw

Copy link
Copy Markdown
Owner

The Lyceum integration itself is solid — 16/16 quota-fetcher tests pass locally, the
fail-open pattern matches the existing OpenRouter/Firecrawl fetchers exactly. One thing
though: your description mentions the provider-count bump across README/AGENTS/llm.txt and
a regenerated PROVIDER_REFERENCE.md, but none of those files are actually in the diff —
that's very likely why Docs Gates / Fast Quality Gates are red on your PR. Could you rerun
gen-provider-reference.ts and push the doc files? Also heads-up: #12462 touches the same
line-area of quotaTrackersBatch.ts (adding its own tracker registration) — whichever of
you two lands second will hit a trivial 2-line conflict there.

@PixmaNts
PixmaNts force-pushed the feat/lyceum-provider branch 2 times, most recently from 7773ee0 to 1bb933b Compare September 20, 2026 12:39
@PixmaNts

Copy link
Copy Markdown
Contributor Author

Rebased onto release/v3.8.51 after #12462 merged, and addressed the review:

  • Ran gen-provider-reference.ts → docs/reference/PROVIDER_REFERENCE.md (live total is now 360 providers on the new base).
  • Synced the provider count in README.md, AGENTS.md, llm.txt (+65 locale mirrors via sync-llm-mirrors.mjs), package.json description and the diagram SVGs — these were indeed missing from the original diff.
  • Resolved the expected 2-line overlap in quotaTrackersBatch.ts (kept both the LLM Gateway and Lyceum registrations); the shared quota-list files (usage.ts, fetcherProviders.ts, supportedProviders.ts, providerLimits.ts, ProviderLimits/constants.ts) keep both entries.

Local gates green: typecheck:core, check:provider-consistency (360 providers, 0 registry-only), check-file-size, check:docs-counts, check:doc-links, check:fabricated-docs, lyceum 16/16, wave1-c 3/3. The only remaining docs-all failure is the pre-existing check:env-doc-sync base drift (issue #13866), unrelated to this diff. PR is MERGEABLE again.

Lyceum (lyceum.technology) is an OpenAI-compatible, usage-based inference
provider. Registered as a first-class apikey provider mirroring the
llmgateway/openrouter pattern:

- registry/lyceum: buildOpenAiCompatibleRegistryEntry (base
  https://api.lyceum.technology/openai/v1, live /models discovery,
  passthrough). Generic DefaultExecutor handles chat/embeddings — no
  custom executor or translator needed.
- apikey metadata card + AGGREGATOR_PROVIDER_IDS + PROVIDER_ENDPOINTS.
- lyceumQuotaFetcher: reads the credit balance from
  GET /api/v2/external/billing/credits (pay-per-use), surfaced as a
  "credits" window in Dashboard > Limits and quota-aware preflight.
  Registered via quotaTrackersBatch (keeps chat.ts frozen).
- usage leaf + dispatch + fetcher/supported/apikey-limits lists + label.
- tests: registry-shape (wave1-c) + 16-case quota fetcher/usage suite.
- docs: changelog fragment, regenerated PROVIDER_REFERENCE, provider
  count 354->355 across README/AGENTS/llm.txt (+42 i18n mirrors)/SVGs,
  file-size baseline bump for the gateways.ts catalog entry.
Rebased onto release/v3.8.51 after diegosouzapw#12462 (LLM Gateway DevPass quota) merged
and the base advanced. The live registry now totals 360 providers, so the
auto-generated reference and the diagram/marketing counts are regenerated
against the new base:

- npm run gen:provider-reference → docs/reference/PROVIDER_REFERENCE.md
- 359→360 in README.md, AGENTS.md, llm.txt (provider count), package.json
  description and the diagram SVGs (readme-hero, promise-pillars,
  comparison-table, cli-terminal, tier-flow-dark/light)
- node scripts/i18n/sync-llm-mirrors.mjs → 65 locale mirrors

Addresses the maintainer review asking to rerun gen-provider-reference.ts and
push the doc files missing from the original diff, which left Docs Gates red.
@PixmaNts
PixmaNts force-pushed the feat/lyceum-provider branch from 1bb933b to cdb1e78 Compare September 22, 2026 09:57
@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks @PixmaNts — merging via the release merge-train. Validated in local merge-train (mt-train10c) on the devbox @ train tip 4d841aa1c740bbaa03868dc0a403c62099a99a42 with the 72 sibling PRs of this batch: typecheck:core, file-size, complexity, cognitive-complexity, changelog-integrity green; changed-area node:test 831/831 (0 failing) and vitest 480/482 — the two reds are autoCombo/provider-family-combos.test.ts timing out at 20s, which reproduces on the PURE release tip under the full vitest suite (and is already tracked by the Release-Green issue #13866), so it is inherited, not this batch's. Merged --admin per merge-gates §3/§4/§7.

@diegosouzapw
diegosouzapw merged commit 2a33528 into diegosouzapw:release/v3.8.51 Sep 22, 2026
6 of 7 checks passed
diegosouzapw added a commit that referenced this pull request Sep 22, 2026
…ost-train tip (#14217)

- Provider count 360 -> 359 in AGENTS.md, llm.txt (+65 mirrors), README.md,
  package.json and the 6 README/hero SVGs, matching gen:provider-reference
  (359 unique IDs) after gemini-business is retired.
- RESERVED_PREFIX_COUNT 414 -> 413. The release tip measures 415, not the 414
  its own assertion claims: #12474 registered lyceum with a DISTINCT alias (+2),
  not an identical one (+1), so that test is red on the tip. Retiring
  gemini-business removes 2 members and adds no tombstones: 415 -> 413.
- Also corrects the inherited migrations count (178 -> 179, Refs #13866), which
  check:docs-counts reports as STRICT drift on the pure tip.
@PixmaNts
PixmaNts deleted the feat/lyceum-provider branch September 22, 2026 11:52
diegosouzapw added a commit that referenced this pull request Sep 22, 2026
…Refs #13866)

`provider-node-reserved-prefix` has been red on the release tip since #12474
merged. That PR registered Lyceum and annotated the running tally as
"413 -> 414", but the set was ALREADY 414 at its parent commit, so adding
"lyceum" moved it to 415 while the assertion stayed at 414.

Verified by dumping RESERVED_PROVIDER_PREFIXES at 2a33528~1 (414 members) and
at the tip (415) and diffing the two: "lyceum" is the one and only member added,
and nothing was removed. So the count is right and the annotation's starting
point was wrong — no provider is missing from the walk.

Validated: provider-node-reserved-prefix 21/21.
@diegosouzapw diegosouzapw mentioned this pull request Sep 29, 2026
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