06 Reference logo

06 Reference

Community
SystemTce
06-reference

Dify 参考资料 - DSL语法、API文档、SDK参考、CLI命令

Overview

PublisherSystemTce
Repositorydify-skills
Skill name06-reference
Stars
37
Forks
11
Bundled files
4
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by SystemTce on GitHub. Read the source before you install it.

Installation

Install the 06 Reference AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/SystemTce/dify-skills/tree/main/06-reference
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/SystemTce/dify-skills.git /tmp/dify-skills
mkdir -p .claude/skills
cp -r /tmp/dify-skills/06-reference .claude/skills/06-reference
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable 06 Reference in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads 06 Reference on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so 06 Reference is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Dify 参考资料 SKILL

查找语法、API、CLI 等参考信息

快速导航


DSL 语法参考

工作流 DSL 结构

yaml
version: 0.0.1
graph:
  nodes:
    - id: node_id
      data:
        type: node_type
        # 节点配置
  edges:
    - source: source_node_id
      target: target_node_id

节点类型

类型说明必需字段
start开始节点variables
llmLLM 节点model, prompt_template
agentAgent 节点agent_parameters
knowledge-retrieval知识检索dataset_ids, query_variable_selector
http-requestHTTP 请求url, method, headers
code代码执行code_type, code
tool工具节点provider_type, tool_name
if-else条件分支conditions
iteration迭代iterator_variable_name
loop循环max_loop_count
answer响应节点answer

变量引用

yaml
# 系统变量
{{#sys.query#}}           # 用户查询
{{#sys.files#}}           # 上传的文件
{{#sys.conversation_id#}} # 会话 ID

# 节点输出
{{#node_id.output_field#}}

# 数组访问
{{#items[0]#}}           # 数组第一个元素
{{#items[-1]#}}          # 数组最后一个元素

# 对象属性
{{#object.field#}}       # 对象属性

完整示例

yaml
workflow:
  graph:
    nodes:
      - id: start
        data:
          type: start
          variables:
            - name: query
              type: text
              required: true

      - id: classify
        data:
          type: question-classifier
          instruction: "分类用户问题"
          categories:
            - name: technical
              description: 技术问题
            - name: general
              description: 一般问题

      - id: llm
        data:
          type: llm
          model:
            provider: openai
            name: gpt-4
          prompt_template:
            - role: system
              text: "你是一个助手"
            - role: user
              text: "{{#start.query#}}"
          context:
            enabled: false

      - id: answer
        data:
          type: answer
          answer: "{{#llm.text#}}"

    edges:
      - source: start
        target: classify
      - source: classify
        target: llm
        source_handle: general
      - source: llm
        target: answer

API 参考

认证

所有 API 请求需要在 Header 中携带 API Key:

Authorization: Bearer YOUR_API_KEY

端点概览

应用 API
端点方法说明
/v1/chat-messagesPOST发送聊天消息
/v1/completionsPOST文本补全
/v1/parametersGET获取应用参数
/v1/file-uploadPOST文件上传
工作流 API
端点方法说明
/v1/workflows/runPOST运行工作流
/v1/workflows/runGET获取运行状态
/v1/workflows/tasksGET获取任务列表
数据集 API
端点方法说明
/v1/datasetsGET列出数据集
/v1/datasetsPOST创建数据集
/v1/datasets/{id}/documentsGET列出文档
/v1/datasets/{id}/retrievePOST检索知识

请求/响应格式

聊天消息请求
json
{
  "query": "用户查询",
  "user": "user_123",
  "conversation_id": "可选的会话ID",
  "response_mode": "blocking | streaming",
  "files": [
    {
      "type": "image",
      "transfer_method": "remote_url",
      "url": "https://example.com/image.jpg"
    }
  ],
  "retrieval_model": {
    "query": "{{#sys.query#}}",
    "top_k": 3
  }
}
聊天消息响应
json
{
  "message_id": "msg_xxx",
  "conversation_id": "conv_xxx",
  "answer": "AI 回复内容",
  "metadata": {
    "usage": {
      "prompt_tokens": 100,
      "completion_tokens": 50,
      "total_tokens": 150
    },
    "retrieval_resources": [
      {
        "position": 1,
        "document_id": "doc_xxx",
        "content": "相关文档内容..."
      }
    ]
  }
}

错误响应

json
{
  "code": "invalid_api_key",
  "message": "Invalid API key",
  "status_code": 401
}

常见错误码:

错误码HTTP 状态码说明
invalid_api_key401API Key 无效
invalid_parameter400参数错误
quota_exceeded403配额超出
rate_limit_exceeded429速率限制
internal_server_error500服务器错误

SDK 参考

Python SDK

安装
bash
pip install dify-client
基本用法
python
from dify_client import DifyClient

# 初始化客户端
client = DifyClient(
    api_key="app-xxx",
    base_url="https://api.dify.ai/v1"
)

# 发送聊天消息
response = client.chat.messages.create(
    query="你好",
    user="user_123"
)
print(response.answer)
流式响应
python
from dify_client import DifyClient

client = DifyClient(api_key="app-xxx")

# 流式聊天
for event in client.chat.messages.stream(
    query="讲个故事",
    user="user_123"
):
    if event.event == "message":
        print(event.data.answer, end="")
工作流执行
python
# 运行工作流
response = client.workflows.run(
    inputs={"query": "测试"},
    user="user_123",
    response_mode="blocking"
)
print(response.data.output)

SDK 类参考

DifyClient
python
class DifyClient:
    def __init__(self, api_key: str, base_url: str = "https://api.dify.ai/v1"):
        """初始化客户端"""
        pass

    @property
    def chat(self) -> ChatClient:
        """聊天客户端"""
        pass

    @property
    def workflows(self) -> WorkflowClient:
        """工作流客户端"""
        pass

    @property
    def datasets(self) -> DatasetClient:
        """数据集客户端"""
        pass
ChatClient
python
class ChatClient:
    def create(self, query: str, user: str, **kwargs) -> ChatMessage:
        """发送聊天消息(阻塞)"""
        pass

    def stream(self, query: str, user: str, **kwargs) -> Iterator[ChatEvent]:
        """发送聊天消息(流式)"""
        pass

CLI 参考

安装

bash
pip install dify-cli

命令概览

插件命令
bash
# 初始化插件
dify plugin init [options]

# 运行插件
dify plugin run [options]

# 打包插件
dify plugin package [options]

# 发布插件
dify plugin publish [options]

# 列出已安装插件
dify plugin list
工作流命令
bash
# 导出工作流
dify workflow export <workflow_id> [options]

# 导入工作流
dify workflow import <file> [options]

# 验证工作流
dify workflow validate <file>

# 运行工作流
dify workflow run <workflow_id> --inputs '{}'
应用命令
bash
# 列出应用
dify app list

# 获取应用信息
dify app info <app_id>

# 部署应用
dify app deploy <app_id>
环境变量命令
bash
# 列出环境变量
dify env list

# 设置环境变量
dify env set <key> <value>

# 获取环境变量
dify env get <key>

# 删除环境变量
dify env delete <key>

选项说明

选项简写说明默认值
--api-key-kAPI Key环境变量 DIFY_API_KEY
--base-url-b基础 URLhttps://api.dify.ai/v1
--output-o输出格式json
--quiet-q静默模式false
--debug-d调试模式false

使用示例

bash
# 设置 API Key
export DIFY_API_KEY="app-xxx"

# 初始化插件项目
dify plugin init my-plugin --template tool

# 运行插件
dify plugin run --port 5000

# 导出工作流
dify workflow export wf_xxx -o workflow.yaml

# 导入工作流
dify workflow import workflow.yaml

常见问题

API 相关

Q: 如何获取 API Key? A: 在 Dify 控制台 -> 设置 -> API 中创建。

Q: 请求频率限制是多少? A: 默认 60 请求/分钟,可申请提升。

Q: 如何处理流式响应? A: 使用 response_mode=streaming,解析 SSE 事件。

工作流相关

Q: 如何引用变量? A: 使用 {{#node_id.field#}} 语法。

Q: 支持哪些节点类型? A: 详见节点类型表格。

Q: 如何处理循环? A: 使用 iteration 或 loop 节点。

插件相关

Q: 如何开发自定义插件? A: 参考 02-plugin SKILL。

Q: 插件如何获取凭据? A: 使用 self.runtime_credentials。


相关 SKILL


相关资源


版本信息: v1.0.0 | 最后更新: 2026-03-05

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the 06 Reference AI skill do?

Dify 参考资料 - DSL语法、API文档、SDK参考、CLI命令

Why use 06 Reference on TypingMind?

Because you install it once and use it with any model. 06 Reference is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install 06 Reference in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/SystemTce/dify-skills/tree/main/06-reference. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use 06 Reference?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with 06 Reference?

As many as you like. As long as a model supports skills, you can use 06 Reference with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the 06 Reference AI skill free?

It is published on GitHub by SystemTce. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇