@canarycoders/ai 0.5.0 → 0.7.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/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;
@@ -977,6 +989,112 @@ declare class VisionResource extends BaseResource {
977
989
  }>;
978
990
  }
979
991
 
992
+ type OcrRecognitionLevel = "fast" | "accurate";
993
+ type OcrGranularity = "line" | "word";
994
+ type RedactStyle = "blur" | "box" | "pixelate";
995
+ type RedactPreset = "email" | "phone" | "iban" | "credit_card" | "dni_nie";
996
+ interface OcrRecognizeParams {
997
+ /** base64-encoded image bytes (max ~50MB); PNG/JPEG/HEIC/TIFF/WebP */
998
+ image: string;
999
+ /** default "accurate" */
1000
+ recognitionLevel?: OcrRecognitionLevel;
1001
+ /** BCP-47 codes; omit for automatic language detection */
1002
+ languages?: string[];
1003
+ /** domain words that bias language correction */
1004
+ customWords?: string[];
1005
+ minConfidence?: number;
1006
+ /** "word" adds per-word boxes; default "line" */
1007
+ granularity?: OcrGranularity;
1008
+ tag?: string;
1009
+ service?: string;
1010
+ }
1011
+ interface OcrWord {
1012
+ text: string;
1013
+ confidence: number;
1014
+ bbox: BoundingBox;
1015
+ }
1016
+ interface OcrLine {
1017
+ text: string;
1018
+ confidence: number;
1019
+ bbox: BoundingBox;
1020
+ /** present at word granularity */
1021
+ words?: OcrWord[];
1022
+ }
1023
+ interface OcrResult {
1024
+ /** all lines joined with \n */
1025
+ text: string;
1026
+ lines: OcrLine[];
1027
+ granularity: string;
1028
+ model: string;
1029
+ provider: string;
1030
+ requestId: string;
1031
+ inferenceTimeMs: number;
1032
+ imageSize: {
1033
+ width: number;
1034
+ height: number;
1035
+ };
1036
+ }
1037
+ interface RedactParams {
1038
+ /** base64-encoded image bytes (max ~50MB) */
1039
+ image: string;
1040
+ /** explicit pixel regions (top-left origin) to redact without OCR */
1041
+ regions?: BoundingBox[];
1042
+ /** regex patterns matched against recognized text */
1043
+ patterns?: string[];
1044
+ /** built-in PII patterns */
1045
+ presets?: RedactPreset[];
1046
+ /** default "word": redact just the matched substring, whole line as fallback */
1047
+ granularity?: OcrGranularity;
1048
+ /** default "blur"; "box" is the safest for hard PII redaction */
1049
+ style?: RedactStyle;
1050
+ blurStrength?: number;
1051
+ /** hex fill for box style, e.g. "#000000" */
1052
+ fillColor?: string;
1053
+ /** extra pixels around each redacted rect (default 4) */
1054
+ padding?: number;
1055
+ recognitionLevel?: OcrRecognitionLevel;
1056
+ languages?: string[];
1057
+ customWords?: string[];
1058
+ minConfidence?: number;
1059
+ tag?: string;
1060
+ service?: string;
1061
+ }
1062
+ interface RedactionDetection {
1063
+ /** matched text (absent for explicit regions) */
1064
+ text?: string;
1065
+ /** preset name, the regex source, or "explicit_region" */
1066
+ pattern: string;
1067
+ bbox: BoundingBox;
1068
+ lineIndex?: number;
1069
+ granularity: string;
1070
+ }
1071
+ interface RedactResult {
1072
+ /** base64 PNG with redactions applied */
1073
+ redactedImage: string;
1074
+ detections: RedactionDetection[];
1075
+ regionsRedacted: number;
1076
+ counts: Record<string, number>;
1077
+ model: string;
1078
+ provider: string;
1079
+ requestId: string;
1080
+ inferenceTimeMs: number;
1081
+ imageSize: {
1082
+ width: number;
1083
+ height: number;
1084
+ };
1085
+ }
1086
+ interface OcrLanguages {
1087
+ recognitionLevels: Record<string, string[]>;
1088
+ }
1089
+
1090
+ declare class OcrResource extends BaseResource {
1091
+ recognize(params: OcrRecognizeParams, poll?: PollOptions): Promise<OcrResult>;
1092
+ recognizeJob(params: OcrRecognizeParams, signal?: AbortSignal): Promise<Job<OcrResult>>;
1093
+ redact(params: RedactParams, poll?: PollOptions): Promise<RedactResult>;
1094
+ redactJob(params: RedactParams, signal?: AbortSignal): Promise<Job<RedactResult>>;
1095
+ languages(signal?: AbortSignal): Promise<OcrLanguages>;
1096
+ }
1097
+
980
1098
  interface CanaryCodersAIOptions {
981
1099
  /** API key. Defaults to `process.env.CANARY_AI_API_KEY` (legacy `CANARYLLM_API_KEY` still read). */
982
1100
  apiKey?: string;
@@ -1004,6 +1122,7 @@ declare class CanaryCodersAI {
1004
1122
  readonly audio: AudioResource;
1005
1123
  readonly embeddings: EmbeddingsResource;
1006
1124
  readonly vision: VisionResource;
1125
+ readonly ocr: OcrResource;
1007
1126
  readonly conversations: ConversationsResource;
1008
1127
  readonly agents: AgentsResource;
1009
1128
  readonly realtime: RealtimeResource;
@@ -1088,4 +1207,4 @@ interface StreamAdapterOptions extends SSEOptions {
1088
1207
 
1089
1208
  // @ts-ignore
1090
1209
  export = CanaryCodersAI;
1091
- export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, toBrokeredCredential };
1210
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, type OcrGranularity, type OcrLanguages, type OcrLine, type OcrRecognitionLevel, type OcrRecognizeParams, type OcrResult, type OcrWord, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type RedactParams, type RedactPreset, type RedactResult, type RedactStyle, type RedactionDetection, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, toBrokeredCredential };
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;
@@ -977,6 +989,112 @@ declare class VisionResource extends BaseResource {
977
989
  }>;
978
990
  }
979
991
 
992
+ type OcrRecognitionLevel = "fast" | "accurate";
993
+ type OcrGranularity = "line" | "word";
994
+ type RedactStyle = "blur" | "box" | "pixelate";
995
+ type RedactPreset = "email" | "phone" | "iban" | "credit_card" | "dni_nie";
996
+ interface OcrRecognizeParams {
997
+ /** base64-encoded image bytes (max ~50MB); PNG/JPEG/HEIC/TIFF/WebP */
998
+ image: string;
999
+ /** default "accurate" */
1000
+ recognitionLevel?: OcrRecognitionLevel;
1001
+ /** BCP-47 codes; omit for automatic language detection */
1002
+ languages?: string[];
1003
+ /** domain words that bias language correction */
1004
+ customWords?: string[];
1005
+ minConfidence?: number;
1006
+ /** "word" adds per-word boxes; default "line" */
1007
+ granularity?: OcrGranularity;
1008
+ tag?: string;
1009
+ service?: string;
1010
+ }
1011
+ interface OcrWord {
1012
+ text: string;
1013
+ confidence: number;
1014
+ bbox: BoundingBox;
1015
+ }
1016
+ interface OcrLine {
1017
+ text: string;
1018
+ confidence: number;
1019
+ bbox: BoundingBox;
1020
+ /** present at word granularity */
1021
+ words?: OcrWord[];
1022
+ }
1023
+ interface OcrResult {
1024
+ /** all lines joined with \n */
1025
+ text: string;
1026
+ lines: OcrLine[];
1027
+ granularity: string;
1028
+ model: string;
1029
+ provider: string;
1030
+ requestId: string;
1031
+ inferenceTimeMs: number;
1032
+ imageSize: {
1033
+ width: number;
1034
+ height: number;
1035
+ };
1036
+ }
1037
+ interface RedactParams {
1038
+ /** base64-encoded image bytes (max ~50MB) */
1039
+ image: string;
1040
+ /** explicit pixel regions (top-left origin) to redact without OCR */
1041
+ regions?: BoundingBox[];
1042
+ /** regex patterns matched against recognized text */
1043
+ patterns?: string[];
1044
+ /** built-in PII patterns */
1045
+ presets?: RedactPreset[];
1046
+ /** default "word": redact just the matched substring, whole line as fallback */
1047
+ granularity?: OcrGranularity;
1048
+ /** default "blur"; "box" is the safest for hard PII redaction */
1049
+ style?: RedactStyle;
1050
+ blurStrength?: number;
1051
+ /** hex fill for box style, e.g. "#000000" */
1052
+ fillColor?: string;
1053
+ /** extra pixels around each redacted rect (default 4) */
1054
+ padding?: number;
1055
+ recognitionLevel?: OcrRecognitionLevel;
1056
+ languages?: string[];
1057
+ customWords?: string[];
1058
+ minConfidence?: number;
1059
+ tag?: string;
1060
+ service?: string;
1061
+ }
1062
+ interface RedactionDetection {
1063
+ /** matched text (absent for explicit regions) */
1064
+ text?: string;
1065
+ /** preset name, the regex source, or "explicit_region" */
1066
+ pattern: string;
1067
+ bbox: BoundingBox;
1068
+ lineIndex?: number;
1069
+ granularity: string;
1070
+ }
1071
+ interface RedactResult {
1072
+ /** base64 PNG with redactions applied */
1073
+ redactedImage: string;
1074
+ detections: RedactionDetection[];
1075
+ regionsRedacted: number;
1076
+ counts: Record<string, number>;
1077
+ model: string;
1078
+ provider: string;
1079
+ requestId: string;
1080
+ inferenceTimeMs: number;
1081
+ imageSize: {
1082
+ width: number;
1083
+ height: number;
1084
+ };
1085
+ }
1086
+ interface OcrLanguages {
1087
+ recognitionLevels: Record<string, string[]>;
1088
+ }
1089
+
1090
+ declare class OcrResource extends BaseResource {
1091
+ recognize(params: OcrRecognizeParams, poll?: PollOptions): Promise<OcrResult>;
1092
+ recognizeJob(params: OcrRecognizeParams, signal?: AbortSignal): Promise<Job<OcrResult>>;
1093
+ redact(params: RedactParams, poll?: PollOptions): Promise<RedactResult>;
1094
+ redactJob(params: RedactParams, signal?: AbortSignal): Promise<Job<RedactResult>>;
1095
+ languages(signal?: AbortSignal): Promise<OcrLanguages>;
1096
+ }
1097
+
980
1098
  interface CanaryCodersAIOptions {
981
1099
  /** API key. Defaults to `process.env.CANARY_AI_API_KEY` (legacy `CANARYLLM_API_KEY` still read). */
982
1100
  apiKey?: string;
@@ -1004,6 +1122,7 @@ declare class CanaryCodersAI {
1004
1122
  readonly audio: AudioResource;
1005
1123
  readonly embeddings: EmbeddingsResource;
1006
1124
  readonly vision: VisionResource;
1125
+ readonly ocr: OcrResource;
1007
1126
  readonly conversations: ConversationsResource;
1008
1127
  readonly agents: AgentsResource;
1009
1128
  readonly realtime: RealtimeResource;
@@ -1086,4 +1205,4 @@ interface StreamAdapterOptions extends SSEOptions {
1086
1205
  includeRaw?: boolean;
1087
1206
  }
1088
1207
 
1089
- export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, CanaryCodersAI as default, toBrokeredCredential };
1208
+ export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, type OcrGranularity, type OcrLanguages, type OcrLine, type OcrRecognitionLevel, type OcrRecognizeParams, type OcrResult, type OcrWord, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type RedactParams, type RedactPreset, type RedactResult, type RedactStyle, type RedactionDetection, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, CanaryCodersAI as default, toBrokeredCredential };
package/dist/index.js CHANGED
@@ -1584,6 +1584,27 @@ var VisionResource = class extends BaseResource {
1584
1584
  }
1585
1585
  };
1586
1586
 
1587
+ // src/resources/ocr.ts
1588
+ var OcrResource = class extends BaseResource {
1589
+ recognize(params, poll) {
1590
+ return this.runQueued("/api/ocr/recognize", params, "vision", poll);
1591
+ }
1592
+ recognizeJob(params, signal) {
1593
+ return this.submitQueued("/api/ocr/recognize", params, "vision", signal);
1594
+ }
1595
+ redact(params, poll) {
1596
+ return this.runQueued("/api/ocr/redact", params, "vision", poll);
1597
+ }
1598
+ redactJob(params, signal) {
1599
+ return this.submitQueued("/api/ocr/redact", params, "vision", signal);
1600
+ }
1601
+ async languages(signal) {
1602
+ return this.transport.json("GET", "/api/ocr/languages", {
1603
+ signal
1604
+ });
1605
+ }
1606
+ };
1607
+
1587
1608
  // src/client.ts
1588
1609
  var DEFAULT_BASE_URL = "https://api.ai.canarycoders.es";
1589
1610
  function readEnv(key) {
@@ -1598,6 +1619,7 @@ var CanaryCodersAI = class {
1598
1619
  audio;
1599
1620
  embeddings;
1600
1621
  vision;
1622
+ ocr;
1601
1623
  conversations;
1602
1624
  agents;
1603
1625
  realtime;
@@ -1630,6 +1652,7 @@ var CanaryCodersAI = class {
1630
1652
  this.audio = new AudioResource(this.transport, poll);
1631
1653
  this.embeddings = new EmbeddingsResource(this.transport, poll);
1632
1654
  this.vision = new VisionResource(this.transport, poll);
1655
+ this.ocr = new OcrResource(this.transport, poll);
1633
1656
  this.conversations = new ConversationsResource(this.transport, poll);
1634
1657
  this.agents = new AgentsResource(this.transport, poll);
1635
1658
  this.realtime = new RealtimeResource(this.transport, poll);