Переглянути джерело

Initial commit

Signed-off-by: greatbridf <[email protected]>
greatbridf 4 місяців тому
коміт
9da90dff90
2 змінених файлів з 108 додано та 0 видалено
  1. 97 0
      index.ts
  2. 11 0
      package.json

+ 97 - 0
index.ts

@@ -0,0 +1,97 @@
+/**
+ * vim: set noet ts=8:
+ * DuckCoding AI Custom Provider
+ *
+ * Provides access to DuckCoding AI models via an OpenAI-compatible API.
+ *
+ * Usage:
+ *   Set the DUCKCODING_API_KEY environment variable with your API key.
+ *   Then use /model to select duckcoding/<model-id>.
+ *
+ * Models:
+ *   The model list below uses common model IDs. Update it to match
+ *   the models actually available at DuckCoding AI.
+ */
+
+import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
+
+export default function (pi: ExtensionAPI) {
+	pi.registerProvider("duckcoding", {
+		name: "DuckCoding AI",
+		baseUrl: "https://api.duckcoding.ai/v1",
+		apiKey: "$DUCKCODING_API_KEY",
+		api: "openai-completions",
+
+		models: [
+			{
+				id: "claude-sonnet-4-20250514",
+				name: "Claude Sonnet 4",
+				reasoning: true,
+				input: ["text", "image"],
+				cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
+				contextWindow: 200000,
+				maxTokens: 8192,
+			},
+			{
+				id: "claude-3-5-sonnet-20241022",
+				name: "Claude 3.5 Sonnet",
+				reasoning: false,
+				input: ["text", "image"],
+				cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
+				contextWindow: 200000,
+				maxTokens: 8192,
+			},
+			{
+				id: "claude-3-5-haiku-20241022",
+				name: "Claude 3.5 Haiku",
+				reasoning: false,
+				input: ["text", "image"],
+				cost: { input: 0.8, output: 4, cacheRead: 0.08, cacheWrite: 1 },
+				contextWindow: 200000,
+				maxTokens: 8192,
+			},
+			{
+				id: "gpt-5.4-mini",
+				name: "GPT-5.4-Mini",
+				reasoning: false,
+				input: ["text", "image"],
+				cost: { input: 2.5, output: 10, cacheRead: 1.25, cacheWrite: 0 },
+				contextWindow: 128000,
+				maxTokens: 16384,
+			},
+			{
+				id: "gpt-4o-mini",
+				name: "GPT-4o Mini",
+				reasoning: false,
+				input: ["text", "image"],
+				cost: { input: 0.15, output: 0.6, cacheRead: 0.075, cacheWrite: 0 },
+				contextWindow: 128000,
+				maxTokens: 16384,
+			},
+			{
+				id: "deepseek-chat",
+				name: "DeepSeek V3",
+				reasoning: false,
+				input: ["text"],
+				cost: { input: 0.27, output: 1.1, cacheRead: 0.07, cacheWrite: 0.27 },
+				contextWindow: 64000,
+				maxTokens: 8192,
+			},
+			{
+				id: "deepseek-reasoner",
+				name: "DeepSeek R1",
+				reasoning: true,
+				input: ["text"],
+				compat: {
+					thinkingFormat: "deepseek",
+				},
+				cost: { input: 0.55, output: 2.19, cacheRead: 0.14, cacheWrite: 0.55 },
+				contextWindow: 64000,
+				maxTokens: 8192,
+			},
+		],
+
+		// Custom headers if needed by DuckCoding
+		headers: {},
+	});
+}

+ 11 - 0
package.json

@@ -0,0 +1,11 @@
+{
+  "name": "pi-extension-duckcoding",
+  "private": true,
+  "version": "1.0.0",
+  "type": "module",
+  "pi": {
+    "extensions": [
+      "./index.ts"
+    ]
+  }
+}