npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

directus-extension-genmagic

v1.0.0

Published

Generate images, video and speech from a Flow with Veo, Kling, Flux and the other models on GenMagic.

Readme

GenMagic for Directus

Generate images, video and speech from inside a Directus Flow. Add the GenMagic step, pick what to make, and the next step gets a link to the finished file and what it cost. Models include Veo, Kling, Flux and the other image, video and voice models on GenMagic.

It runs in the Directus sandbox, so it works on Directus Cloud and on self-hosted projects that keep the default Marketplace settings. Tested on Directus 11.17 and 12.6.

Set up

  1. In Directus, open Settings, Marketplace, search for GenMagic and install it. On a self-hosted project you can also run npm install directus-extension-genmagic in your extensions folder.
  2. Get a GenMagic API key. A free key is at genmagic.co/get-api-key. Each generation is billed from your GenMagic balance at the price shown for that model on genmagic.co/models.
  3. In Settings, Flows, create or open a Flow, add a step, and choose GenMagic.
  4. Paste the key into GenMagic API key (the field is masked), choose an Action, and fill in the prompt or text.

To keep the key out of the Flow, store it as an environment variable, list its name in FLOWS_ENV_ALLOW_LIST (for example GENMAGIC_API_KEY) and put {{ $env.GENMAGIC_API_KEY }} in the key field.

The step

One step does all three jobs. The Action dropdown decides which fields show.

| Action | Field | What to enter | |---|---|---| | All | GenMagic API key | Your key. Masked. | | All | Model | A model id from genmagic.co/models, such as provider/model-name. Leave it empty to use GenMagic's default for that action. | | Generate Image | Prompt | What to draw. {{ }} references to earlier steps work. | | Generate Image | Size | 1024x1024, 1792x1024 or 1024x1792. Optional. | | Generate Image, Generate Video | Reference image URL | Optional. An https URL (or data:image URL) to edit, or to open the video on. | | Generate Video | Prompt | What happens in the clip. | | Generate Video | Aspect ratio | 16:9, 9:16 or 1:1. Optional. | | Generate Video | Duration (seconds) | Optional. Must be a length the chosen model offers. The price grows with it. | | Generate Video | Max wait (seconds) | How long the step waits for the clip. Default 600, from 10 to 3600. | | Text to Speech | Text to speak | The words to read aloud. | | Text to Speech | Voice | Optional voice name, for example alloy. |

If you type a model id that does not exist, or one that makes the wrong kind of file for the chosen action, the step says so before anything is billed.

What the step returns

The next steps can read these as {{ your_step_key.url }} and so on.

| Key | Meaning | |---|---| | action | image, video or speech | | url | Link to the finished file, hosted by GenMagic | | cost_cents | What this call cost, in US cents (can be fractional). null if GenMagic did not report it. | | credits_remaining_cents | Your balance after the call, in US cents. null if not reported. | | id | Video only: the GenMagic job id |

Example: a cover image for every new article

  1. Trigger: Event Hook, type Action (Non-Blocking), event items.create, collection articles.
  2. GenMagic with key cover: Action Generate Image, Prompt Editorial illustration for an article titled: {{ $trigger.payload.title }}.
  3. Webhook / Request URL with key import: method POST, URL https://your-project.example.com/files/import, a header Authorization: Bearer <a static token of a user who can create files>, and body { "url": "{{ cover.url }}" }.
  4. An Update Data step that stores {{ import.data.data.id }} in the article's image field.

Video takes minutes

Generate Video starts the job, then checks on it every few seconds until the clip is ready or Max wait runs out. A clip usually takes a few minutes, so do not put it in a Flow that makes a person or a web request wait. Use an Event Hook set to Action (Non-Blocking), a Schedule, or a Webhook with Asynchronous switched on.

If Max wait runs out, the step fails and its message names the job id. GenMagic keeps rendering that job and bills it only if it completes. Raise Max wait to wait longer.

When something goes wrong

The step takes the Flow's reject path and $last.message says what happened. Directus's sandbox only tells an extension the HTTP status of a refused call, not the reply text, so the message states what that status means for GenMagic: a missing or wrong key (401), a balance too low for the call (402), a rate limit of 300 requests a minute (429), or a request GenMagic refused (400). A video that fails while rendering reports GenMagic's own reason.

Permissions

The extension runs in the Directus sandbox and asks for three things only: write a line to the server log, wait between video checks, and send GET and POST requests to https://genmagic.co/api/v1/. It cannot reach your database, your files or any other website. What it sends to GenMagic is your key, the prompt or text, the model, the options above, and the reference image URL if you set one.

Links

MIT licensed.