Files
openclaw/extensions/longcat/index.ts
Vincent Koc bf8626c0e9 feat(providers): add LongCat API support (#100501)
* fix(ai): honor provider reasoning compatibility

* feat(longcat): add hosted provider plugin

* chore(longcat): register package metadata

* docs(longcat): add provider setup guide

* docs(longcat): document self-hosted model routing

* refactor(longcat): externalize provider plugin

* chore(longcat): add npm release artifacts
2026-07-06 10:07:08 -07:00

54 lines
1.9 KiB
TypeScript

// LongCat plugin entrypoint registers its OpenClaw integration.
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 { LONGCAT_DEFAULT_MODEL_REF } from "./models.js";
import { applyLongCatConfig } from "./onboard.js";
import { buildLongCatProvider } from "./provider-catalog.js";
import { createLongCatThinkingWrapper } from "./stream.js";
const PROVIDER_ID = "longcat";
export default defineSingleProviderPluginEntry({
id: PROVIDER_ID,
name: "LongCat Provider",
description: "Official LongCat provider plugin",
provider: {
label: "LongCat",
docsPath: "/providers/longcat",
aliases: ["meituan-longcat"],
envVars: ["LONGCAT_API_KEY"],
auth: [
{
methodId: "api-key",
label: "LongCat API key",
hint: "API key",
optionKey: "longcatApiKey",
flagName: "--longcat-api-key",
envVar: "LONGCAT_API_KEY",
promptMessage: "Enter LongCat API key",
defaultModel: LONGCAT_DEFAULT_MODEL_REF,
applyConfig: (cfg) => applyLongCatConfig(cfg),
noteTitle: "LongCat",
noteMessage: "Manage API keys at https://longcat.chat/platform/api_keys",
wizard: {
choiceId: "longcat-api-key",
choiceLabel: "LongCat API key",
groupId: "longcat",
groupLabel: "LongCat",
groupHint: "API key",
},
},
],
catalog: {
buildProvider: buildLongCatProvider,
},
...buildProviderReplayFamilyHooks({
family: "openai-compatible",
dropReasoningFromHistory: false,
}),
...buildProviderToolCompatFamilyHooks("openai"),
wrapStreamFn: (ctx) => createLongCatThinkingWrapper(ctx.streamFn, ctx.thinkingLevel),
},
});