Hosted Inference via Featherless.ai — Design Document

Status: Shipped, in a broader shape than this concept (verified 2026-09-29). Featherless is the platform's hosted rail for every conversation, not only paid experiences: the built-in presets labelled Powered by Featherless (provider featherlessplatform) run on the platform key with no API key needed, and replaced the retired free OpenRouter rail (removed in the 2026-05-19 sweep). Per-turn Echo billing for them is built on the compute allocate/settle rail, switched on by an admin setting; the concurrency guard shipped 2026-06-05 as an in-process queue; and since 2026-09-11 (d109b817) Discord turns on a platform preset are billed to their payer the same way. Still unbuilt from this doc: its Paid Experiences integration (paid packages). The operational spec is docs-internal/architecture/chat-engine/PLATFORM_MODELS.md; the text below is the original concept and describes a v1 scope ("free conversations remain BYOK-only") that the shipped design superseded.

Overview

Today the platform is BYOK-first: users bring their own API key from Anthropic, OpenAI, Google, OpenRouter, or Featherless. That works for power users but fails most of our audience — "API key" is jargon, and several of the major providers are inaccessible or hostile to the kinds of fiction our users write.

Hosted inference is the platform serving LLM calls using its own credentials, paid for in Echoes. This document covers the first hosted provider: Featherless.ai.

Featherless is chosen specifically because:

  1. Its content policy is narrow and predictable — it hosts open-weight models from HuggingFace and lets the choice of model do the censorship rather than enforcing a content policy on top.
  2. The catalog is enormous (~37,000 models, ~15,000 conversational) — far beyond what any single first-party provider exposes. Niche fine-tunes like Mistral Nemo roleplay variants, Qwen Coder, and uncensored Llama derivatives are all first-class.
  3. Pricing is subscription-based — flat monthly fee for unlimited inference within concurrency slots, no per-token billing. This makes platform unit economics predictable and decoupled from message length.
  4. It returns standard OpenAI-shaped usage objects per response, so we can still record token counts for analytics and abuse detection even though we aren't billed per-token.
  5. They've publicly stated they don't retain prompts long-term — same privacy posture our users already expect.

This document covers provider integration, the subscription cost model (this is the biggest divergence from typical per-token providers), catalog sync, abuse mitigation, and how hosted inference plugs into Paid Experiences.


Scope

In scope

Out of scope for v1


Why Featherless, Not Anthropic/OpenAI

Concern Anthropic / OpenAI Featherless.ai
Content policy surface Wide and fuzzy — roleplay can trip filters unpredictably None at the provider level — model choice is the policy
Account risk High — one fuzzy enforcement incident can kill production access Low — subscription is straightforward, no surprise content bans
Cost predictability Per-token, can spike on long messages Flat monthly subscription — message length doesn't move the bill
Catalog ~10–20 first-party models ~15,000 conversational models including community fine-tunes
Prompt retention Often retained, sometimes used for training Not retained — confirmed by Featherless
API shape Native OpenAI / Anthropic / Google SDKs OpenAI-compatible at /v1/chat/completions

Featherless is not a replacement for BYOK. Users who want Claude Sonnet or GPT-4o specifically should keep bringing their own key — that path stays first-class. Featherless fills the gap for users who cannot or will not manage API credentials, and it unlocks a model catalog no first-party provider matches.

What Featherless does not give us


Provider Integration

Adapter Location

Featherless is already integrated as a BYOK provider via FeatherlessLlmClient (extends StrictOpenAiLlmClient — Featherless rejects non-standard sampler params). Hosted-inference reuses the same client; the only addition is a routing rule that points it at the platform-owned API key when the conversation is a paid experience.

Core/LLM/
├── Providers/
│   ├── AnthropicLlmClient.cs       (existing, BYOK)
│   ├── OpenAiLlmClient.cs          (existing, BYOK)
│   ├── GeminiLlmClient.cs          (existing, BYOK)
│   ├── OpenRouterLlmClient.cs      (existing, BYOK)
│   └── FeatherlessLlmClient.cs     (existing — used for both BYOK and hosted)
└── ProviderResolver.cs             (extended: route hosted requests to platform key)

API Surface

Featherless exposes an OpenAI-compatible chat completions endpoint plus a model catalog. We already consume both:

Endpoint Purpose
POST /v1/chat/completions Standard chat completions, streaming and non-streaming. OpenAI-shaped.
GET /v1/models Returns model catalog with q, page/per_page, sort, family, model_class, gated, conversational, context_length_min/max, parameter_size_min/max, etc. Used live by the model picker; polled daily by the catalog sync job for hosted inference.

There is no /billing/balance equivalent because Featherless billing is a flat subscription invoiced separately. Plan/concurrency status is monitored via the dashboard (manual, for v1).

Authentication

The platform holds a single Featherless API key (FEATHERLESS_PLATFORM_API_KEY) in its secrets store. Separate from any user-configured Featherless keys. This key is never exposed to the client and is only used when a request is routed to hosted inference. BYOK users keep using their own keys against the same FeatherlessLlmClient.

Streaming

Featherless supports SSE streaming. The adapter already plugs into our shared SSE streaming helper — no additional client-side work needed for the hosted path.


Cost Model

This is the section that diverges most sharply from a per-token hosted provider (Anthropic, OpenAI, Venice). Featherless billing is flat-rate subscription, so we need a different mental model for what "cost per message" means and how the Echo price floor is set.

What Featherless Bills

The platform pays a monthly subscription. Featherless plans cap:

There is no per-token charge. Sending one 200-token message and one 20,000-token message costs the platform the same — both consume one (or N) concurrency slots for however long the model takes to respond.

What This Means for Echo Pricing

Because the underlying cost is fixed-monthly-fee + concurrency-bound, Echo pricing for paid experiences cannot be derived from per-token rates. Instead:

  1. Bucket models by class. Featherless's model_class field groups models by family + size (e.g., qwen3-32b, mistral-v01-7b, llama2-solar-10b7). Each class gets a tier — small / medium / large — based on its concurrency_cost, parameter_size, and observed average response time.
  2. Price each tier in Echoes. A small message costs N Echoes, medium costs M, large costs L. The numbers are picked so that expected platform monthly cost / expected message volume sits comfortably below the Echo revenue per message.
  3. Tiers feed the Paid Experiences price floor. The minimum Echo price a creator can set on a Featherless-backed package is the tier's floor; the suggested range adds the platform margin.
  4. Tiers are reviewed quarterly rather than synced daily — they don't change unless our subscription changes or the catalog shifts substantially.

This is fundamentally different from the per-token sync job a per-billed provider would need.

platform_model_costs Schema Adjustments

The existing platform_model_costs table from Paid Experiences was designed assuming per-token rates. For Featherless models, the per-token columns are NULL and a new pricing_model column distinguishes the two:

ALTER TABLE platform_model_costs
    ADD COLUMN IF NOT EXISTS pricing_model VARCHAR(20) NOT NULL DEFAULT 'per_token',
    ADD COLUMN IF NOT EXISTS subscription_tier VARCHAR(20),    -- 'small' | 'medium' | 'large' for Featherless
    ADD COLUMN IF NOT EXISTS concurrency_cost INTEGER;          -- mirrored from Featherless catalog
COMMENT ON COLUMN platform_model_costs.pricing_model IS 'How the upstream provider bills: "per_token" (Anthropic, OpenAI, OpenRouter, Venice) or "subscription" (Featherless).';
COMMENT ON COLUMN platform_model_costs.subscription_tier IS 'For subscription providers: which platform-defined cost tier this model belongs to. Drives the Echo price floor.';

For pricing_model = 'subscription', the per-token columns are NULL and the floor lookup uses subscription_tier instead.

Per-Message Reconciliation

We still record the standard usage object per response (Featherless returns prompt_tokens, completion_tokens, total_tokens in OpenAI shape) and write them into web_message_stats for analytics and abuse detection. They are not used for billing — the user is charged the reserved Echo amount regardless of token count, because that's how Featherless bills us.

The reservation-vs-actual margin metric becomes a margin-vs-tier metric: did the user's reserved Echo amount exceed the tier's floor by enough to cover platform overhead at expected volume?


Catalog Sync

Even though Featherless doesn't change pricing, the catalog itself changes — models get added, gated, deprecated, or removed entirely when their HuggingFace upstream goes away.

Sync Job

Frequency:  Once per day (02:00 UTC)
Source:     GET https://api.featherless.ai/v1/models?conversational=true&per_page=1000
Target:     platform_model_costs table (Featherless rows)

The job:

  1. Pages through GET /v1/models?conversational=true (subset to chat-capable models — embedding/completion-only models aren't usable in our pipeline).
  2. For each model: upsert into platform_model_costs with pricing_model='subscription', concurrency_cost from the response, and subscription_tier looked up from a static map keyed on model_class (e.g., qwen3-32b → large, mistral-v01-7b → small).
  3. Models no longer present in Featherless's response are marked is_available = FALSE but not deleted — existing package references keep working until fallback kicks in (see Resilience).
  4. New models or new model_class values get logged for admin review — the static class→tier map is curated, not auto-extended, so new model classes need a deliberate decision about which tier they belong to.
  5. Models that flip is_gated = true are downgraded to is_available = FALSE for hosted use unless the platform's plan covers them — gated models often require additional permissions per-account.

Alerting

The sync job emits admin alerts when:


Pipeline Integration

Featherless plugs into the existing paid experience pipeline. The new pieces are (a) a routing rule that swaps in the platform key when the conversation is a paid experience, and (b) the cost reconciliation step (which is mostly recording-for-analytics rather than billing).

Pre-LLM
  1. Is this a paid package conversation?                  (existing)
  2. Is the user in free trial?                            (existing)
  3. Does the user have enough Echoes to reserve?          (existing)
  4. Reserve echo_price_per_message                        (existing)
  5. Resolve provider: paid_model_identifier → FeatherlessLlmClient
     with platform API key (instead of user's BYOK key)    (new)
  6. Concurrency budget check — does the platform have a free slot?  (new)

LLM
  7. FeatherlessLlmClient.GetCompletionStreamAsync(request)    (existing client, hosted key)
     - Streams response back via existing SSE helper
     - Captures usage object from final chunk

Post-LLM
  8. Commit reservation to creator wallet                       (existing)
  9. Record web_message_stats with:
       echo_cost              = reserved amount (what user paid)
       echo_creator_earned    = creator share
       hosted_provider        = 'featherless'                    (new)
       token_count_in/out     = from Featherless usage           (new)

The reservation reconciliation against actual platform cost (the Venice doc had a USD comparison here) becomes a tier-margin check instead — does the reserved Echo amount stay above the tier floor?

Provider Resolution Rules

When the pipeline needs to pick a provider:

  1. If the conversation is BYOK → use user's configured provider with their key (existing).
  2. If the conversation is a paid experience → look up package.paid_model_identifier.
  3. If the model identifier's prefix is featherless/ (or the model class maps to a Featherless-only model) → route to FeatherlessLlmClient with FEATHERLESS_PLATFORM_API_KEY.
  4. If the model is unavailable (flagged in platform_model_costs or rejected by Featherless) → see Resilience.

web_message_stats Schema Additions

Same as the Venice design — additive and non-breaking, NULL for BYOK messages:

ALTER TABLE web_message_stats
    ADD COLUMN IF NOT EXISTS token_count_in INTEGER,
    ADD COLUMN IF NOT EXISTS token_count_out INTEGER,
    ADD COLUMN IF NOT EXISTS token_count_cached INTEGER,
    ADD COLUMN IF NOT EXISTS hosted_provider VARCHAR(30);

COMMENT ON COLUMN web_message_stats.hosted_provider IS 'Hosted provider that served this message (e.g., "featherless"). NULL for BYOK.';

There is intentionally no platform_actual_cost_usd column for Featherless rows — there is no per-message USD cost. The platform-cost view for Featherless is computed at the subscription level (monthly bill / message count = blended per-message cost), not per-row.


Resilience & Fallback

Featherless is an external dependency and will occasionally fail. The platform must degrade gracefully without losing user trust.

Health Check

Featherless has no /billing/balance equivalent (no balance to check on a subscription). The health check polls GET /v1/models?per_page=1 every 5 minutes and flips an internal flag if two consecutive calls fail. Failed health status surfaces on the admin status dashboard.

Concurrency Guard

Because Featherless caps concurrent slots per plan, a traffic spike can push us past the plan's concurrency limit and start getting 429s. The platform tracks in-flight Featherless requests in a process-local counter (single replica) or a Redis counter (multi-replica) and:

This bounds burstiness without needing per-user rate limits. Per-user limits get added if abuse data shows a single user is monopolizing slots.

Failure Modes

Failure Behavior
Featherless 5xx on a chat request Retry once with exponential backoff. If still failing, release the Echo reservation, return a friendly error to the user, log the incident. No charge to the user.
Featherless model deprecated (model_id 404 or removed from catalog) Package auto-falls back to the closest available model in the same subscription_tier (see Paid Experiences — Model becomes unavailable). Creator is notified.
Featherless platform-wide outage All paid experiences using Featherless show a banner: "Hosted inference is temporarily unavailable. You can switch to Bring Your Own Key to continue this conversation." Free BYOK path remains functional.
Plan concurrency exceeded Soft-queue up to 30s, then fail-with-retry. Persistent saturation triggers an admin alert and a recommendation to upgrade plan.
Rate limited (429) Treated as transient; queue and retry with backoff. Repeated 429s over 10 minutes escalate to admin alert.
Featherless subscription lapsed All /v1/chat/completions calls 401. Platform flips Featherless-hosted off entirely until renewed; creators with affected packages get notified. (We monitor renewal dates separately.)

Volume Guard

To prevent runaway message volume (e.g., a bug spamming Featherless), the platform enforces a hard daily message ceiling on platform-paid Featherless requests. The ceiling is configurable, defaults conservatively (e.g., 10,000 messages/day for the initial rollout — tune based on plan tier). Hitting the ceiling triggers:

  1. Immediate admin alert.
  2. New paid conversations on Featherless-backed packages are blocked.
  3. In-flight conversations finish their current message but pause afterward with the "temporarily unavailable" banner.
  4. Ceiling resets at 00:00 UTC next day, or an admin can raise the ceiling manually.

This is the per-message analog of the Venice doc's USD ceiling — Featherless doesn't bill us per message, but a runaway loop still exhausts our concurrency budget and harms availability for legitimate users.


Abuse & Audit

Featherless does not retain prompt logs long-term. That is a feature for user privacy, but it means we must keep the minimum audit trail needed to respond to abuse reports and regulatory requests.

What We Log (Hosted-Only)

For every message served via a hosted provider, we retain:

Field Purpose
message_id Join key to web_messages
user_id, conversation_id, package_id Who, where, what product
hosted_provider, model_identifier Which provider and model
token_count_in/out Abuse detection (unusual spikes), analytics
moderation_flags Results from our pre-send content moderation pass
prompt_hash SHA-256 of the assembled prompt — used to detect repeat offenders without storing plaintext
response_hash SHA-256 of the model response — same purpose

Plaintext prompts and responses are not retained for hosted inference beyond the usual conversation history that the user owns. The hashes let us recognize patterns (same prompt sent thousands of times, for example) without building a content archive.

Moderation Pipeline

Content moderation runs before the Featherless call, not after. The platform already does minor detection on personas, lorebooks, and greetings (see project state). Hosted inference tightens this to a pre-send gate on every assembled prompt, because:

The moderation pass runs on the fully-assembled prompt (system + lorebook injections + persona + recent history + new user turn). Flags that hit a hard-line category block the request, release the Echo reservation, and record the incident. Flags below the hard-line threshold are logged for trend analysis but do not block.

Incident Response

When we receive an abuse report naming a specific user or conversation:

  1. Pull web_message_stats rows for the flagged conversation.
  2. Cross-reference moderation_flags and prompt_hash / response_hash for patterns.
  3. Use the user-owned conversation history (plaintext, already retained for the user's own access) to review content.
  4. Take action against the user per ToS. Featherless is not contacted unless the incident involves a hard-line violation that materially affects our subscription standing.

Rollout Plan

  1. Routing rule — ProviderResolver swaps the user's API key for FEATHERLESS_PLATFORM_API_KEY when the conversation is a paid experience and the model identifier is a Featherless model. The existing FeatherlessLlmClient does the rest.
  2. platform_model_costs schema — Add pricing_model, subscription_tier, concurrency_cost. Backfill existing rows to pricing_model = 'per_token'.
  3. Tier map + seed — Define the model_class → subscription_tier static map. Seed platform_model_costs with the current top-100 conversational models grouped into tiers.
  4. Catalog sync job — Daily scheduled task. Walks GET /v1/models?conversational=true, upserts availability + concurrency_cost, alerts on new model classes.
  5. Pipeline wiring — Provider resolver, concurrency guard, post-LLM analytics recording.
  6. Moderation gate — Pre-send hard-line check on assembled prompt for hosted requests.
  7. Audit logging — web_message_stats schema additions, prompt/response hashing.
  8. Health monitor + volume guard — Background catalog poll for liveness, daily message ceiling, admin alerts.
  9. Admin UI — Featherless dashboard showing current plan tier, today's message volume, concurrency utilization, recent catalog changes, moderation flag trends.
  10. Limited beta — Enable on 1-2 staff-authored packages with a low daily ceiling. Verify concurrency behavior under load and moderation coverage.
  11. General availability — Open hosted inference as an option in the package workbench for verified creators, scoped to a curated subset of model classes.

Open Questions