APICallError [AI_APICallError]: x-api-key header is required
nushret opened this issue · 1 comments
I do the complete installation and open the interface. When I type promt and enter, the following error occurs.
(base) PS C:\Users\nkura\fragments> npm run dev
e2b-fragments@0.1.0 dev
next dev --turbo
▲ Next.js 14.2.13 (turbo)
- Local: http://localhost:3000
- Environments: .env.local
✓ Starting...
✓ Compiled in 113ms
✓ Ready in 1083ms
○ Compiling / ...
✓ Compiled / in 3.1s
(node:26084) [DEP0040] DeprecationWarning: The punycode
module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ...
to show where the warning was created)
GET / 200 in 3604ms
✓ Compiled /api/chat in 389ms
userID undefined
model {
id: 'claude-3-5-sonnet-latest',
provider: 'Anthropic',
providerId: 'anthropic',
name: 'Claude 3.5 Sonnet',
multiModal: true
}
⨯ APICallError [AI_APICallError]: x-api-key header is required
at C:\Users\nkura\fragments.next\server\chunks\node_modules_f69b7b..js:379:24
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async postToApi (C:\Users\nkura\fragments.next\server\chunks\node_modules_f69b7b..js:293:36)
at async AnthropicMessagesLanguageModel.doStream (C:\Users\nkura\fragments.next\server\chunks\node_modules_dc6348..js:827:54)
at async fn (C:\Users\nkura\fragments.next\server\chunks\node_modules_ai_dist_index_mjs_1ce7e4..js:1831:37)
at async C:\Users\nkura\fragments.next\server\chunks\node_modules_ai_dist_index_mjs_1ce7e4..js:282:28
at async retryWithExponentialBackoff (C:\Users\nkura\fragments.next\server\chunks\node_modules_ai_dist_index_mjs_1ce7e4..js:134:16)
at async fn (C:\Users\nkura\fragments.next\server\chunks\node_modules_ai_dist_index_mjs_1ce7e4..js:1803:81)
at async C:\Users\nkura\fragments.next\server\chunks\node_modules_ai_dist_index_mjs_1ce7e4..js:282:28
at async POST (C:\Users\nkura\fragments.next\server\chunks_5c5eb1..js:220:20)
at async C:\Users\nkura\fragments\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:55759
at async eO.execute (C:\Users\nkura\fragments\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:46527)
at async eO.handle (C:\Users\nkura\fragments\node_modules\next\dist\compiled\next-server\app-route.runtime.dev.js:6:57093)
at async doRender (C:\Users\nkura\fragments\node_modules\next\dist\server\base-server.js:1345:42)
at async cacheEntry.responseCache.get.routeKind (C:\Users\nkura\fragments\node_modules\next\dist\server\base-server.js:1567:28)
at async DevServer.renderToResponseWithComponentsImpl (C:\Users\nkura\fragments\node_modules\next\dist\server\base-server.js:1475:28)
at async DevServer.renderPageComponent (C:\Users\nkura\fragments\node_modules\next\dist\server\base-server.js:1901:24)
at async DevServer.renderToResponseImpl (C:\Users\nkura\fragments\node_modules\next\dist\server\base-server.js:1939:32)
at async DevServer.pipeImpl (C:\Users\nkura\fragments\node_modules\next\dist\server\base-server.js:914:25)
at async NextNodeServer.handleCatchallRenderRequest (C:\Users\nkura\fragments\node_modules\next\dist\server\next-server.js:272:17)
at async DevServer.handleRequestImpl (C:\Users\nkura\fragments\node_modules\next\dist\server\base-server.js:810:17)
at async C:\Users\nkura\fragments\node_modules\next\dist\server\dev\next-dev-server.js:339:20
at async Span.traceAsyncFn (C:\Users\nkura\fragments\node_modules\next\dist\trace\trace.js:154:20)
at async DevServer.handleRequest (C:\Users\nkura\fragments\node_modules\next\dist\server\dev\next-dev-server.js:336:24)
at async invokeRender (C:\Users\nkura\fragments\node_modules\next\dist\server\lib\router-server.js:173:21)
at async handleRequest (C:\Users\nkura\fragments\node_modules\next\dist\server\lib\router-server.js:350:24)
at async requestHandlerImpl (C:\Users\nkura\fragments\node_modules\next\dist\server\lib\router-server.js:374:13)
at async Server.requestListener (C:\Users\nkura\fragments\node_modules\next\dist\server\lib\start-server.js:141:13) {
url: 'https://api.anthropic.com/v1/messages',
requestBodyValues: {
model: 'claude-3-5-sonnet-latest',
top_k: undefined,
max_tokens: 4096,
temperature: 0,
top_p: undefined,
system: '\n' +
' You are a skilled software engineer.\n' +
' You do not make mistakes.\n' +
' Generate an fragment.\n' +
' You can install additional dependencies.\n' +
' Do not touch project dependencies files like package.json, package-lock.json, requirements.txt, etc.\n' +
' You can use one of the following templates:\n' +
' 1. code-interpreter-v1: "Runs code as a Jupyter notebook cell. Strong data analysis angle. Can use complex visualisation to explain results.". File: script.py. Dependencies installed: python, jupyter, numpy, pandas, matplotlib, seaborn, plotly. Port: none.\n' +
'2. nextjs-developer: "A Next.js 13+ app that reloads automatically. Using the pages router.". File: pages/index.tsx. Dependencies installed: nextjs@14.2.5, typescript, @types/node, @types/react, @types/react-dom, postcss, tailwindcss, shadcn. Port: 3000.\n' +
'3. vue-developer: "A Vue.js 3+ app that reloads automatically. Only when asked specifically for a Vue app.". File: app.vue. Dependencies installed: vue@latest, nuxt@3.13.0, tailwindcss. Port: 3000.\n' +
'4. streamlit-developer: "A streamlit app that reloads automatically.". File: app.py. Dependencies installed: streamlit, pandas, numpy, matplotlib, request, seaborn, plotly. Port: 8501.\n' +
'5. gradio-developer: "A gradio app. Gradio Blocks/Interface should be called demo.". File: app.py. Dependencies installed: gradio, pandas, numpy, matplotlib, request, seaborn, plotly. Port: 7860.\n' +
' ',
messages: [ [Object] ],
tools: [ [Object] ],
stream: true
},
statusCode: 401,
responseHeaders: {
'cf-cache-status': 'DYNAMIC',
'cf-ray': '8df6c782fc0dca20-OTP',
connection: 'keep-alive',
'content-length': '97',
'content-type': 'application/json',
date: 'Fri, 08 Nov 2024 16:01:02 GMT',
'request-id': 'req_01HUPtAJLD3vjginqH7JN7nq',
server: 'cloudflare',
via: '1.1 google',
'x-robots-tag': 'none',
'x-should-retry': 'false'
},
responseBody: '{"type":"error","error":{"type":"authentication_error","message":"x-api-key header is required"}}',
cause: undefined,
isRetryable: false,
data: {
type: 'error',
error: {
type: 'authentication_error',
message: 'x-api-key header is required'
}
}
}
POST /api/chat 500 in 960ms