How to Build Your Own LLM Front End After Free Quota Changes

    This article explains why free quotas, pay-as-you-go billing, and subscriptions are separate layers in large model services, and why building your own front end against the official API is a practical response to free-tier limits. It covers a four-layer architecture (client, service, inference API, data storage), the rule that API keys must live only in the service layer, and step-by-step practice: running the official sample locally, adding minimal authentication with timestamp signatures, static hosting for desktop and mobile access, session persistence and synchronization, and cost control with observability. It closes with common mistakes and risks, such as exposing keys in the front end, unlimited forwarding, unbounded context growth, compliance gaps, and treating sample projects as production-ready.

    1. The Technical Logic Behind the Change: Quotas, Billing, and Subscriptions Are Different Things

    Many developers have recently reported that a class of LLM chat services introduced call limits on the free tier, followed by community discussion about “no top-up entry, and the paid experience actually got worse.” Setting the sentiment aside, from an engineering perspective this conflates three distinct layers.

    • Free quota: the call allowance for non-paying users, usually measured in requests or tokens per unit of time, used to control resource usage and abuse risk.
    • Pay-as-you-go: a paid model billed on actual token consumption, with the entry point typically on the developer platform rather than the end-user chat page.
    • Subscription: a fixed monthly or annual fee exchanged for a plan’s entitlements, common in consumer-facing product forms.

    The three do not conflict. A service can perfectly well offer “free quota on the consumer side and pay-as-you-go on the developer side,” which is a common combination in the industry. So “no subscription entry” does not mean “no way to pay,” and certainly not “no way to keep using it.” What you actually need to determine is whether your usage is high-frequency interactive or low-frequency experimental. The former is better served by pay-as-you-go plus a self-built, controllable front end; the latter can simply stay within the free quota.

    2. Why Building an Equivalent Front End Is Feasible and Reasonable

    When model capability is exposed as an interface, the front end and back end are decoupled. The official chat page is just one client among many, and you can build an application with an equivalent interaction experience but features better matched to your own needs, based on the public interface specification. The benefits are clear:

    1. Visible cost: you control the consumption of every call, which makes budgeting and rate limiting straightforward.
    2. Controllable experience: conversation history, prompt templates, role settings, and export formats are all customizable.
    3. Consistency across devices: one front end can cover desktop and mobile browsers, and can even be packaged as a desktop application.
    4. Data ownership: conversation records live in storage you choose, so migration and backups are unaffected by third-party UI changes.

    To be clear, this is not a way of bypassing any limit. It uses the standard capabilities the provider offers and replaces the “product experience” with an “engineering solution.”

    3. Overall Architecture

    A minimum viable system can be split into four layers that communicate over standard protocols:

    • Client layer: a browser or desktop shell, responsible for rendering and interaction.
    • Service layer: a lightweight back end that holds keys, forwards requests, and relays streaming responses.
    • Capability layer: the LLM inference API, billed per token.
    • Data layer: persistence for sessions and messages, using object storage or a relational database as you prefer.

    One security rule is absolute: keys may exist only in the service layer and must never appear in front-end code or static assets. Putting a key in a page is equivalent to publishing your bill.

    4. Step-by-Step Practice

    1. Get It Running Locally

    Start from the sample project published by the provider. Download and unpack the release, open the entry page, and enter the key you obtained from the developer platform to get an interaction experience close to the web version. The goal at this stage is to verify network connectivity, key validity, and streaming output. Custom development is not recommended yet.

    2. Add a Minimal Authentication Layer

    Exposing the service layer directly creates abuse risk. The simplest approach is a passphrase check combined with a timestamp-based signature:

    1. import time, hmac, hashlib
    2. from http.server import BaseHTTPRequestHandler
    3. SECRET = b"replace-with-your-own-secret"
    4. def verify(ts: str, sign: str) -> bool:
    5. if abs(time.time() - int(ts)) > 300: # five-minute validity window
    6. return False
    7. expect = hmac.new(SECRET, ts.encode(), hashlib.sha256).hexdigest()
    8. return hmac.compare_digest(expect, sign)
    9. class Handler(BaseHTTPRequestHandler):
    10. def do_POST(self):
    11. ts = self.headers.get("X-Ts", "")
    12. sign = self.headers.get("X-Sign", "")
    13. if not verify(ts, sign):
    14. self.send_response(401); self.end_headers(); return
    15. # forward to the capability layer only after verification passes

    In production, replace the passphrase with multi-factor verification and apply rate limiting per source.

    3. Static Hosting and Multi-Device Access

    The front-end build output is usually a directory of plain static files, which can be hosted on a static site service or on the website hosting capability of object storage, with a content delivery network for acceleration. Desktop and mobile browsers can then open the same address and start using it, with no local environment required.

    4. Session Sync and Persistence

    Write messages to the data layer in a structured form and aggregate them by session identifier to resume conversations across devices:

    1. {
    2. "session_id": "s-20260101-001",
    3. "role": "assistant",
    4. "content": "...",
    5. "created_at": 1767225600
    6. }

    Validate length and sensitive information before writing. On read, concatenate messages in ascending time order as context, and keep the history carried in a single request bounded so token consumption does not spiral.

    5. Cost Control and Observability

    Put a quota middleware in front of the capability layer with per-user, per-day caps. At the same time, report request volume, token consumption, and failure rate to a logging service and monitoring with alerting, and set threshold notifications. This step determines whether the solution can run stably over the long term.

    5. Common Mistakes and Risk Checklist

    • Putting keys in the front end: the most frequent and most fatal error.
    • Unrestricted forwarding: without rate limiting, a single night can generate a large bill.
    • Unbounded history concatenation: the longer the context, the higher the cost per request, so truncation or summarization is needed.
    • Ignoring compliance: tell users clearly and complete any necessary de-identification before their data is written to disk.
    • Treating the sample as production: sample projects usually lack authentication, logging, and fault tolerance, which must be filled in before going live.

    6. Conclusion

    A free quota adjustment is essentially a resource scheduling matter, not a capability regression. For developers, the real moat is not the interface of any particular client but control over the call chain: keys managed by you, cost calculated by you, data held by you, experience customized by you. Treat the standard interfaces the provider opens up as infrastructure and build your own chat application on top of them, and you can both continue your existing workflow and switch smoothly to a more economical calling strategy when needed. The same approach applies to capability combinations offered under general categories on Baidu AI Cloud, for example a container platform hosting the service layer, object storage holding sessions, and logging plus monitoring and alerting handling observability, forming a model application foundation with transparent cost that can evolve sustainably.