Open
Description
I am consistently receiving a 429 "You exceeded your current quota" error when using the @gptscript-ai/gptscript
library, even though my OpenAI API key is valid, has available quota, and works with direct API calls (e.g., curl
). This occurs even with a minimal GPTScript file and test script.
My project repository is here:
https://github.com/sarmad341/storyteller-ai-build
- Environment:
- Node.js version: (e.g., v22.16.0)
- OS: (e.g., Windows 10)
@gptscript-ai/gptscript
version: (latest as of today)- OpenAI account: Sufficient quota, key works with direct API calls
2. Minimal GPTScript file (story-book.gpt
):
I have checked through this script, the script in repo link is original one.
tools: story-writer, mkdir, sys.write, sys.read, sys.abort
description: Writes a children's book (no illustrations for testing).
args: story: The story to write. Can be a prompt or a complete story.
args: pages: The number of pages to generate
args: path: The path that the story should be written to
Do the following steps one after the other without skipping any or ending early:
1. If the ${story} is inappropriate for children, abort the process and cite the reason why.
2. Come up with an appropriate title for the story based on the ${story}.
3. Create the `${path}/${story-title}` directory if it does not already exist. Replace any spaces in the title with - when creating the directory.
4. If the ${story} is a prompt and not a complete children's story, call story-writer to write a story based on the prompt.
5. If the generated story is not appropriate for children, abort the process and cite the reason why.
6. For every page of the story you got from the story-writer, do the following:
- For the content of the page, write it to `${path}/${story-title}/page-<page_number>.txt`.
3. Test Script
This file also not in the repo link:
const { GPTScript } = require("@gptscript-ai/gptscript");
const path = require("path");
const g = new GPTScript({ APIKey: "sk-..." }); // My actual key
async function test() {
try {
const scriptPath = path.join(__dirname, "app", "api", "run-script", "story-book.gpt");
const opts = {
disableCache: true,
input: "---story A brave cat ---pages 1 ---path ./test-output"
};
const result = await g.run(scriptPath, opts);
const output = await result.text();
console.log("Success! Output:", output);
} catch (e) {
console.error("Error from gptscript:", e);
}
}
test();
4. Result
Always receive:
Error from gptscript: Error: error, status code: 429, 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.
5. What I’ve Tried
- Verified my API key works with
curl
and the official OpenAI Node.js SDK. - Confirmed my account has available quota and no usage.
- Removed all image generation and DALL·E steps from the script.
- Updated
@gptscript-ai/gptscript
to the latest version. - Tried generating a new API key.
- Tried specifying the
organization
parameter (if supported).
Expected Behavior
The script should run and generate output, as my API key is valid and has quota.
Actual Behavior
Always receive a 429 error from the library, even though the key works with direct OpenAI API calls.
Additional Context
- This issue occurs even with the most minimal script and test case.
- My API key is not restricted and works for both chat and completions endpoints.
- Please advise if there are any additional configuration steps or if this is a known issue.
Metadata
Metadata
Assignees
Labels
No labels