@llmnative/react 1.15.5 → 1.16.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.
@@ -43,6 +43,14 @@ export type AIConfig = {
43
43
  anthropicApiKey?: string;
44
44
  mistralApiKey?: string;
45
45
  glmApiKey?: string;
46
+ /** Cloudflare Workers AI — both apiToken and accountId are required (the account id is part of every URL). */
47
+ cloudflare?: {
48
+ apiToken?: string;
49
+ accountId?: string;
50
+ defaultModel?: string;
51
+ /** Keep models that require the Workers Paid plan in model discovery. Default: false. */
52
+ includePaidModels?: boolean;
53
+ };
46
54
  openAICompatible?: {
47
55
  apiKey?: string;
48
56
  baseUrl?: string;
@@ -78,8 +78,8 @@ export { loadGoogleMaps } from './providers/googleMaps/loadGoogleMaps';
78
78
  export type { GoogleMapsConfig } from './providers/googleMaps/loadGoogleMaps';
79
79
  export { useEmailProvider, EmailProvider } from './providers/email/EmailProviderContext';
80
80
  export { GmailEmailProvider } from './providers/email/google/GmailEmailProvider';
81
- export type { AIRequestOptions, AIAttachment, AIProviderAdapter, AIKeyValidationResult, AIModelDescriptor, AIProviderCapabilities, AIModelCatalog, AIProviderDefinition, AICompleteRequest, AICompleteResult, AIConversationTurn, AIToolDefinition, AIToolCall, AIToolResult, } from './providers/ai';
82
- export { createAIProviderRegistry, getAIModelCatalog, formatAIModelRef, parseAIModelRef, AI_PROVIDER_DEFINITIONS, AI_PROVIDER_DESCRIPTORS, OPENAI_COMPATIBLE_PROVIDER_DESCRIPTOR, toProviderDescriptor } from './providers/ai';
81
+ export type { AIRequestOptions, AIAttachment, AIProviderAdapter, AIKeyValidationResult, AIModelDescriptor, AIProviderCapabilities, AIModelCatalog, AIProviderDefinition, AICompleteRequest, AICompleteResult, AIConversationTurn, AIToolDefinition, AIToolCall, AIToolResult, CloudflareProviderOptions, } from './providers/ai';
82
+ export { createAIProviderRegistry, getAIModelCatalog, formatAIModelRef, parseAIModelRef, AI_PROVIDER_DEFINITIONS, AI_PROVIDER_DESCRIPTORS, OPENAI_COMPATIBLE_PROVIDER_DESCRIPTOR, CLOUDFLARE_PROVIDER_DESCRIPTOR, createCloudflareProviderDefinition, toProviderDescriptor } from './providers/ai';
83
83
  export type { ProviderDescriptor, ProviderCredentialField } from './providers/ProviderDescriptor';
84
84
  export { useAIProvider, useAIProviderRegistry, AIProvider } from './providers/ai/AIProviderContext';
85
85
  export { proxyFetch, useProxy, configureProxy, isProxyEnabled } from './providers/proxy';
@@ -0,0 +1,14 @@
1
+ import type { ProviderDescriptor } from '../ProviderDescriptor';
2
+ import { type AIProviderDefinition } from './shared';
3
+ export type CloudflareProviderOptions = {
4
+ accountId: string;
5
+ defaultModel?: string;
6
+ /** Keep models flagged `require_workers_paid` in discovery (they fail with 403 on the Free plan). */
7
+ includePaidModels?: boolean;
8
+ };
9
+ /** Built per account: the account id is part of every Workers AI URL, while
10
+ * AIProviderDefinition.complete()/discoverModels() only ever receive the API token. */
11
+ export declare const createCloudflareProviderDefinition: ({ accountId, defaultModel, includePaidModels, }: CloudflareProviderOptions) => AIProviderDefinition;
12
+ /** "Connect this provider" metadata — the working definition needs an account id, so (like
13
+ * openai-compatible) it is built only once one is configured; see createAIProviderRegistry. */
14
+ export declare const CLOUDFLARE_PROVIDER_DESCRIPTOR: ProviderDescriptor;
@@ -6,11 +6,16 @@ export type { AIProviderAdapter, AIKeyValidationResult, AIModelDescriptor, AIPro
6
6
  export { formatAIModelRef, parseAIModelRef } from './AIProvider';
7
7
  export type { AIModelCatalog, AIProviderDefinition } from './shared';
8
8
  export { getAIModelCatalog } from './shared';
9
+ export { CLOUDFLARE_PROVIDER_DESCRIPTOR, createCloudflareProviderDefinition } from './cloudflare';
10
+ export type { CloudflareProviderOptions } from './cloudflare';
9
11
  export declare const AI_PROVIDER_DEFINITIONS: AIProviderDefinition[];
10
12
  /** Generic "connect this provider" view of an AIProviderDefinition — the shape a CMS/admin
11
13
  * UI needs (label, description, credential fields, where to find them), independent of the
12
14
  * runtime completion contract (discoverModels/complete) it also carries. */
13
15
  export declare const toProviderDescriptor: (definition: AIProviderDefinition) => ProviderDescriptor;
16
+ /** Includes Cloudflare: like openai-compatible its working definition needs a second credential
17
+ * (the account id) before it can be built, but unlike openai-compatible it is a fixed, named
18
+ * vendor — a "connect" UI should list it alongside the others. */
14
19
  export declare const AI_PROVIDER_DESCRIPTORS: ProviderDescriptor[];
15
20
  /** The user-configurable "bring your own endpoint" slot — metadata-only counterpart of the
16
21
  * dynamic definition getDynamicAIProviderDefinitions() builds once a baseUrl is actually
@@ -1,7 +1,7 @@
1
1
  import { type ProviderConfigurationState } from '../ProviderConfiguration';
2
2
  import type { ProviderCredentialField } from '../ProviderDescriptor';
3
3
  import type { AICompleteRequest, AICompleteResult, AIKeyValidationResult, AIModelDescriptor, AIProviderAdapter, AIProviderCapabilities, AIRequestOptions } from './AIProvider';
4
- export type BuiltInAIProviderId = 'openai' | 'openrouter' | 'opencode' | 'openai-compatible' | 'deepseek' | 'gemini' | 'anthropic' | 'mistral' | 'glm';
4
+ export type BuiltInAIProviderId = 'openai' | 'openrouter' | 'opencode' | 'openai-compatible' | 'deepseek' | 'gemini' | 'anthropic' | 'mistral' | 'glm' | 'cloudflare';
5
5
  export type AIProviderDefinition = {
6
6
  id: BuiltInAIProviderId;
7
7
  label: string;
@@ -35,7 +35,7 @@ export type DataDriverName = 'dbRealtime' | 'firestoreDb' | 'supabaseDb' | 'mock
35
35
  export type StorageDriverName = 'firestorage' | 'supabaseStorage';
36
36
  export type AuthDriverName = 'googleAuth' | 'firebaseAuth' | 'dropboxAuth' | 'supabaseAuth';
37
37
  export type EmailDriverName = 'gmail';
38
- export type AIDriverName = 'openai' | 'openrouter' | 'opencode' | 'openai-compatible' | 'deepseek' | 'gemini' | 'anthropic' | 'mistral';
38
+ export type AIDriverName = 'openai' | 'openrouter' | 'opencode' | 'openai-compatible' | 'deepseek' | 'gemini' | 'anthropic' | 'mistral' | 'cloudflare';
39
39
  export type CredentialsDriverName = 'googleServiceAccount';
40
40
  export type ServicesConfig = {
41
41
  data?: DataDriverName | string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmnative/react",
3
- "version": "1.15.5",
3
+ "version": "1.16.0",
4
4
  "description": "LLM-native React framework for deterministic UI generation. Data-driven by default, schema-driven optional. Ultra-low token consumption — built for AI agents, not just humans.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",