14,954
edits
| Line 158: | Line 158: | ||
} | } | ||
</pre> | </pre> | ||
=== How to fix "Missing bearer or basic authentication in header" === | |||
Command met error condition | |||
<pre> | |||
curl https://api.openai.com/v1/threads/$THREAD_IDmessages \ | |||
-H "Content-Type: application/json" \ | |||
-H "Authorization: Bearer $OPENAI_API_KEY" \ | |||
-H "OpenAI-Beta: assistants=v2" | |||
</pre> | |||
Error message | |||
<pre> | |||
{ | |||
"error": { | |||
"message": "Missing bearer or basic authentication in header", | |||
"type": "invalid_request_error", | |||
"param": null, | |||
"code": null | |||
} | |||
} | |||
</pre> | |||
Corrected command: | |||
<pre> | |||
curl https://api.openai.com/v1/threads/$THREAD_IDmessages \ | |||
-H "Authorization: Bearer $OPENAI_API_KEY" \ | |||
-H "Content-Type: application/json" \ | |||
-H "OpenAI-Beta: assistants=v2" | |||
</pre> | |||
Explanation: | |||
Order of Headers: While typically the order of headers should not impact the execution, ensuring a consistent and logical ordering (e.g., placing the Authorization header first) can sometimes help avoid parsing issues in certain environments or with certain tools. | |||
=== How to fix "None is not of type string - messages.1.content" === | === How to fix "None is not of type string - messages.1.content" === | ||