{"id":23139494,"url":"https://github.com/ezzcodeezzlife/dalle-node","last_synced_at":"2025-07-10T12:36:47.011Z","repository":{"id":37580435,"uuid":"495808863","full_name":"ezzcodeezzlife/dalle-node","owner":"ezzcodeezzlife","description":"Use DALL·E 2 with Nodejs","archived":false,"fork":false,"pushed_at":"2022-10-06T17:01:26.000Z","size":42,"stargazers_count":99,"open_issues_count":5,"forks_count":17,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-12T19:02:19.039Z","etag":null,"topics":["ai","api","dall-e","gpt-3","gpt3","javascript","js","next","nodejs","npm","openai","package","react"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/dalle-node","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ezzcodeezzlife.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-24T12:15:33.000Z","updated_at":"2024-11-30T05:45:28.000Z","dependencies_parsed_at":"2022-08-08T21:00:28.381Z","dependency_job_id":null,"html_url":"https://github.com/ezzcodeezzlife/dalle-node","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezzcodeezzlife%2Fdalle-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezzcodeezzlife%2Fdalle-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezzcodeezzlife%2Fdalle-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ezzcodeezzlife%2Fdalle-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ezzcodeezzlife","download_url":"https://codeload.github.com/ezzcodeezzlife/dalle-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230121617,"owners_count":18176477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","api","dall-e","gpt-3","gpt3","javascript","js","next","nodejs","npm","openai","package","react"],"created_at":"2024-12-17T13:14:19.316Z","updated_at":"2024-12-17T13:14:19.390Z","avatar_url":"https://github.com/ezzcodeezzlife.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup\n\n1. Go to https://openai.com/dall-e-2/\n2. Create a OpenAI Account\n3. Go to https://labs.openai.com/\n4. Open the Network Tab in Developer Tools\n5. Type a prompt and press \"Generate\"\n6. Look for fetch to https://labs.openai.com/api/labs/tasks\n7. In the request header look for authorization then get the Bearer Token\n\n\n# Usage\n```bash\nnpm install dalle-node\n```\n```javascript\nimport { Dalle } from \"dalle-node\";\n\nconst dalle = new Dalle(\"sess-xxxxxxxxxxxxxxxxxxxxxxxxx\"); // Bearer Token \n\n(async () =\u003e {\n  const generations = await dalle.generate(\"a cat driving a car\");\n\n  console.log(generations)\n})();\n```\n\n```\n[\n  {\n    id: 'generation-sCnERSYDPP0Zu14fsdXEcKmL',\n    object: 'generation',\n    created: 1553332711,\n    generation_type: 'ImageGeneration',\n    generation: {\n      image_path: 'https://openailabsprodscus.blob.core.windows.net/private/user-hadpVzldsfs28CwvEZYMUT/generations/generation...'\n    },\n    task_id: 'task-nERkiKsdjVCSZ50yD69qewID',\n    prompt_id: 'prompt-2CtaLQsgUbJHHDoJQy9Lul3T',\n    is_public: false\n  },\n  // 3 more ... \n]\n```\n\n## Functions\n\n### `constructor`\n\n```javascript\nimport { Dalle } from \"dalle-node\";\n\nconst dalle = new Dalle(\"sess-xxxxxxxxxxxxxxxxxxxxxxxxx\"); // Bearer Token \n```\n\n### `generate(prompt: string)`\n\nGenerate Dall-e images using the prompt passed in.\n\n```javascript\nconst generations = await dalle.generate(\"a cat driving a car\");\n```\n\nReturns an array of generations.\n\n### `list({ limit: number, fromTs: number })`\n\nGet previous tasks.\n\n```javascript\nconst last10Runs= await dalle.list({ limit: 10 });\n```\n\n```javascript\nconst allRunsAfterTimestamp = await dalle.list({ fromTs: 1553456789 });\n```\n\nReturns an array of tasks. Note - what generate() returns is consider a single task. Each image inside a task is a \"generation\". The objects in the returned array will have a `prompt` property, a `generations` array, as well as other properties.\n\n### `getTask(taskId: string)`\n\n```javascript\nconst task = await dalle.getTask(\"task-nERkiKsdjVCasdyD69qewID\");\n```\n\nReturns a task object.\n\n### `getCredits()`\n\n```javascript\nconst creditsSummary = await dalle.getCredits();\nconst totalCreditsLeft = creditsSummary.aggregate_credits;\n```\n\nReturns an object with the following properties.\n\n```json\n{\n  \"aggregate_credits\": 180,\n  \"next_grant_ts\": 123456789,\n  \"breakdown\": {\n    \"free\": 0,\n    \"grant_beta_tester\": 65,\n    \"paid_dalle_15_115\": 115\n  },\n  \"object\": \"credit_summary\"\n}\n```\n\nTo get the date + time that the free credits will refresh:\n\n```javascript\nconst credits = await dalle.getCredits()\nconsole.log('Free credits refresh on:', new Date(credits.next_grant_ts * 1000).toLocaleString());\n```\n\n# Examples\n\n[Nextjs Application](https://github.com/1998code/DALLE-2-App)\n\n# Other languages\n\n[Repo for the same thing as Python Package \"ezzcodeezzlife/dalle2-in-python\"](https://github.com/ezzcodeezzlife/dalle2-in-python)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fezzcodeezzlife%2Fdalle-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fezzcodeezzlife%2Fdalle-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fezzcodeezzlife%2Fdalle-node/lists"}