自动同步: 2026-07-02 02:10

This commit is contained in:
2026-07-02 02:10:28 +08:00
parent 489a0835e9
commit a7d5ff7b5e
59 changed files with 7918 additions and 9160 deletions
@@ -0,0 +1,21 @@
{
"name": "openclaw-deepseek-provider-2481ed984b",
"lockfileVersion": 3,
"requires": true,
"packages": {
"node_modules/@openclaw/deepseek-provider": {
"version": "2026.6.10",
"resolved": "https://registry.npmjs.org/@openclaw/deepseek-provider/-/deepseek-provider-2026.6.10.tgz",
"integrity": "sha512-KU+Fa9wfn6dCVef0ciMWwZNM2kORlY04eyRipmBhH7C6wpVYmflbIPC2X6ynHCgZIo+Wcy7rUc2xqQ9kTYcjSQ==",
"hasShrinkwrap": true,
"peerDependencies": {
"openclaw": ">=2026.6.10"
},
"peerDependenciesMeta": {
"openclaw": {
"optional": true
}
}
}
}
}
@@ -0,0 +1,12 @@
# OpenClaw DeepSeek Provider
Official OpenClaw provider plugin for DeepSeek.
Install from OpenClaw:
```bash
openclaw plugins install @openclaw/deepseek-provider
openclaw gateway restart
```
See <https://docs.openclaw.ai/providers/deepseek> for setup and configuration.
@@ -0,0 +1,4 @@
import { n as DEEPSEEK_MODEL_CATALOG, r as buildDeepSeekModelDefinition, t as DEEPSEEK_BASE_URL } from "./models-DCxTAfJ0.js";
import { buildDeepSeekProvider } from "./provider-catalog.js";
import { createDeepSeekV4ThinkingWrapper } from "./stream.js";
export { DEEPSEEK_BASE_URL, DEEPSEEK_MODEL_CATALOG, buildDeepSeekModelDefinition, buildDeepSeekProvider, createDeepSeekV4ThinkingWrapper };
@@ -0,0 +1,59 @@
import { buildDeepSeekProvider } from "./provider-catalog.js";
import { createDeepSeekV4ThinkingWrapper } from "./stream.js";
import { DEEPSEEK_DEFAULT_MODEL_REF, applyDeepSeekConfig } from "./onboard.js";
import { resolveDeepSeekV4ThinkingProfile } from "./thinking.js";
import { readConfiguredProviderCatalogEntries } from "openclaw/plugin-sdk/provider-catalog-shared";
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
import { buildProviderReplayFamilyHooks } from "openclaw/plugin-sdk/provider-model-shared";
import { buildProviderToolCompatFamilyHooks } from "openclaw/plugin-sdk/provider-tools";
import { fetchDeepSeekUsage } from "openclaw/plugin-sdk/provider-usage";
//#region extensions/deepseek/index.ts
const PROVIDER_ID = "deepseek";
var deepseek_default = defineSingleProviderPluginEntry({
id: PROVIDER_ID,
name: "DeepSeek Provider",
description: "Bundled DeepSeek provider plugin",
provider: {
label: "DeepSeek",
docsPath: "/providers/deepseek",
auth: [{
methodId: "api-key",
label: "DeepSeek API key",
hint: "API key",
optionKey: "deepseekApiKey",
flagName: "--deepseek-api-key",
envVar: "DEEPSEEK_API_KEY",
promptMessage: "Enter DeepSeek API key",
defaultModel: DEEPSEEK_DEFAULT_MODEL_REF,
applyConfig: (cfg) => applyDeepSeekConfig(cfg),
wizard: {
choiceId: "deepseek-api-key",
choiceLabel: "DeepSeek API key",
groupId: "deepseek",
groupLabel: "DeepSeek",
groupHint: "API key"
}
}],
catalog: { buildProvider: buildDeepSeekProvider },
augmentModelCatalog: ({ config }) => readConfiguredProviderCatalogEntries({
config,
providerId: PROVIDER_ID
}),
matchesContextOverflowError: ({ errorMessage }) => /\bdeepseek\b.*(?:input.*too long|context.*exceed)/i.test(errorMessage),
...buildProviderReplayFamilyHooks({
family: "openai-compatible",
dropReasoningFromHistory: false
}),
...buildProviderToolCompatFamilyHooks("deepseek"),
wrapStreamFn: (ctx) => createDeepSeekV4ThinkingWrapper(ctx.streamFn, ctx.thinkingLevel),
resolveThinkingProfile: ({ modelId }) => resolveDeepSeekV4ThinkingProfile(modelId),
isModernModelRef: ({ modelId }) => Boolean(resolveDeepSeekV4ThinkingProfile(modelId)),
resolveUsageAuth: async (ctx) => {
const apiKey = ctx.resolveApiKeyFromConfigAndStore({ envDirect: [ctx.env.DEEPSEEK_API_KEY] });
return apiKey ? { token: apiKey } : null;
},
fetchUsageSnapshot: async (ctx) => await fetchDeepSeekUsage(ctx.token, ctx.timeoutMs, ctx.fetchFn)
}
});
//#endregion
export { deepseek_default as default };
@@ -0,0 +1,106 @@
import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
//#endregion
//#region extensions/deepseek/models.ts
const DEEPSEEK_MANIFEST_PROVIDER = buildManifestModelProviderConfig({
providerId: "deepseek",
catalog: {
"providers": { "deepseek": {
"baseUrl": "https://api.deepseek.com",
"api": "openai-completions",
"models": [
{
"id": "deepseek-v4-flash",
"name": "DeepSeek V4 Flash",
"reasoning": true,
"input": ["text"],
"contextWindow": 1e6,
"maxTokens": 384e3,
"cost": {
"input": .14,
"output": .28,
"cacheRead": .028,
"cacheWrite": 0
},
"compat": {
"supportsUsageInStreaming": true,
"supportsReasoningEffort": true,
"maxTokensField": "max_tokens"
}
},
{
"id": "deepseek-v4-pro",
"name": "DeepSeek V4 Pro",
"reasoning": true,
"input": ["text"],
"contextWindow": 1e6,
"maxTokens": 384e3,
"cost": {
"input": 1.74,
"output": 3.48,
"cacheRead": .145,
"cacheWrite": 0
},
"compat": {
"supportsUsageInStreaming": true,
"supportsReasoningEffort": true,
"maxTokensField": "max_tokens"
}
},
{
"id": "deepseek-chat",
"name": "DeepSeek Chat",
"input": ["text"],
"contextWindow": 131072,
"maxTokens": 8192,
"cost": {
"input": .28,
"output": .42,
"cacheRead": .028,
"cacheWrite": 0
},
"compat": {
"supportsUsageInStreaming": true,
"maxTokensField": "max_tokens"
}
},
{
"id": "deepseek-reasoner",
"name": "DeepSeek Reasoner",
"reasoning": true,
"input": ["text"],
"contextWindow": 131072,
"maxTokens": 65536,
"cost": {
"input": .28,
"output": .42,
"cacheRead": .028,
"cacheWrite": 0
},
"compat": {
"supportsUsageInStreaming": true,
"supportsReasoningEffort": false,
"maxTokensField": "max_tokens"
}
}
]
} },
"discovery": { "deepseek": "static" }
}.providers.deepseek
});
const DEEPSEEK_BASE_URL = DEEPSEEK_MANIFEST_PROVIDER.baseUrl;
const DEEPSEEK_MODEL_CATALOG = DEEPSEEK_MANIFEST_PROVIDER.models;
function buildDeepSeekModelDefinition(model) {
return {
...model,
api: "openai-completions"
};
}
const DEEPSEEK_V4_MODEL_IDS = new Set(["deepseek-v4-flash", "deepseek-v4-pro"]);
function isDeepSeekV4ModelId(modelId) {
return DEEPSEEK_V4_MODEL_IDS.has(modelId.toLowerCase());
}
function isDeepSeekV4ModelRef(model) {
return model.provider === "deepseek" && typeof model.id === "string" && isDeepSeekV4ModelId(model.id);
}
//#endregion
export { isDeepSeekV4ModelRef as a, isDeepSeekV4ModelId as i, DEEPSEEK_MODEL_CATALOG as n, buildDeepSeekModelDefinition as r, DEEPSEEK_BASE_URL as t };
@@ -0,0 +1,2 @@
import { a as isDeepSeekV4ModelRef, i as isDeepSeekV4ModelId, n as DEEPSEEK_MODEL_CATALOG, r as buildDeepSeekModelDefinition, t as DEEPSEEK_BASE_URL } from "./models-DCxTAfJ0.js";
export { DEEPSEEK_BASE_URL, DEEPSEEK_MODEL_CATALOG, buildDeepSeekModelDefinition, isDeepSeekV4ModelId, isDeepSeekV4ModelRef };
@@ -0,0 +1,24 @@
import { n as DEEPSEEK_MODEL_CATALOG, r as buildDeepSeekModelDefinition, t as DEEPSEEK_BASE_URL } from "./models-DCxTAfJ0.js";
import "./api.js";
import { applyAgentDefaultModelPrimary, applyProviderConfigWithModelCatalog } from "openclaw/plugin-sdk/provider-onboard";
//#region extensions/deepseek/onboard.ts
const DEEPSEEK_DEFAULT_MODEL_REF = "deepseek/deepseek-v4-flash";
function applyDeepSeekProviderConfig(cfg) {
const models = { ...cfg.agents?.defaults?.models };
models[DEEPSEEK_DEFAULT_MODEL_REF] = {
...models[DEEPSEEK_DEFAULT_MODEL_REF],
alias: models["deepseek/deepseek-v4-flash"]?.alias ?? "DeepSeek"
};
return applyProviderConfigWithModelCatalog(cfg, {
agentModels: models,
providerId: "deepseek",
api: "openai-completions",
baseUrl: DEEPSEEK_BASE_URL,
catalogModels: DEEPSEEK_MODEL_CATALOG.map(buildDeepSeekModelDefinition)
});
}
function applyDeepSeekConfig(cfg) {
return applyAgentDefaultModelPrimary(applyDeepSeekProviderConfig(cfg), DEEPSEEK_DEFAULT_MODEL_REF);
}
//#endregion
export { DEEPSEEK_DEFAULT_MODEL_REF, applyDeepSeekConfig };
@@ -0,0 +1,11 @@
import { n as DEEPSEEK_MODEL_CATALOG, r as buildDeepSeekModelDefinition, t as DEEPSEEK_BASE_URL } from "./models-DCxTAfJ0.js";
//#region extensions/deepseek/provider-catalog.ts
function buildDeepSeekProvider() {
return {
baseUrl: DEEPSEEK_BASE_URL,
api: "openai-completions",
models: DEEPSEEK_MODEL_CATALOG.map(buildDeepSeekModelDefinition)
};
}
//#endregion
export { buildDeepSeekProvider };
@@ -0,0 +1,14 @@
import { buildDeepSeekProvider } from "./provider-catalog.js";
//#region extensions/deepseek/provider-discovery.ts
const deepSeekProviderDiscovery = {
id: "deepseek",
label: "DeepSeek",
docsPath: "/providers/deepseek",
auth: [],
staticCatalog: {
order: "simple",
run: async () => ({ provider: buildDeepSeekProvider() })
}
};
//#endregion
export { deepSeekProviderDiscovery as default };
@@ -0,0 +1,68 @@
import { n as DEEPSEEK_MODEL_CATALOG } from "./models-DCxTAfJ0.js";
import { resolveDeepSeekV4ThinkingProfile } from "./thinking.js";
//#region extensions/deepseek/provider-policy-api.ts
/**
* Build a lookup from the bundled DeepSeek model catalog so we can hydrate
* missing metadata (contextWindow, cost, maxTokens) into user-configured
* model rows without overwriting explicit overrides.
*/
function buildCatalogIndex() {
const index = /* @__PURE__ */ new Map();
for (const model of DEEPSEEK_MODEL_CATALOG) index.set(model.id, model);
return index;
}
function isPositiveNumber(value) {
return typeof value === "number" && Number.isFinite(value) && value > 0;
}
function hasCostValues(cost) {
if (!cost || typeof cost !== "object") return false;
const c = cost;
return typeof c.input === "number" || typeof c.output === "number" || typeof c.cacheRead === "number" || typeof c.cacheWrite === "number";
}
/**
* Provider policy surface for DeepSeek.
*
* Hydrates missing `contextWindow`, `cost`, and `maxTokens` from the bundled
* catalog for matching model ids. Explicit user overrides are preserved.
*/
function normalizeConfig(params) {
const { providerConfig } = params;
if (!Array.isArray(providerConfig.models) || providerConfig.models.length === 0) return providerConfig;
const catalog = buildCatalogIndex();
let mutated = false;
const nextModels = providerConfig.models.map((model) => {
const raw = model;
const catalogEntry = catalog.get(raw.id);
if (!catalogEntry) return model;
let modelMutated = false;
const patched = {};
if (!isPositiveNumber(raw.contextWindow) && isPositiveNumber(catalogEntry.contextWindow)) {
patched.contextWindow = catalogEntry.contextWindow;
modelMutated = true;
}
if (!isPositiveNumber(raw.maxTokens) && isPositiveNumber(catalogEntry.maxTokens)) {
patched.maxTokens = catalogEntry.maxTokens;
modelMutated = true;
}
if (!hasCostValues(raw.cost) && hasCostValues(catalogEntry.cost)) {
patched.cost = catalogEntry.cost;
modelMutated = true;
}
if (!modelMutated) return model;
mutated = true;
return {
...raw,
...patched
};
});
if (!mutated) return providerConfig;
return {
...providerConfig,
models: nextModels
};
}
function resolveThinkingProfile(params) {
return params.provider.trim().toLowerCase() === "deepseek" ? resolveDeepSeekV4ThinkingProfile(params.modelId) : null;
}
//#endregion
export { normalizeConfig, resolveThinkingProfile };
@@ -0,0 +1,12 @@
import { a as isDeepSeekV4ModelRef } from "./models-DCxTAfJ0.js";
import { createDeepSeekV4OpenAICompatibleThinkingWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
//#region extensions/deepseek/stream.ts
function createDeepSeekV4ThinkingWrapper(baseStreamFn, thinkingLevel) {
return createDeepSeekV4OpenAICompatibleThinkingWrapper({
baseStreamFn,
thinkingLevel,
shouldPatchModel: isDeepSeekV4ModelRef
});
}
//#endregion
export { createDeepSeekV4ThinkingWrapper };
@@ -0,0 +1,23 @@
import { i as isDeepSeekV4ModelId } from "./models-DCxTAfJ0.js";
//#region extensions/deepseek/thinking.ts
const V4_THINKING_LEVEL_IDS = [
"off",
"minimal",
"low",
"medium",
"high",
"xhigh",
"max"
];
function buildDeepSeekV4ThinkingLevel(id) {
return { id };
}
const DEEPSEEK_V4_THINKING_PROFILE = {
levels: V4_THINKING_LEVEL_IDS.map(buildDeepSeekV4ThinkingLevel),
defaultLevel: "high"
};
function resolveDeepSeekV4ThinkingProfile(modelId) {
return isDeepSeekV4ModelId(modelId) ? DEEPSEEK_V4_THINKING_PROFILE : void 0;
}
//#endregion
export { resolveDeepSeekV4ThinkingProfile };
@@ -0,0 +1 @@
/home/starmen1265/.npm-global/lib/node_modules/openclaw
@@ -0,0 +1,12 @@
{
"name": "@openclaw/deepseek-provider",
"version": "2026.6.10",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@openclaw/deepseek-provider",
"version": "2026.6.10"
}
}
}
@@ -0,0 +1,137 @@
{
"id": "deepseek",
"activation": {
"onStartup": false
},
"enabledByDefault": true,
"providerCatalogEntry": "./provider-discovery.ts",
"providers": ["deepseek"],
"providerEndpoints": [
{
"endpointClass": "deepseek-native",
"hosts": ["api.deepseek.com"]
}
],
"providerRequest": {
"providers": {
"deepseek": {
"family": "deepseek"
}
}
},
"modelCatalog": {
"providers": {
"deepseek": {
"baseUrl": "https://api.deepseek.com",
"api": "openai-completions",
"models": [
{
"id": "deepseek-v4-flash",
"name": "DeepSeek V4 Flash",
"reasoning": true,
"input": ["text"],
"contextWindow": 1000000,
"maxTokens": 384000,
"cost": {
"input": 0.14,
"output": 0.28,
"cacheRead": 0.028,
"cacheWrite": 0
},
"compat": {
"supportsUsageInStreaming": true,
"supportsReasoningEffort": true,
"maxTokensField": "max_tokens"
}
},
{
"id": "deepseek-v4-pro",
"name": "DeepSeek V4 Pro",
"reasoning": true,
"input": ["text"],
"contextWindow": 1000000,
"maxTokens": 384000,
"cost": {
"input": 1.74,
"output": 3.48,
"cacheRead": 0.145,
"cacheWrite": 0
},
"compat": {
"supportsUsageInStreaming": true,
"supportsReasoningEffort": true,
"maxTokensField": "max_tokens"
}
},
{
"id": "deepseek-chat",
"name": "DeepSeek Chat",
"input": ["text"],
"contextWindow": 131072,
"maxTokens": 8192,
"cost": {
"input": 0.28,
"output": 0.42,
"cacheRead": 0.028,
"cacheWrite": 0
},
"compat": {
"supportsUsageInStreaming": true,
"maxTokensField": "max_tokens"
}
},
{
"id": "deepseek-reasoner",
"name": "DeepSeek Reasoner",
"reasoning": true,
"input": ["text"],
"contextWindow": 131072,
"maxTokens": 65536,
"cost": {
"input": 0.28,
"output": 0.42,
"cacheRead": 0.028,
"cacheWrite": 0
},
"compat": {
"supportsUsageInStreaming": true,
"supportsReasoningEffort": false,
"maxTokensField": "max_tokens"
}
}
]
}
},
"discovery": {
"deepseek": "static"
}
},
"setup": {
"providers": [
{
"id": "deepseek",
"envVars": ["DEEPSEEK_API_KEY"]
}
]
},
"providerAuthChoices": [
{
"provider": "deepseek",
"method": "api-key",
"choiceId": "deepseek-api-key",
"choiceLabel": "DeepSeek API key",
"groupId": "deepseek",
"groupLabel": "DeepSeek",
"groupHint": "API key",
"optionKey": "deepseekApiKey",
"cliFlag": "--deepseek-api-key",
"cliOption": "--deepseek-api-key <key>",
"cliDescription": "DeepSeek API key"
}
],
"configSchema": {
"type": "object",
"additionalProperties": false,
"properties": {}
}
}
@@ -0,0 +1,50 @@
{
"name": "@openclaw/deepseek-provider",
"version": "2026.6.10",
"description": "OpenClaw DeepSeek provider plugin.",
"repository": {
"type": "git",
"url": "https://github.com/openclaw/openclaw"
},
"type": "module",
"openclaw": {
"extensions": [
"./index.ts"
],
"install": {
"clawhubSpec": "clawhub:@openclaw/deepseek-provider",
"npmSpec": "@openclaw/deepseek-provider",
"defaultChoice": "npm",
"minHostVersion": ">=2026.6.8"
},
"compat": {
"pluginApi": ">=2026.6.10"
},
"build": {
"openclawVersion": "2026.6.10",
"bundledDist": false
},
"release": {
"publishToClawHub": true,
"publishToNpm": true
},
"runtimeExtensions": [
"./dist/index.js"
]
},
"files": [
"dist/**",
"openclaw.plugin.json",
"npm-shrinkwrap.json",
"README.md"
],
"peerDependencies": {
"openclaw": ">=2026.6.10"
},
"peerDependenciesMeta": {
"openclaw": {
"optional": true
}
},
"bundledDependencies": []
}