October 5, 2024 @Kara Mansel

git clone [email protected]:UpstateWomenInSoftwareEngineering/study_helper.git

created app.js

created Dockerfile

generated a project API Key from my personal user

ran docker build -t openai-docker-app .

docker run --env-file .env openai-docker-app

$$ errors:
docker run --env-file .env openai-docker-app

Error generating haiku: RateLimitError: 429 You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: <https://platform.openai.com/docs/guides/error-codes/api-errors>.
    at APIError.generate (file:///usr/src/app/node_modules/openai/error.mjs:59:20)
    at OpenAI.makeStatusError (file:///usr/src/app/node_modules/openai/core.mjs:284:25)
    at OpenAI.makeRequest (file:///usr/src/app/node_modules/openai/core.mjs:328:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async generateHaiku (file:///usr/src/app/app.js:13:24) {
  status: 429,
  headers: {
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '8ce2268f696d8795-STL',
    connection: 'keep-alive',
    'content-length': '337',
    'content-type': 'application/json; charset=utf-8',
    date: 'Sun, 06 Oct 2024 02:16:39 GMT',
    server: 'cloudflare',
    'set-cookie': '__cf_bm=kqAZhdFm3w63NdcwGzgDnap9vUq2k_cdSK3kA76ILh4-1728180999-1.0.1.1-dMKrvxpqWwyTqzoHhleJJTVcU5ucnCWmHALjQP5M.2x53hr_JbH2HTr84BV_XWeCQzu0v96TVw2bNhBI90uY7A; path=/; expires=Sun, 06-Oct-24 02:46:39 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=RJFLUB6Rjg2iCylA6aoiIr1DEGS3dMBfeTg1cFGz1xI-1728180999647-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None',
    'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
    vary: 'Origin',
    'x-content-type-options': 'nosniff',
    'x-request-id': 'req_12d2a3975f3b82f59c20402fd1ef1cbd'
  },
  request_id: 'req_12d2a3975f3b82f59c20402fd1ef1cbd',
  error: {
    message: 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: <https://platform.openai.com/docs/guides/error-codes/api-errors.'>,
    type: 'insufficient_quota',
    param: null,
    code: 'insufficient_quota'
  },
  code: 'insufficient_quota',
  param: null,
  type: 'insufficient_quota'

Added $5 for gpt-4o-mini model 

Same issue - tried a new API key 

Success!

docker run --env-file .env openai-docker-app

Bits of code and sparks,  
Learning from our whispered thoughts,  
A mind without sleep.

dockerized frontend to show haiku in html

success!

Resources:

https://platform.openai.com/docs/guides/rate-limits/usage-tiers

https://openai.com/api/pricing/

Screenshot 2024-10-05 at 10.21.35 PM.png

Screenshot 2024-10-05 at 10.39.08 PM.png