Tried everything with RateLimitError: Error code: 429 with gpt4-o

Update:
This is the output of print("usage is ", result.usage)

usage is CompletionUsage(completion_tokens=62, prompt_tokens=3638, total_tokens=3700)

This is when i set the base64Frames[0:38], (to use the first 38 frames only), when i change this to 39, I get error,

'Request too large for gpt-4o in organization org-orgId on tokens per min (TPM): Limit 30000, Requested 30250.