Assisants API message content maximum length

Is there a maximum length constraint on the content of a message sent to the assistant through API?
I got this error when trying to send in some large content in a user message : BadRequestError: 400 Invalid 'content': string too long. Expected a string with maximum length 256000, but got a string with length 317985 instead

1 Like

Welcome to the forum!

Hold on… is this a trick question? :slight_smile:

Seriously, though, there are token limits. You can find a lot more in the docs.

1 Like

The docs mention context lengths in terms of tokens. Using GPT4o the max context length should be 128k which is not the same as 256000 characters.

1 Like

Ah, I get what you’re saying now. Sorry for my bad attempt at humor.

It’s likely still related to tokens. I’m not sure why they would mention string… unless they’re inferring the length is in tokens?

Can you use the ones failing to show you the boundary/max maybe?