@canarycoders/ai 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/compat.cjs.map +1 -1
- package/dist/compat.d.cts +1 -1
- package/dist/compat.d.ts +1 -1
- package/dist/compat.js.map +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -8
- package/dist/index.d.ts +25 -7
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,9 +16,9 @@ bun add @canarycoders/ai
|
|
|
16
16
|
## Quick start
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
|
-
import
|
|
19
|
+
import CanaryCodersAI from "@canarycoders/ai";
|
|
20
20
|
|
|
21
|
-
const client = new
|
|
21
|
+
const client = new CanaryCodersAI({ apiKey: process.env.CANARY_AI_API_KEY });
|
|
22
22
|
|
|
23
23
|
const res = await client.chat.complete({
|
|
24
24
|
provider: "openai",
|
|
@@ -29,7 +29,7 @@ const res = await client.chat.complete({
|
|
|
29
29
|
console.log(res.content, res.usage.totalTokens);
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
`apiKey` defaults to `CANARY_AI_API_KEY` (legacy `CANARYLLM_API_KEY` still works) and `baseURL` to the hosted gateway, so `new
|
|
32
|
+
`apiKey` defaults to `CANARY_AI_API_KEY` (legacy `CANARYLLM_API_KEY` still works) and `baseURL` to the hosted gateway, so `new CanaryCodersAI()` with the env var set is enough.
|
|
33
33
|
|
|
34
34
|
## How the queue works
|
|
35
35
|
|
|
@@ -161,6 +161,10 @@ await oa.chat.completions.create({
|
|
|
161
161
|
| `defaultTag` | — | attached to requests for usage attribution |
|
|
162
162
|
| `poll` | — | default poll timing for queued ops |
|
|
163
163
|
|
|
164
|
+
## Agent skill
|
|
165
|
+
|
|
166
|
+
`skills/canary-ai/` ships a Codex/Claude Code Agent Skill that drives the gateway (research, X search, chat, image generation, model discovery) from a single Bun script, no MCP server needed. See [docs.ai.canarycoders.es/agent-skill](https://docs.ai.canarycoders.es/agent-skill) for install/update/uninstall steps. It's a plain repo folder, not part of the published npm package.
|
|
167
|
+
|
|
164
168
|
## Keeping types in sync
|
|
165
169
|
|
|
166
170
|
The gateway API is the source of truth. Regenerate types from its OpenAPI spec and diff them against the hand-written ones:
|
package/dist/compat.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/compat.ts"],"names":[],"mappings":";;;AAgBA,SAAS,GAAG,OAAA,EAAyB;AACnC,EAAA,OAAO,CAAA,EAAG,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAC,CAAA,GAAA,CAAA;AACvC;AAEO,SAAS,YAAA,CAAa,SAAiB,MAAA,EAA8B;AAC1E,EAAA,OAAO,EAAE,OAAA,EAAS,EAAA,CAAG,OAAO,GAAG,MAAA,EAAO;AACxC;AAEO,SAAS,eAAA,CAAgB,SAAiB,MAAA,EAA8B;AAC7E,EAAA,OAAO,EAAE,OAAA,EAAS,EAAA,CAAG,OAAO,GAAG,MAAA,EAAO;AACxC","file":"compat.cjs","sourcesContent":["/**\n * Helpers to point the official OpenAI / Anthropic SDKs at
|
|
1
|
+
{"version":3,"sources":["../src/compat.ts"],"names":[],"mappings":";;;AAgBA,SAAS,GAAG,OAAA,EAAyB;AACnC,EAAA,OAAO,CAAA,EAAG,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAC,CAAA,GAAA,CAAA;AACvC;AAEO,SAAS,YAAA,CAAa,SAAiB,MAAA,EAA8B;AAC1E,EAAA,OAAO,EAAE,OAAA,EAAS,EAAA,CAAG,OAAO,GAAG,MAAA,EAAO;AACxC;AAEO,SAAS,eAAA,CAAgB,SAAiB,MAAA,EAA8B;AAC7E,EAAA,OAAO,EAAE,OAAA,EAAS,EAAA,CAAG,OAAO,GAAG,MAAA,EAAO;AACxC","file":"compat.cjs","sourcesContent":["/**\n * Helpers to point the official OpenAI / Anthropic SDKs at CanaryCoders AI's\n * drop-in compatible endpoints. Use the `provider/modelId` model-string format\n * (e.g. `\"openai/gpt-4o-mini\"`, `\"anthropic/claude-sonnet-4-5\"`).\n *\n * @example\n * import OpenAI from \"openai\";\n * import { openaiTarget } from \"@canarycoders/ai/compat\";\n * const oa = new OpenAI(openaiTarget(baseURL, apiKey));\n */\nexport interface CompatTarget {\n baseURL: string;\n apiKey: string;\n defaultHeaders?: Record<string, string>;\n}\n\nfunction v1(baseURL: string): string {\n return `${baseURL.replace(/\\/+$/, \"\")}/v1`;\n}\n\nexport function openaiTarget(baseURL: string, apiKey: string): CompatTarget {\n return { baseURL: v1(baseURL), apiKey };\n}\n\nexport function anthropicTarget(baseURL: string, apiKey: string): CompatTarget {\n return { baseURL: v1(baseURL), apiKey };\n}\n"]}
|
package/dist/compat.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Helpers to point the official OpenAI / Anthropic SDKs at
|
|
2
|
+
* Helpers to point the official OpenAI / Anthropic SDKs at CanaryCoders AI's
|
|
3
3
|
* drop-in compatible endpoints. Use the `provider/modelId` model-string format
|
|
4
4
|
* (e.g. `"openai/gpt-4o-mini"`, `"anthropic/claude-sonnet-4-5"`).
|
|
5
5
|
*
|
package/dist/compat.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Helpers to point the official OpenAI / Anthropic SDKs at
|
|
2
|
+
* Helpers to point the official OpenAI / Anthropic SDKs at CanaryCoders AI's
|
|
3
3
|
* drop-in compatible endpoints. Use the `provider/modelId` model-string format
|
|
4
4
|
* (e.g. `"openai/gpt-4o-mini"`, `"anthropic/claude-sonnet-4-5"`).
|
|
5
5
|
*
|
package/dist/compat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/compat.ts"],"names":[],"mappings":";AAgBA,SAAS,GAAG,OAAA,EAAyB;AACnC,EAAA,OAAO,CAAA,EAAG,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAC,CAAA,GAAA,CAAA;AACvC;AAEO,SAAS,YAAA,CAAa,SAAiB,MAAA,EAA8B;AAC1E,EAAA,OAAO,EAAE,OAAA,EAAS,EAAA,CAAG,OAAO,GAAG,MAAA,EAAO;AACxC;AAEO,SAAS,eAAA,CAAgB,SAAiB,MAAA,EAA8B;AAC7E,EAAA,OAAO,EAAE,OAAA,EAAS,EAAA,CAAG,OAAO,GAAG,MAAA,EAAO;AACxC","file":"compat.js","sourcesContent":["/**\n * Helpers to point the official OpenAI / Anthropic SDKs at
|
|
1
|
+
{"version":3,"sources":["../src/compat.ts"],"names":[],"mappings":";AAgBA,SAAS,GAAG,OAAA,EAAyB;AACnC,EAAA,OAAO,CAAA,EAAG,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAC,CAAA,GAAA,CAAA;AACvC;AAEO,SAAS,YAAA,CAAa,SAAiB,MAAA,EAA8B;AAC1E,EAAA,OAAO,EAAE,OAAA,EAAS,EAAA,CAAG,OAAO,GAAG,MAAA,EAAO;AACxC;AAEO,SAAS,eAAA,CAAgB,SAAiB,MAAA,EAA8B;AAC7E,EAAA,OAAO,EAAE,OAAA,EAAS,EAAA,CAAG,OAAO,GAAG,MAAA,EAAO;AACxC","file":"compat.js","sourcesContent":["/**\n * Helpers to point the official OpenAI / Anthropic SDKs at CanaryCoders AI's\n * drop-in compatible endpoints. Use the `provider/modelId` model-string format\n * (e.g. `\"openai/gpt-4o-mini\"`, `\"anthropic/claude-sonnet-4-5\"`).\n *\n * @example\n * import OpenAI from \"openai\";\n * import { openaiTarget } from \"@canarycoders/ai/compat\";\n * const oa = new OpenAI(openaiTarget(baseURL, apiKey));\n */\nexport interface CompatTarget {\n baseURL: string;\n apiKey: string;\n defaultHeaders?: Record<string, string>;\n}\n\nfunction v1(baseURL: string): string {\n return `${baseURL.replace(/\\/+$/, \"\")}/v1`;\n}\n\nexport function openaiTarget(baseURL: string, apiKey: string): CompatTarget {\n return { baseURL: v1(baseURL), apiKey };\n}\n\nexport function anthropicTarget(baseURL: string, apiKey: string): CompatTarget {\n return { baseURL: v1(baseURL), apiKey };\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1594,7 +1594,7 @@ function readEnv(key) {
|
|
|
1594
1594
|
if (typeof process !== "undefined" && process.env) return process.env[key];
|
|
1595
1595
|
return void 0;
|
|
1596
1596
|
}
|
|
1597
|
-
var
|
|
1597
|
+
var CanaryCodersAI = class {
|
|
1598
1598
|
chat;
|
|
1599
1599
|
queue;
|
|
1600
1600
|
images;
|
|
@@ -1653,14 +1653,15 @@ var CanaryLLM = class {
|
|
|
1653
1653
|
};
|
|
1654
1654
|
|
|
1655
1655
|
// src/index.ts
|
|
1656
|
-
var src_default =
|
|
1656
|
+
var src_default = CanaryCodersAI;
|
|
1657
1657
|
|
|
1658
1658
|
exports.APIConnectionError = APIConnectionError;
|
|
1659
1659
|
exports.APIConnectionTimeoutError = APIConnectionTimeoutError;
|
|
1660
1660
|
exports.APIError = APIError;
|
|
1661
1661
|
exports.AuthenticationError = AuthenticationError;
|
|
1662
1662
|
exports.BadRequestError = BadRequestError;
|
|
1663
|
-
exports.
|
|
1663
|
+
exports.CanaryCodersAI = CanaryCodersAI;
|
|
1664
|
+
exports.CanaryLLM = CanaryCodersAI;
|
|
1664
1665
|
exports.ConflictError = ConflictError;
|
|
1665
1666
|
exports.InternalServerError = InternalServerError;
|
|
1666
1667
|
exports.Job = Job;
|