project_threejs_ai
project_threejs_ai copied to clipboard
DALLE API not working
I have done all the pertinent steps but when I try to send some data to the API the page collapses in the terminal and in the console it returns several errors, I have tried downloading the repo and it gives me exactly the same error, it is not a KEY_API problem because Yes, it is shown as used on the web. Is it possible that the API has changed some configuration or is it paid or something?
same bro I m facing the same issue .
I have already solved it, the problem is that I had no credits left in my openai account, well they had expired, I recommend that you create a new account or well add them by paying, if you create a new account they will give you $5. For each interaction with the API they charge you about 2 cents
@SheikhCodes thank you for sharing but, is openAi not free? can we not used it for daily use cases via api call?
Thanks, I had the same issue. I created a new account, generated the api-key and it worked
@SheikhCodes thank you for sharing but, is openAi not free? can we not used it for daily use cases via api call?
It's not free to use the api
As soon as i click on ai full or ai logo button my screen goes white and i can see errors on the server terminal and even in inspect console.

Can someone please help me out with this....?
@pradeepth02 bruh to use the openAI API key you have to pay for that, otherwise it will not work thats why you get the error. Suggestion: If you purchase the API key then it's fine otherwise just find another api key for free.
Issue persists even with credits. Is there a caveat for free credits versus paid? It should work but I have same issue.
The API usage doesnt even hit to show stats.
Last month it worked:
And I still have credit. <======As seen above
Issue seen in devtools in chrome:
Full result of issue for DallE API through openAIAPI:
UPDATE: So, there is no issues with the API as I have made a new API key and tested as a bearer key in postman and I got a response.
500 ERROR:
So I am getting a 500 from the code as a createImage function doesnt exist?:
openai.createImage() does not exist?:
AND the path via file
dalle.routes.js
API works and tested with postman:
NEW API
POSTMAN TEST SUCCESS - so its not an API credit issue.
Here is a test for the image creation API call, it works just not through the code of this project:
I want to say I screwed up somewhere in the code or something is deprecated or API path is wrong. Any ideas? Thanks fellas!
I think it has expired your 5 dollar that they had provided
On Fri, 25 Aug 2023 at 12:50 PM, FredTheFed @.***> wrote:
Issue persists even with credits. Is there a caveat for free credits versus paid? It should work but I have same issue.
[image: image] https://user-images.githubusercontent.com/111554585/263195355-2ad0123c-4c59-4bdc-9fbc-304d250ad22b.png
The API usage doesnt even hit to show stats. [image: image] https://user-images.githubusercontent.com/111554585/263195835-ba8d0994-df93-4b94-89e7-91aae29ae4d1.png
Last month it worked: [image: image] https://user-images.githubusercontent.com/111554585/263195874-e0776432-08d9-41b4-a763-94117a3541a6.png
And I still have credit.
Issue seen in devtools in chrome: [image: image] https://user-images.githubusercontent.com/111554585/263196435-6b22d760-eab9-40da-90b2-e927d953a59e.png
Full result of issue for DallE API through openAIAPI: [image: image] https://user-images.githubusercontent.com/111554585/263196670-179ab2ae-a671-4068-9154-04d6eee2d42e.png
Any ideas? Thanks fellas!
— Reply to this email directly, view it on GitHub https://github.com/adrianhajdin/project_threejs_ai/issues/16#issuecomment-1692888568, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3R7LN6EHBCBQAAH3MCZ3ALXXBG2HANCNFSM6AAAAAAY3QXXVI . You are receiving this because you were mentioned.Message ID: @.***>
I think it has expired your 5 dollar that they had provided … On Fri, 25 Aug 2023 at 12:50 PM, FredTheFed @.> wrote: Issue persists even with credits. Is there a caveat for free credits versus paid? It should work but I have same issue. [image: image] https://user-images.githubusercontent.com/111554585/263195355-2ad0123c-4c59-4bdc-9fbc-304d250ad22b.png The API usage doesnt even hit to show stats. [image: image] https://user-images.githubusercontent.com/111554585/263195835-ba8d0994-df93-4b94-89e7-91aae29ae4d1.png Last month it worked: [image: image] https://user-images.githubusercontent.com/111554585/263195874-e0776432-08d9-41b4-a763-94117a3541a6.png And I still have credit. Issue seen in devtools in chrome: [image: image] https://user-images.githubusercontent.com/111554585/263196435-6b22d760-eab9-40da-90b2-e927d953a59e.png Full result of issue for DallE API through openAIAPI: [image: image] https://user-images.githubusercontent.com/111554585/263196670-179ab2ae-a671-4068-9154-04d6eee2d42e.png Any ideas? Thanks fellas! — Reply to this email directly, view it on GitHub <#16 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3R7LN6EHBCBQAAH3MCZ3ALXXBG2HANCNFSM6AAAAAAY3QXXVI . You are receiving this because you were mentioned.Message ID: @.>
No, it says I still have credit:
And I have just shown it works in postman. Please read what I post, its NOT A CREDIT ISSUE. I got like 500 emails and I am testing, its not a credit issue.
This is what it looks like from an account thats expired:
Here is one that is NOT and this is the account that should work and is not expired yet.
UPDATE
ISSUES:
- Customizer.jsx:53 POST http://localhost:8080/api/v1/dalle 500 (Internal Server Error)
- Server has started on port 8080 TypeError: openai.createImage is not a function
- Internal server error when making a POST request to http://localhost:8080/api/v1/dalle. This error could be due to various reasons, including issues with the API request, server configuration, or the way data is being processed.
CASCADING FILES AFFECTED:
- @ the Customizer.js file, the
const response = await fetch('http://localhost:8080/api/v1/dalle', {
- dalle.routes.js @
import { Configuration, OpenAIApi} from 'openai'`;
and
const config = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(config);
NOTE: Follow harshit4317's
recommendations
3. server > package.json @ "openai": "^3.2.1" NOTE: The version used is "openai": "^4.0.0"
----> This will change the method call for create.Image() SOLUTION: needs to be images.generate @ the dalle.routes.js file
SOLUTION:
- After applying
harshit4317's
recommendations, issues still occured. I have changed the import to this:
import OpenAi from 'openai'
The block of code affected and modified:
const openai = new OpenAi({
organization: process.env.ORG_ID,
apiKey: process.env.OPENAI_API_KEY
})
- Changes related to the createImage function, it's recommended to refer to the migration guide for transitioning from v3 to v4 of the OpenAI API. Migration guide: https://github.com/openai/openai-node/discussions/217
@dalle.routes.js
BEFORE:
const response = await openai.createImage({
prompt,
n: 1,
size: '1024x1024',
response_format: 'b64_json'
})
SOLVED:
const response = await openai.images.generate({
prompt,
n: 1,
size: '1024x1024',
response_format: 'b64_json'
})
- I still had issues but there was a typo @
const image = response.data.data[0].b64_json
FIXED:const image = response.data[0].b64_json
Just deleted the extra 'data' typo and issue was fixed. I hope this helps.
@FredDaFed Bro, do I need to pay for using api-key? Because I tried your method but it still doesn't work
@FredDaFed Bro, do I need to pay for using api-key? Because I tried your method but it still doesn't work
you have to fund the openAI API, the funds they provide or the ones you pay for are only valid for a month.