Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
限流维度、429 处理与退避策略
429 Too Many Requests
429
import time, random from openai import OpenAI, RateLimitError client = OpenAI(base_url="https://tokendog.io/v1", api_key="YOUR_TOKENDOG_API_KEY") def chat_with_retry(**kwargs): for attempt in range(5): try: return client.chat.completions.create(**kwargs) except RateLimitError: time.sleep((2 ** attempt) + random.random()) raise RuntimeError("rate limited after retries")