Repository navigation
feat(providers): add Lyceum pay-per-use provider + credit quota tracking - #12474
Conversation
8db57ab to
f3b9bce
Compare
|
The Lyceum integration itself is solid — 16/16 quota-fetcher tests pass locally, the |
7773ee0 to
1bb933b
Compare
|
Rebased onto
Local gates green: |
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.
1bb933b to
cdb1e78
Compare
…ew Lyceum provider
|
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 |
2a33528
into
diegosouzapw:release/v3.8.51
…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.
…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.
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 alk_…Bearer key, and a documented credit-balance endpoint for pay-per-use tracking.What it adds
registry/lyceum):buildOpenAiCompatibleRegistryEntrywith basehttps://api.lyceum.technology/openai/v1/chat/completions, live/modelsdiscovery,passthroughModels. The genericDefaultExecutorhandles chat/embeddings — no custom executor or translator needed.AGGREGATOR_PROVIDER_IDS+PROVIDER_ENDPOINTS.lyceumQuotaFetcher.ts): readsGET /api/v2/external/billing/credits(available_credits/used_credits/remaining_credits), surfaced as acreditswindow in Dashboard › Limits and quota-aware preflight. Registered viaquotaTrackersBatch(keepschat.tsfrozen). Fails open on auth/network/shape errors.USAGE_FETCHER_PROVIDERS/USAGE_SUPPORTED_PROVIDERS/PROVIDER_LIMITS_APIKEY_PROVIDERS+ dashboard label/order.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).PROVIDER_REFERENCE.md, provider count354 → 355across README / AGENTS / llm.txt (+42 i18n mirrors) / SVGs, and an in-conventionfile-size-baselinebump for thegateways.tscatalog 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 alk_key.Testing
tests/unit/lyceum-quota-fetcher.test.ts(16/16) +free-tier-providers-wave1-clyceum assertions (3/3).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-allall clean; new files lint-clean.