Refused to set unsafe header "User-Agent"
See original GitHub issueGetting this error when trying to run the following code:
Refused to set unsafe header "User-Agent"
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
const response = await openai.createCompletion("code-davinci-001", {
prompt: filePart,
temperature: 0.1,
max_tokens: 2000,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0.5,
});
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Ajax request: Refused to set unsafe header
Therefore I need to post a request to their endpoint with the Referer and the User-Agent properly set. This call should return an...
Read more >Refused to set unsafe header "User-Agent" · Issue #982
Description Every time an api call is made i get the error: Refused to set unsafe header "User-Agent" I'm using the API package...
Read more >Refused to get unsafe header
The message describes a failed attempt to access header data from a network request. We discovered this error while working on a prototype...
Read more >Refused to set unsafe header "User-Agent": connection.js
This toolkit predates the requirement that some headers be rejected if a script tries to set them, and most, if not all, browsers...
Read more >Refused to set unsafe header "User-Agent" Error with Dall- ...
Trying the Dall-E api, give the Refused to set unsafe header “User-Agent” Error. Why would Open AI set this so strict, to only...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rickstylz01 Here’s the workaround I used:
Please do not use this library in the browser, it is not secure – people will be able to steal your API key. See README.md:
You should route your requests through a backend server that you control.