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-ai-field

v1.0.2

Published

Generate content with AI in any Directus field using Claude, GPT, Gemini, Mistral, or DeepSeek.

Readme

directus-extension-ai-field

Generate content with Claude, GPT, Gemini, Mistral, or DeepSeek directly inside any Directus field — no copy-pasting, no tab switching.

npm version License: MIT Directus 11+

Generate Button


Features

  • ✦ Generate button on any string or text field
  • 5 AI providers — Claude (Anthropic), GPT-4o mini (OpenAI), Gemini 2.0 Flash (Google), Mistral Small (Mistral AI), DeepSeek Chat (DeepSeek)
  • Reference any field in your prompt using {{fieldName}} syntax
  • Tone control — formal, casual, technical, or default
  • Generation history — last 3 results, click to restore
  • Regenerate button to get a new result without retyping
  • Secure — API keys stay on the server, endpoint requires Directus authentication

Installation

cd your-directus-project/extensions
git clone https://github.com/mohammedwahba2/directus-extension-ai-field
cd directus-extension-ai-field
npm install
npm run build

Restart Directus after installation.


Configuration

Add your API keys to your Directus .env — you only need the provider(s) you plan to use:

ANTHROPIC_API_KEY=your_key_here
OPENAI_API_KEY=your_key_here
GEMINI_API_KEY=your_key_here
MISTRAL_API_KEY=your_key_here
DEEPSEEK_API_KEY=your_key_here

Usage

  1. Go to Settings → Data Model
  2. Open any collection and add or edit a String or Text field
  3. Under Interface, choose AI Field
  4. Pick your provider, tone, and prompt template
  5. Save — the ✦ Generate button will appear on every item

After Creating Field


Prompt Templates

Use {{value}} to reference the current field value, or {{fieldName}} to reference other fields in the same item:

Write an SEO meta description for: {{title}} in category {{category}}
Summarize the following article in 2 sentences: {{body}}
Translate to Arabic: {{value}}

Provider Examples

Claude

Claude Example

GPT-4o mini

GPT Example

Gemini 2.0 Flash

Gemini Example


Options

| Option | Description | Default | |---|---|---| | Provider | Claude, GPT, Gemini, Mistral, or DeepSeek | Claude | | Tone | default, formal, casual, technical | default | | Prompt Template | Template with {{value}} or {{fieldName}} | Write content for: {{value}} | | Max Tokens | Max length of generated content (1–4096) | 500 |


Requirements

  • Directus 11+
  • Node.js 22+
  • API key for at least one provider

Security

  • API keys are stored in environment variables and never exposed to the browser
  • The /generate endpoint requires a valid Directus session (any logged-in user)
  • To restrict generation to specific roles, add a permission check in src/endpoint/router.ts

Troubleshooting

| Error | Fix | |---|---| | ANTHROPIC_API_KEY is not configured | Add the key to .env and restart Directus | | Unauthorized | Make sure you're logged in to Directus | | Empty output | Increase Max Tokens in the field options | | Build errors | Make sure you're on Node.js 22+ and ran npm install inside the extension folder |


License

MIT © Mohamed Wahba