Commit History
-
feat: add usage tracking with live throughput rates and analytics dashboard
shinmentakezo07 +1: ClaudeTrack per-request token usage (input/output/cache/reasoning) plus full prompts (capped at 64 KB) in a JSON ring buffer at ~/.fcc/usage.json, captured through a transparent UsageTrackingStream over the executor stream. Expose GET /admin/api/usage and a new Usage page in the admin UI with KPI cards, token mix, volume area chart, top endpoints, routing sankey, and hourly heatmap, auto-refreshing every 10 seconds. Throughput rates use a trailing 60-second live window on both backend and frontend so they track real-time traffic and decay to zero when idle; tokens/second counts output tokens only, tokens/minute counts input plus output. Bump 4.25.0 -> 4.27.0. Co-Authored-By: Claude <noreply@anthropic.com>e8f2acc -
fix: route numbered OpenAI-compatible instance model refs
shinmentakezo07Chat requests to a numbered endpoint model (MODEL=openai_compatible_1/<id>) failed with 400 "Unknown provider_type: 'openai_compatible_1'" because ModelRouter._validate_provider_id only accepted static catalog entries and never saw the dynamic numbered instance ids before the provider factory could resolve them. - ModelRouter now accepts the openai_compatible_<N> numbering scheme at route time; whether a specific number exists is still validated by the provider factory, which reports the configured instance ids - the instance id pattern is shared (config/provider_catalog) between the router and the runtime factory instead of a private duplicate regex - tests: numbered instance model refs route; unknown numbers defer to the factory; unknown provider ids still raise the typed error - version 4.23.1 -> 4.23.2af75bef
-
Add ChatGPT OAuth as an OpenAI Codex provider (#1279)
Unverified signature## Problem FCC supports API-key and local providers, but customers cannot use models included with their ChatGPT subscription. Reusing Codex credentials would also couple FCC to another application's mutable authentication state. ## Changes | Before | After | | --- | --- | | OpenAI subscription access was unavailable. | Customers connect ChatGPT from the local Admin UI with browser PKCE or device code. | | Provider availability came only from static settings. | A process-owned connected account adds, refreshes, and evicts OpenAI models dynamically. | | FCC had no ChatGPT Codex transport. | `openai/<model-id>` uses FCC-owned renewable credentials and neutral Responses conversion. | | Retries and reasoning continuity had no subscription-provider coverage. | Commit-boundary retries prevent duplicate output while encrypted reasoning and tool IDs survive round trips. | <!-- greptile_comment --> <details open><summary><h3>Greptile Summary</h3></summary> This PR adds ChatGPT OAuth and a…9fb95ba
-
Preserve gateway model identity in Anthropic responses (#1270)
Unverified signature## Problem FCC replaced the stable gateway model selected by Claude Code with the provider-facing model when serializing Anthropic responses. Claude then persisted an ID absent from FCC's `/v1/models` catalog, so later sessions warned that the model could not be restored and fell back. This partially addresses #1269. ## Changes | Before | After | | --- | --- | | Provider streams, local optimizations, and local server-tool responses exposed the routed upstream model. | Every Anthropic response path receives and emits the original gateway model while upstream requests retain the provider model. | | Traces labeled the routed upstream ID as the gateway model. | Routing, execution, provider, and token-count traces preserve both identities accurately. | | No contract guarded model identity across routing and response serialization. | Tests cover executor handoff, upstream request bodies, Anthropic `message_start`, local optimizations, and server tools; the patch version is `4.12.10`. | <…82e8d6e
-
Make reasoning policy provider-neutral and client-aware (#1148)
Unverified signature## Problem FCC reduced reasoning to global and route booleans, mixing client intent, configuration, provider wire capabilities, output visibility, and history replay. That discarded named client efforts, encouraged model-name checks, and made provider behavior inconsistent. ## Changes | Before | After | | --- | --- | | Admin exposed global and route thinking toggles. | Admin exposes **Off**, **From client**, **Low**, **Medium**, **High**, **X-High**, and **Max**; Fable, Opus, Sonnet, and Haiku also expose **Inherit**. | | Request intent was repeatedly reduced to a boolean across routing and providers. | The application boundary resolves one immutable `ReasoningPolicy` with independent control, named effort, and exact positive token budget. | | Provider adapters could infer reasoning behavior from upstream model names or versions. | Provider profiles translate only documented provider-wide wire capabilities; architecture and contributor rules prohibit model-specific reasoning branche…dc04eee
-
Add searchable model selection to the Admin UI (#1121)
Unverified signature## Problem Admin model routing fields required users to construct provider-prefixed model slugs. Optional tier overrides represented inheritance as an unexplained blank value. ## Changes | Before | After | | --- | --- | | Model inputs only gained suggestions after an individual provider refresh. | Model inputs load configured and discovered canonical slugs from one Admin catalog. | | Model routing looked like unrestricted text entry. | Model routing uses the browser's searchable model dropdown while retaining manual entry. | | Tier overrides displayed an empty value for fallback routing. | Tier overrides display **None** and persist it as an unset override. | | Model refresh returned provider-shaped cache internals. | Model refresh returns the same canonical catalog consumed by the Admin UI. | | Users inferred the provider/model slug format from examples. | The Admin UI and README define and present complete provider/model slugs. | <!-- greptile_comment --> <details open><summary>…0ff89da
-
Add Fable as a first-class Claude routing tier (#1099)
Unverified signature## Problem Claude Code now sends `claude-fable-5` for the Fable alias, but FCC treated it as an unrecognized model and collapsed it into the global fallback route. Users could not map Fable traffic or reasoning behavior independently. Fixes #1097. ## Changes | Before | After | | --- | --- | | Fable requests inherited `MODEL` and `ENABLE_MODEL_THINKING`. | Fable requests use `MODEL_FABLE` and `ENABLE_FABLE_THINKING` when configured, otherwise inherit the existing defaults. | | `/v1/models` omitted Claude Fable 5. | `/v1/models` advertises the canonical `claude-fable-5` identifier. | | Admin, documentation, validation, and smoke contracts described three Claude tiers. | Admin, documentation, validation, and smoke contracts describe Fable alongside Opus, Sonnet, and Haiku. | | The package version was `4.3.1`. | The package version is `4.4.0`. | <!-- greptile_comment --> <details open><summary><h3>Greptile Summary</h3></summary> This PR adds Fable as a Claude routing tier. The main c…3d8524a
-
Remove the native Anthropic provider transport (#1067)
Unverified signature## Problem Ollama and llama.cpp still used a parallel native Anthropic transport after the other providers moved to OpenAI Chat. That kept duplicate request, SSE, recovery, model-list, and server-tool policy machinery alive. ## Changes | Before | After | | --- | --- | | Ollama and llama.cpp streamed through provider-specific Anthropic `/messages` adapters. | Ollama and llama.cpp use the shared OpenAI Chat transport. | | Native request serialization, SSE normalization, error mapping, and recovery remained beside the OpenAI path. | Native-only machinery is removed and all providers share one transport lifecycle. | | Routed models carried a capability object solely to permit native server-tool passthrough. | Routing carries only route decisions; FCC handles forced server tools locally and rejects lossy passthrough. | | Ollama discovery used a separate `/api/tags` parser and rejected `/v1` configuration. | Ollama discovery uses `/v1/models` and accepts either root or `/v1` base URLs. | …9a1b3fc
-
Make response stream lifetimes explicit (#1060)
Unverified signature## Problem Client disconnects and response-start send failures could abandon a prefetched provider stream and its generation lease. Re-yielding iterators and response-proxy middleware left no owner that closed the complete body chain before runtime release. ## Changes | Before | After | | --- | --- | | Starlette body iteration indirectly owned stream cleanup and lease release. | One FCC streaming response surrounds the real ASGI send, closes the body transitively, then releases the lease exactly once. | | The prefetched first-frame generator could not close its tail before replay began. | An explicit closeable replay iterator owns the prefetched tail in every commit state. | | Tracing, execution, Responses conversion, and native transport transforms re-yielded inputs without closing them. | Every retained transform closes its direct input; redundant transport wrappers are removed while provider construction failures remain deferred. | | Function-style correlation middleware proxied …4aecccf -
Make provider capabilities semantic and typed (#1047)
Unverified signature## Problem Provider metadata mixed descriptive strings and transport-family names with product policy. The Messages API had to know provider implementation details to decide server-tool behavior, while locality and thinking metadata had ambiguous owners. ## Changes | Before | After | | --- | --- | | Provider descriptors exposed transport names and untyped capability strings. | Provider descriptors expose an immutable semantic value containing only locality and server-tool passthrough. | | The Messages handler derived provider sets from transport families. | `ResolvedModel` carries catalog capabilities and the handler asks the resolved semantic policy. | | Discovery, Admin, and smoke selection inferred locality from credentials or string membership. | Discovery, Admin, and smoke selection read the catalog-owned `local` capability. | | Provider-wide thinking strings competed with discovered model metadata. | `ProviderModelInfo.supports_thinking` remains the sole per-model thinking aut…2f1cc5a -
Canonicalize provider failure and retry ownership (#1046)
Unverified signature## Problem Provider SDK classification, retry policy, canonical failures, and downstream wire errors shared exception types across layers. That blurred ownership and let cleanup or provisional Responses tool failures mask the real provider diagnostic. ## Changes | Before | After | | --- | --- | | Provider failures carried Anthropic wire types and core code classified OpenAI/httpx errors. | Protocol-neutral `ExecutionFailure` values cross layers, providers classify SDK errors, and protocol packages map wire types. | | Provider adapters could author terminal wire events. | The HTTP commit boundary selects non-2xx JSON or a protocol terminal event with one ingress request ID. | | Retry policy and diagnostic handling were spread across core and provider modules. | Providers own the unchanged retry budgets while neutral core utilities own bounded credential redaction. | | Stream cleanup could replace an already-mapped provider failure. | Cleanup records safe metadata and preserves the ca…db883b3 -
Introduce a typed application boundary for provider execution (#1045)
Unverified signature## Problem The HTTP adapter owned model routing, provider execution, and runtime-facing contracts, so API handlers depended on provider implementation types. Provider preflight also discovered private request builders dynamically, obscuring the boundary that must fail before streaming begins. ## Changes | Before | After | | --- | --- | | `api/` owned model routing and shared provider execution. | `application/` owns routing and a settings-independent `ProviderExecutor`. | | API handlers accepted `BaseProvider` callbacks. | API handlers consume the narrow structural `ProviderPort`. | | `BaseProvider` discovered `_build_request_body` dynamically. | Both transport families implement explicit abstract preflight, with LM Studio composing context validation. | | Request leases, task control, and provider model metadata had adapter/provider owners. | Application-owned ports and immutable values define those cross-package contracts. | | Boundary direction was implicit. | Architecture contra…d29db6e