Skip to main content
OpenPAI sets RPM / TPM / concurrency ceilings per user / token at the gateway. High-QPS scenarios require throttling and retries on the client. For the full rules, see Rate limits.

Simple client throttling (Python)

Use asyncio.Semaphore to control concurrency:

Exponential backoff

Token-bucket rate limiting

aiolimiter implements a client-side token bucket in Python:

Use the response headers

Every response carries remaining-quota headers, enabling adaptive throttling:

Batching tips

  • Merge short requests: concatenate several independent prompts into one large request (use a system prompt to delimit tasks).
  • Embed many texts at once: input accepts an array, up to ~2048 items per call.
  • Rerank many documents at once: documents can hold tens to hundreds at a time.
  • Streaming + early stop: if the answer length is controllable, have the model output a JSON header first and use a stop sequence to end early on the client.

Increase your quota

If the strategies above still can’t meet your needs, consider:
  1. Top up to raise your account level for higher quotas.
  2. Apply for a dedicated quota and isolated channel via enterprise sales.

Monitoring

  • Console → Usage statistics: watch daily peak RPM / TPM.
  • Client logs: print the Retry-After and x-ratelimit-* headers to locate the rate-limit bottleneck.
  • Integrate Prometheus / Grafana for your own monitoring: report spend / tokens / latency for each call.