Pay-as-You-Go API Access After Free Chat Quota Cuts: A Step-by-Step Guide

    Free chat tiers limit usage because each reply consumes GPU compute. This guide explains how pay-as-you-go API billing differs from free chat, what you need before you start, and how to complete account setup, create an API key, and make a first call with the OpenAI SDK. It also covers common error codes, a sample cost estimate, and ways to control spending.

    Why Free Chat Quotas Are Tightening: Inference Costs

    Free chat products serve large numbers of everyday users, and each reply uses GPU compute. Inference cost depends directly on the number of input and output tokens. When compute supply cannot keep up with user growth, platforms typically limit the input length per request, the number of daily chat turns, and they clear cached sessions that have been inactive for a long time. These rules are cost controls for the free tier. They are not decisions about any individual user.

    How Pay-as-You-Go API Differs from Free Chat

    Both are usually offered by the same provider, but they bill differently. The free web and mobile apps are chat-based and capped by quotas. The open platform API bills by token, so you pay for what you use. It generally does not count chat turns.

    Pay-per-token does not mean unlimited usage. Platforms still enforce limits on requests per minute (RPM), tokens per minute (TPM), and concurrency. When you exceed these limits, the API returns a 429 error.

    Third-party wrapper clients, shared accounts, and resale top-up services forward your requests, so your input passes through third-party servers. This raises privacy risk, and accounts may be banned for policy violations. When you call the official API directly, your data follows the same path as the official products.

    Prerequisites

    The whole process usually takes 15 to 30 minutes. Prepare the following four items before you start:

    1. A computer that can run Python or Node.js. If you only want a graphical interface, check whether the provider offers a desktop client and which operating systems it supports. Mobile apps usually do not have a pay-as-you-go entry point, so they continue to use the free quota.
    2. An existing official account. Most platforms use one account system for both web chat and the open platform, but the console entry points may differ.
    3. Identity verification documents. Most platforms require verification. Individual users typically need a government-issued ID, and business users need business registration documents. Requirements depend on each platform’s policies.
    4. A small prepaid budget. A first top-up of 10 to 50 CNY is enough for light to moderate personal use over a period of time.

    Four Steps to Set Up Access

    Step 1: Complete Identity Verification on the Open Platform

    Log in to the provider’s open platform console, open the identity verification page, and submit identity or company information as prompted. Review times vary by platform, from instant approval to several business days.

    Step 2: Top Up and Create an API Key

    After verification, add funds in the console. Then open the key management page and create an API key. The full key appears only once, at creation. Save it immediately in a password manager or an environment variable. Do not hard-code it or commit it to a code repository. Create a separate key for each application, so that if one key leaks, you only need to revoke that one.

    Top-up methods generally fall into two types. Prepaid balances stop working when they run out, which suits most individual users. Some platforms also offer postpaid billing, which settles by invoice. That option suits teams with fixed budget approval processes.

    Step 3: Choose an Access Method and Write Code

    If the provider offers a desktop client, sign in and link your account by following its instructions. To call the API from your own program, follow the steps below.

    Install the SDK first. Platforms that support the OpenAI API style can use the OpenAI SDK directly. For other platforms, follow the official SDK documentation.

    1. pip install "openai>=1.0"

    Then run the following code. Copy the base_url exactly from the official documentation, and make sure model matches the model name in the console’s model list exactly.

    1. import os
    2. from openai import OpenAI
    3. client = OpenAI(
    4. api_key=os.environ["LLM_API_KEY"], # Read from an environment variable. Do not hard-code it.
    5. base_url="base URL from the official documentation",
    6. )
    7. resp = client.chat.completions.create(
    8. model="model name from the console model list",
    9. messages=[{"role": "user", "content": "Hello, please introduce yourself in one sentence."}],
    10. )
    11. print(resp.choices[0].message.content)

    Before you run the code, set the environment variable in your terminal. On macOS or Linux, use export LLM_API_KEY="your API key". In Windows PowerShell, use $env:LLM_API_KEY="your API key".

    Step 4: Verify the Call and Monitor Usage

    Send one short prompt first to confirm that the response is normal. Then check the usage details and balance changes in the console, and confirm that the charges match your expectations. Set a balance alert so you get a notice when the balance falls below a threshold.

    Troubleshooting Common Errors

    Error codes and messages vary by platform. The list below covers common cases. Refer to the official error code documentation for specifics.

    • 401 or authentication failure: Check that the key was copied completely and has not been revoked. Also confirm that the environment variable is set in the current terminal.
    • 403 or permission denied: Confirm that identity verification is complete, and check that the model is enabled for your account.
    • 404 or model not found: Make sure the model parameter matches the console model name exactly, including capitalization and version number.
    • 429 or too many requests: Reduce concurrency, add exponential backoff retries to your code, or request a higher limit in the console.
    • Insufficient balance: Top up in the console, and check your balance alert settings.

    How to Estimate Costs

    Pay-as-you-go cost is calculated as follows:

    Cost = input tokens × input price + output tokens × output price

    In Chinese-language text, one character is roughly 1 to 2 tokens. In English, one word is roughly 1 token.

    The example below uses assumed prices. Check the official pricing for actual rates, since prices change by model, region, and promotion.

    Item Assumed value
    Daily input tokens 100,000
    Daily output tokens 20,000
    Input price (assumed) 2 CNY per million tokens
    Output price (assumed) 8 CNY per million tokens
    Daily cost 0.2 + 0.16 = 0.36 CNY
    Monthly cost (30 days) About 10.8 CNY

    Each request resends the conversation history, so long conversations repeatedly count the same input tokens. To control costs, trim the system prompt, periodically delete irrelevant message history, use lightweight models for simple tasks, and reserve flagship models for complex reasoning. If the platform offers off-peak or batch discounts, schedule non-urgent tasks for those windows. Check the official announcements for specific rules.

    Final Thoughts

    The tightening of free chat quotas may continue in the short term. For heavy users and developers, a pay-as-you-go API avoids chat-count limits and makes it easier to connect your own scripts and tools. Whether it is worth the cost depends on your actual usage. Try it with a small top-up for one week, then choose a long-term plan based on the bill.

    If you are building a large-scale AI application for a team, consider the large model inference, object storage, log service, and monitoring and alerting products offered by cloud providers, including Baidu AI Cloud. Check the official documentation for each product, and compare pricing, compliance requirements, and terms of service across providers. The recommendation here is for reference only and is not the only option.