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

@4tk/openclaw-provider-4tk

v0.3.1

Published

OpenClaw provider plugin for 4TK.ai (Responses + Images + Embeddings + Speech)

Downloads

1,174

Readme

OpenClaw 4TK Provider Plugin

@4tk/openclaw-provider-4tk 是 4TK 的 OpenClaw provider 插件,用于将 4TK 能力接入 OpenClaw。

V1 能力

  • 对话/推理 provider(openai-responses
  • gpt-5.5 / gpt-5.4xhigh 能力声明(supportsXHighThinking hook)
  • 图像生成/编辑 provider(OpenAI Images:/v1/images/generations/v1/images/edits;编辑使用 multipart/form-data 上传图片)
  • Embedding 适配(createEmbeddingProvider
  • Memory embedding adapter(registerMemoryEmbeddingProvider,可被 openclaw memory / capability 识别)
  • Speech/TTS provider(registerSpeechProvider
  • 默认策略:
    • memory: 默认开启;当默认主模型是 4tk/*memorySearch.provider=auto 时,会自动补成 4tk
    • TTS: 默认关闭;若 defaults.enableTtsByDefault=true,会自动补 talk.provider=4tk 和默认语音模型
    • image: 默认补 agents.defaults.imageGenerationModel4tk/gpt-image-2
    • thinking: 4tk/gpt-5.5 新会话默认 xhigh

安装

当前可用安装渠道:npm(@4tk/[email protected]

openclaw plugins install @4tk/openclaw-provider-4tk

0.3.0 迁移说明

0.3.0 起 provider id 从 fourtk 改为 4tk。这是一次破坏性重命名,升级后请同步迁移本机配置与鉴权:

openclaw models auth login --provider 4tk --method api-key --set-default

需要检查并替换的旧引用:

  • 模型:fourtk/gpt-5.5 -> 4tk/gpt-5.5
  • provider:fourtk -> 4tk
  • 插件配置:plugins.entries["fourtk-provider"] -> plugins.entries["4tk-provider"]
  • 旧手写配置:models.providers.fourtk -> models.providers.4tk

迁移后重启 gateway / TUI,让 provider、auth profile 和模型目录刷新。

鉴权(推荐:写入 OpenClaw auth profile)

仅设置 FOURTK_API_KEY 可能不会被当前 agent 会话读取(会出现 missingProvidersInUse)。 推荐使用 models auth login 写入 OpenClaw 的 auth profile。

openclaw models auth login --provider 4tk --method api-key --set-default

执行后按提示粘贴 4TK 子令牌,会自动:

  • 写入 OpenClaw auth profile(当前 agent 可直接读取)
  • 将默认模型设为插件建议值(4tk/gpt-5.5
  • agents.defaults.model.primary 已是 4tk/*memorySearch.provider=auto 时,自动将 memory provider 补为 4tk

注意:插件不会覆盖你已经显式写死的 agents.defaults.memorySearch.provider(例如 openai / voyage);只会在值为 auto 的场景下自动收敛。

如需临时调试,也可以设置环境变量:

export FOURTK_API_KEY="你在控制台创建的子令牌"

推荐模型

  • 主模型:4tk/gpt-5.5(支持 xhigh 与图片输入)
  • 兼容模型:4tk/gpt-5.4
  • 图像生成/编辑默认模型:4tk/gpt-image-2

xhigh 依赖两处一致:OpenClaw 的 supportsXHighThinking hook,以及请求层 model.id 必须是裸名(如 gpt-5.5),否则底层会按「非 xhigh 模型」降级。0.1.1+ 已自动处理 4tk/ 前缀。

图像生成功能(傻瓜式)

安装插件并完成 models auth login 后,OpenClaw 会自动加载 4TK Image provider。

  • 生成:默认使用 4tk/gpt-image-2,直接让助手“生成一张图……”
  • 编辑:在同模型下附带参考图,让助手“按这张图风格重绘/编辑……”

底层会调用:

  • POST https://api.4tk.ai/v1/images/generations
  • POST https://api.4tk.ai/v1/images/edits

从“手工 baseUrl 配置”迁移

  1. 安装插件
  2. 执行 openclaw models auth login --provider 4tk --method api-key --set-default
  3. 默认使用 4tk/gpt-5.5(主会话 / 重推理 / 图片输入)
  4. 删除旧 models.providers.4tk 手写片段(避免重复配置)
  5. 按需启用 TTS(默认关闭)

可配置项(现在都会生效)

plugins.entries["4tk-provider"] 支持:

  • baseUrl:统一作用于对话、图像、embedding、speech 请求。
  • defaults.embeddingModel:作用于 memory 默认模型与 provider embedding fallback。
  • defaults.imageModel:作用于 OpenClaw image provider 默认模型,默认 gpt-image-2
  • defaults.speechModel:作用于 talk provider 默认语音模型。
  • defaults.enableMemoryByDefault:控制是否注入 memory 默认项。
  • defaults.enableTtsByDefaultfalse 时保持默认关闭;true 时自动补全 talk.providertalk.providers.4tk.modelId

本地开发与测试

cd openclaw-plugins/openclaw-provider-4tk
npm install
npm test

发布清单(ClawHub / npm)

  1. 更新版本号
  2. npm test
  3. ClawHub(需同时提供源码仓库与提交;源码仓库为 4tk-ai/4tk.ai):
cd openclaw-plugins/openclaw-provider-4tk
COMMIT="$(git rev-parse HEAD)"
VERSION="$(node -p "require('./package.json').version")"
npx clawhub package publish "$(pwd)" \
  --family code-plugin \
  --name @4tk/openclaw-provider-4tk \
  --display-name "4TK OpenClaw Provider" \
  --version "$VERSION" \
  --tags latest \
  --changelog "..." \
  --source-repo "4tk-ai/4tk.ai" \
  --source-commit "$COMMIT" \
  --source-ref "main" \
  --source-path "openclaw-plugins/openclaw-provider-4tk" \
  --no-input
  1. npm publish(需 npm 2FA 或具备发布权限的 granular token)

若 ClawHub 提示 GitHub API rate limit,请隔几分钟后重试。