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

@orangemust/dify-cli

v0.2.3

Published

CLI for interacting with Dify applications

Readme

@orangemust/dify-cli

A command-line interface for interacting with Dify applications.

npm version


Installation

For Humans

Copy and paste this prompt to your LLM agent (Claude Code, Cursor, Codex, etc.):

Install and configure dify-cli by following the instructions here:
https://raw.githubusercontent.com/mack-peng/dify-cli/main/docs/guide/installation.md

Or read the Installation Guide, but seriously, let an agent do it. Humans fat-finger configs.

For LLM Agents

Fetch the installation guide and follow it:

curl -s https://raw.githubusercontent.com/mack-peng/dify-cli/main/docs/guide/installation.md

Quick Start

Install

npm install -g @orangemust/dify-cli

# Or run without installing:
# npx @orangemust/dify-cli chat send "hello"

1. Configure API Key

Dify 有两种 API Key,互不通用。配置哪个 key,后续命令就操作哪个资源。

# 操作应用(chat/completion/workflow)用 app- 开头的 key
dify-cli config init --api-key app-xxxx

# 操作知识库用 dataset- 开头的 key
dify-cli config init --api-key dataset-xxxx

# 自部署需指定 base-url
dify-cli config init --api-key app-xxxx --base-url https://dify.example.com/v1

切换操作对象时重新 config init,或用 --api-key 临时覆盖: dify-cli chat send "hello" --api-key app-xxxx dify-cli knowledge list --api-key dataset-xxxx

2. Try It

# 如果配了 app key
dify-cli info

# 如果配了 dataset key
dify-cli knowledge list

API Keys

| Type | Prefix | Commands | |------|--------|----------| | App Key | app- | info, chat, completion, chatflow, workflow, conversation, file, audio, feedback, annotation | | Dataset Key | dataset- | knowledge (datasets, documents, segments) |

Config file (~/.dify/config.json) holds one key at a time. Switch by re-running config init or override per-command with --api-key.


Configuration

# Initialize
dify-cli config init --api-key <key> --base-url <url> --default-user <user>

# Set individual values
dify-cli config set apiKey <key>
dify-cli config set baseUrl https://api.dify.ai/v1

# Get config
dify-cli config get
dify-cli config get apiKey

Priority: CLI flags > Environment variables > Config file

DIFY_API_KEY       API key
DIFY_BASE_URL      API base URL (default: https://api.dify.ai/v1)
DIFY_DEFAULT_USER  User identifier (default: cli-user)

Commands

App Info

dify-cli info                    # Get app info
dify-cli parameters              # Get app parameters
dify-cli meta                    # Get app meta
dify-cli site                    # Get WebApp settings

Chat App

dify-cli chat send "message"                    # Blocking
dify-cli chat send "message" --mode streaming   # Streaming
dify-cli chat send "message" -c <conversation_id>  # Continue conversation
dify-cli chat stop <task_id>                    # Stop generation
dify-cli chat feedback <message_id> -r like     # Feedback
dify-cli chat suggested <message_id>            # Suggested questions

Completion App

dify-cli completion send "prompt"
dify-cli completion send "prompt" --mode streaming
dify-cli completion stop <task_id>

Chatflow App

dify-cli chatflow send "message"
dify-cli chatflow stop <task_id>
dify-cli chatflow feedback <message_id> -r like

Workflow App

dify-cli workflow run
dify-cli workflow run --inputs '{"key":"value"}'
dify-cli workflow stop <task_id>
dify-cli workflow logs
dify-cli workflow detail <run_id>

Knowledge Base

dify-cli knowledge list
dify-cli knowledge create "My Knowledge"
dify-cli knowledge get <dataset_id>
dify-cli knowledge update <dataset_id> --name "New Name"
dify-cli knowledge delete <dataset_id>

# Documents
dify-cli knowledge document list <dataset_id>
dify-cli knowledge document create-text <dataset_id> --name "Doc" --text "content"
dify-cli knowledge document create-text <dataset_id> --name "Doc" --text "content" --process-rule-mode custom --max-tokens 500 --overlap 50
dify-cli knowledge document create-file <dataset_id> --file ./doc.pdf
dify-cli knowledge document create-file <dataset_id> --file ./doc.pdf --process-rule-mode custom --separator "\n" --max-tokens 500 --overlap 50 --remove-extra-spaces
dify-cli knowledge document get <dataset_id> <document_id>
dify-cli knowledge document delete <dataset_id> <document_id>
dify-cli knowledge document status <dataset_id> <batch>

# Segments
dify-cli knowledge segment list <dataset_id> <document_id>
dify-cli knowledge segment create <dataset_id> <document_id> --content "text"
dify-cli knowledge segment update <dataset_id> <document_id> <segment_id> --content "text"
dify-cli knowledge segment delete <dataset_id> <document_id> <segment_id>

# Retrieve
dify-cli knowledge retrieve <dataset_id> --query "search text"
dify-cli knowledge retrieve <dataset_id> --query "test" --retrieval-model '{"search_method":"hybrid_search","reranking_enable":false,"top_k":5,"score_threshold_enabled":false}'

Conversation

dify-cli conversation list
dify-cli conversation get <conversation_id>
dify-cli conversation rename <conversation_id> -n "New Name"
dify-cli conversation delete <conversation_id>
dify-cli conversation variables <conversation_id>

File

dify-cli file upload <file_path>
dify-cli file preview <file_id>

Audio

dify-cli audio to-text <audio_file>
dify-cli audio to-audio "text to speak"

Feedback

dify-cli feedback list --app-type chat

Annotations

dify-cli annotation create -q "question" -a "answer"
dify-cli annotation list
dify-cli annotation update <id> -q "new question" -a "new answer"
dify-cli annotation delete <id>
dify-cli annotation reply-config

Global Options

--api-key <key>      Override API key
--base-url <url>     Override base URL
--user <id>          User identifier (default: cli-user)

Development

npm install
npm run build
npm run watch
npx tsc --noEmit

License

MIT