index.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /**
  2. * vim: set noet ts=8:
  3. * DuckCoding AI Custom Provider
  4. *
  5. * Provides access to DuckCoding AI models via an OpenAI-compatible API.
  6. *
  7. * Usage:
  8. * Set the DUCKCODING_API_KEY environment variable with your API key.
  9. * Then use /model to select duckcoding/<model-id>.
  10. *
  11. * Models:
  12. * The model list below uses common model IDs. Update it to match
  13. * the models actually available at DuckCoding AI.
  14. */
  15. import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
  16. export default function (pi: ExtensionAPI) {
  17. pi.registerProvider("duckcoding", {
  18. name: "DuckCoding AI",
  19. baseUrl: "https://api.duckcoding.ai/v1",
  20. apiKey: "$DUCKCODING_API_KEY",
  21. api: "openai-completions",
  22. models: [
  23. {
  24. id: "claude-sonnet-4-20250514",
  25. name: "Claude Sonnet 4",
  26. reasoning: true,
  27. input: ["text", "image"],
  28. cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
  29. contextWindow: 200000,
  30. maxTokens: 8192,
  31. },
  32. {
  33. id: "claude-3-5-sonnet-20241022",
  34. name: "Claude 3.5 Sonnet",
  35. reasoning: false,
  36. input: ["text", "image"],
  37. cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
  38. contextWindow: 200000,
  39. maxTokens: 8192,
  40. },
  41. {
  42. id: "claude-3-5-haiku-20241022",
  43. name: "Claude 3.5 Haiku",
  44. reasoning: false,
  45. input: ["text", "image"],
  46. cost: { input: 0.8, output: 4, cacheRead: 0.08, cacheWrite: 1 },
  47. contextWindow: 200000,
  48. maxTokens: 8192,
  49. },
  50. {
  51. id: "gpt-5.4-mini",
  52. name: "GPT-5.4-Mini",
  53. reasoning: false,
  54. input: ["text", "image"],
  55. cost: { input: 2.5, output: 10, cacheRead: 1.25, cacheWrite: 0 },
  56. contextWindow: 128000,
  57. maxTokens: 16384,
  58. },
  59. {
  60. id: "gpt-4o-mini",
  61. name: "GPT-4o Mini",
  62. reasoning: false,
  63. input: ["text", "image"],
  64. cost: { input: 0.15, output: 0.6, cacheRead: 0.075, cacheWrite: 0 },
  65. contextWindow: 128000,
  66. maxTokens: 16384,
  67. },
  68. {
  69. id: "deepseek-chat",
  70. name: "DeepSeek V3",
  71. reasoning: false,
  72. input: ["text"],
  73. cost: { input: 0.27, output: 1.1, cacheRead: 0.07, cacheWrite: 0.27 },
  74. contextWindow: 64000,
  75. maxTokens: 8192,
  76. },
  77. {
  78. id: "deepseek-reasoner",
  79. name: "DeepSeek R1",
  80. reasoning: true,
  81. input: ["text"],
  82. compat: {
  83. thinkingFormat: "deepseek",
  84. },
  85. cost: { input: 0.55, output: 2.19, cacheRead: 0.14, cacheWrite: 0.55 },
  86. contextWindow: 64000,
  87. maxTokens: 8192,
  88. },
  89. ],
  90. // Custom headers if needed by DuckCoding
  91. headers: {},
  92. });
  93. }