Build garageTry it → read → next · ~9 min

Tutorials · Chapter D (4/4) · ~9 min

API errors & retries

Try it → see it → read → next

Production LLM calls hit **429 rate limits**, timeouts, and bad JSON — handle them on purpose.

On paths: Builder · Student

Optional on: Professional

Try yourself

Playground

API errors & retries

429 rate limits are normal — back off, retry, and cap attempts in production.

Attempt 1

429 Rate limit — retry after 2s

Recap

What you just did

You walked through 429 → wait → retry → success — the shape every SDK wrapper needs.

Teach

How it works

| Code | Meaning | Typical action | |------|---------|----------------| | 429 | Rate limit | Exponential backoff + cap retries | | 401 | Bad key | Alert ops — don't retry blindly | | 500 | Server error | Retry with jitter, then fallback | | 400 | Bad request | Fix payload — don't retry same body |

Read

Try it

Add a retry loop around your chat call — max 3 attempts, double wait each 429. Log each failure with request id.