@canarycoders/ai 0.5.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 CHANGED
@@ -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/index.d.cts CHANGED
@@ -6,15 +6,18 @@ export { b as RealtimeKind, c as RealtimeTool } from './realtime-BWDkXcj9.cjs';
6
6
  type FetchLike = typeof globalThis.fetch;
7
7
 
8
8
  /** Every provider the gateway can route to. */
9
- type ProviderType = "gemini" | "vertex" | "openai" | "anthropic" | "xai" | "lmstudio" | "ollama" | "perplexity" | "elevenlabs" | "mlxaudio" | "vision" | "gcvision";
9
+ type ProviderType = "gemini" | "vertex" | "openai" | "anthropic" | "xai" | "lmstudio" | "ollama" | "perplexity" | "elevenlabs" | "mlxaudio" | "vision" | "gcvision" | "zhipu" | "moonshot";
10
10
  /** Providers that serve text chat / completion. */
11
- type ChatProvider = "gemini" | "vertex" | "openai" | "anthropic" | "xai" | "lmstudio" | "ollama" | "perplexity";
11
+ type ChatProvider = "gemini" | "vertex" | "openai" | "anthropic" | "xai" | "lmstudio" | "ollama" | "perplexity" | "zhipu" | "moonshot";
12
12
  type ModelCapability = "chat" | "vision" | "image-generation" | "video-generation" | "text-to-speech" | "speech-to-text" | "image-recognition" | "face-detection" | "web-detection" | "conversation" | "sound-effect" | "music-generation" | "dialogue" | "realtime-voice" | "realtime-translate" | "realtime-transcribe" | "embeddings" | "reasoning";
13
13
  interface TokenUsage {
14
14
  inputTokens: number;
15
15
  outputTokens: number;
16
16
  totalTokens: number;
17
+ /** Cache-read tokens (subset of inputTokens), billed at the cached-input rate. */
17
18
  cachedTokens?: number;
19
+ /** Anthropic only: cache-write tokens (billed at 1.25x input). */
20
+ cacheCreationTokens?: number;
18
21
  reasoningTokens?: number;
19
22
  }
20
23
  interface ModelInfo {
@@ -297,6 +300,15 @@ interface CompleteParams {
297
300
  tools?: ToolDefinition[];
298
301
  toolChoice?: ToolChoice;
299
302
  thinkingMode?: ThinkingMode;
303
+ /**
304
+ * Anthropic only: opt into prompt caching. The gateway places cache_control
305
+ * breakpoints on the system prompt and the last message (5-minute TTL).
306
+ */
307
+ promptCaching?: boolean;
308
+ /** OpenAI only: stable cache-routing key (per conversation/workload) to raise automatic cache hits. */
309
+ promptCacheKey?: string;
310
+ /** OpenAI only: stable end-user identifier, also used for cache routing. */
311
+ safetyIdentifier?: string;
300
312
  webSearch?: WebSearchOptions;
301
313
  cache?: {
302
314
  enabled?: boolean;
package/dist/index.d.ts CHANGED
@@ -6,15 +6,18 @@ export { b as RealtimeKind, c as RealtimeTool } from './realtime-BWDkXcj9.js';
6
6
  type FetchLike = typeof globalThis.fetch;
7
7
 
8
8
  /** Every provider the gateway can route to. */
9
- type ProviderType = "gemini" | "vertex" | "openai" | "anthropic" | "xai" | "lmstudio" | "ollama" | "perplexity" | "elevenlabs" | "mlxaudio" | "vision" | "gcvision";
9
+ type ProviderType = "gemini" | "vertex" | "openai" | "anthropic" | "xai" | "lmstudio" | "ollama" | "perplexity" | "elevenlabs" | "mlxaudio" | "vision" | "gcvision" | "zhipu" | "moonshot";
10
10
  /** Providers that serve text chat / completion. */
11
- type ChatProvider = "gemini" | "vertex" | "openai" | "anthropic" | "xai" | "lmstudio" | "ollama" | "perplexity";
11
+ type ChatProvider = "gemini" | "vertex" | "openai" | "anthropic" | "xai" | "lmstudio" | "ollama" | "perplexity" | "zhipu" | "moonshot";
12
12
  type ModelCapability = "chat" | "vision" | "image-generation" | "video-generation" | "text-to-speech" | "speech-to-text" | "image-recognition" | "face-detection" | "web-detection" | "conversation" | "sound-effect" | "music-generation" | "dialogue" | "realtime-voice" | "realtime-translate" | "realtime-transcribe" | "embeddings" | "reasoning";
13
13
  interface TokenUsage {
14
14
  inputTokens: number;
15
15
  outputTokens: number;
16
16
  totalTokens: number;
17
+ /** Cache-read tokens (subset of inputTokens), billed at the cached-input rate. */
17
18
  cachedTokens?: number;
19
+ /** Anthropic only: cache-write tokens (billed at 1.25x input). */
20
+ cacheCreationTokens?: number;
18
21
  reasoningTokens?: number;
19
22
  }
20
23
  interface ModelInfo {
@@ -297,6 +300,15 @@ interface CompleteParams {
297
300
  tools?: ToolDefinition[];
298
301
  toolChoice?: ToolChoice;
299
302
  thinkingMode?: ThinkingMode;
303
+ /**
304
+ * Anthropic only: opt into prompt caching. The gateway places cache_control
305
+ * breakpoints on the system prompt and the last message (5-minute TTL).
306
+ */
307
+ promptCaching?: boolean;
308
+ /** OpenAI only: stable cache-routing key (per conversation/workload) to raise automatic cache hits. */
309
+ promptCacheKey?: string;
310
+ /** OpenAI only: stable end-user identifier, also used for cache routing. */
311
+ safetyIdentifier?: string;
300
312
  webSearch?: WebSearchOptions;
301
313
  cache?: {
302
314
  enabled?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canarycoders/ai",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Official TypeScript SDK for the CanaryCoders AI multi-provider gateway",
5
5
  "license": "MIT",
6
6
  "author": "CanaryCoders",