The format of the name field in the documentation is incorrect

At the time I am writing this, the OpenAI API reference describes the format of the name field as follows.

The name of the author of this message. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.

However, Chat Completion endpoint accepts hyphens in addition to these.

This is also clear from the error message returned by the OpenAI API when entering unauthorized characters.

400 (Bad Request) : 'J@ck' does not match '^[a-zA-Z0-9_-]{1,64}$' - ''

You’re having spaces in the value for name field on the message object. Replacing spaces with hyphen or underscores fixed it for me