@providerprotocol/ai 0.0.12 → 0.0.13

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.
Files changed (44) hide show
  1. package/dist/anthropic/index.d.ts +51 -15
  2. package/dist/anthropic/index.js +54 -19
  3. package/dist/anthropic/index.js.map +1 -1
  4. package/dist/{chunk-SUNYWHTH.js → chunk-MOU4U3PO.js} +55 -3
  5. package/dist/chunk-MOU4U3PO.js.map +1 -0
  6. package/dist/{chunk-Y6Q7JCNP.js → chunk-MSR5P65T.js} +1 -1
  7. package/dist/chunk-MSR5P65T.js.map +1 -0
  8. package/dist/{chunk-W4BB4BG2.js → chunk-SVYROCLD.js} +31 -11
  9. package/dist/chunk-SVYROCLD.js.map +1 -0
  10. package/dist/chunk-U4JJC2YX.js +234 -0
  11. package/dist/chunk-U4JJC2YX.js.map +1 -0
  12. package/dist/{chunk-X5G4EHL7.js → chunk-Z7RBRCRN.js} +1 -1
  13. package/dist/chunk-Z7RBRCRN.js.map +1 -0
  14. package/dist/google/index.d.ts +376 -7
  15. package/dist/google/index.js +127 -15
  16. package/dist/google/index.js.map +1 -1
  17. package/dist/http/index.d.ts +222 -25
  18. package/dist/http/index.js +3 -3
  19. package/dist/index.d.ts +1482 -198
  20. package/dist/index.js +230 -46
  21. package/dist/index.js.map +1 -1
  22. package/dist/ollama/index.d.ts +92 -20
  23. package/dist/ollama/index.js +17 -7
  24. package/dist/ollama/index.js.map +1 -1
  25. package/dist/openai/index.d.ts +340 -61
  26. package/dist/openai/index.js +57 -15
  27. package/dist/openai/index.js.map +1 -1
  28. package/dist/openrouter/index.d.ts +107 -51
  29. package/dist/openrouter/index.js +36 -8
  30. package/dist/openrouter/index.js.map +1 -1
  31. package/dist/provider-mKkz7Q9U.d.ts +488 -0
  32. package/dist/retry-Dh70lgr0.d.ts +508 -0
  33. package/dist/xai/index.d.ts +97 -22
  34. package/dist/xai/index.js +55 -19
  35. package/dist/xai/index.js.map +1 -1
  36. package/package.json +8 -3
  37. package/dist/chunk-CUCRF5W6.js +0 -136
  38. package/dist/chunk-CUCRF5W6.js.map +0 -1
  39. package/dist/chunk-SUNYWHTH.js.map +0 -1
  40. package/dist/chunk-W4BB4BG2.js.map +0 -1
  41. package/dist/chunk-X5G4EHL7.js.map +0 -1
  42. package/dist/chunk-Y6Q7JCNP.js.map +0 -1
  43. package/dist/provider-CUJWjgNl.d.ts +0 -192
  44. package/dist/retry-I2661_rv.d.ts +0 -118
@@ -1,17 +1,40 @@
1
- import { b as Provider, M as ModelReference, a as LLMHandler } from '../provider-CUJWjgNl.js';
1
+ import { b as Provider, M as ModelReference, a as LLMHandler } from '../provider-mKkz7Q9U.js';
2
2
 
3
3
  /**
4
- * Audio output configuration for Chat Completions
4
+ * @fileoverview OpenAI Provider Type Definitions
5
+ *
6
+ * This module contains all TypeScript type definitions for the OpenAI provider,
7
+ * including types for both the Chat Completions API and the Responses API.
8
+ *
9
+ * The types are organized into sections:
10
+ * - Audio Configuration Types
11
+ * - Web Search Configuration Types
12
+ * - Chat Completions API Parameters and Types
13
+ * - Responses API Parameters and Types
14
+ * - Built-in Tools for Responses API
15
+ * - Tool Helper Constructors
16
+ *
17
+ * @module providers/openai/types
18
+ */
19
+ /**
20
+ * Audio output configuration for Chat Completions API.
21
+ *
22
+ * Enables audio output generation when using models that support
23
+ * the audio modality. Requires `modalities: ['text', 'audio']`.
5
24
  */
6
25
  interface OpenAIAudioConfig {
7
- /** Audio format */
26
+ /** Audio format for the generated output */
8
27
  format: 'wav' | 'aac' | 'mp3' | 'flac' | 'opus' | 'pcm16';
9
- /** Voice to use for audio generation */
28
+ /** Voice model to use for audio generation */
10
29
  voice: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse' | 'marin' | 'cedar';
11
30
  }
12
31
  /**
13
- * User location for web search context (Responses API format)
14
- * Fields are at the same level as type
32
+ * User location for web search context in the Responses API.
33
+ *
34
+ * Used to localize web search results based on the user's approximate location.
35
+ * In the Responses API, location fields are at the same level as the type field.
36
+ *
37
+ * @see {@link OpenAICompletionsWebSearchUserLocation} for the Chat Completions API version
15
38
  */
16
39
  interface OpenAIWebSearchUserLocation {
17
40
  /** Location type - must be 'approximate' */
@@ -26,8 +49,12 @@ interface OpenAIWebSearchUserLocation {
26
49
  timezone?: string;
27
50
  }
28
51
  /**
29
- * User location for web search context (Chat Completions API format)
30
- * Fields are nested under 'approximate' object
52
+ * User location for web search context in the Chat Completions API.
53
+ *
54
+ * Used to localize web search results based on the user's approximate location.
55
+ * In the Completions API, location fields are nested under an `approximate` object.
56
+ *
57
+ * @see {@link OpenAIWebSearchUserLocation} for the Responses API version
31
58
  */
32
59
  interface OpenAICompletionsWebSearchUserLocation {
33
60
  /** Location type - must be 'approximate' */
@@ -45,8 +72,10 @@ interface OpenAICompletionsWebSearchUserLocation {
45
72
  };
46
73
  }
47
74
  /**
48
- * Web search options for Chat Completions API
49
- * Use with gpt-5-search-api-* models
75
+ * Web search configuration options for the Chat Completions API.
76
+ *
77
+ * Enables web search capabilities when using search-enabled models.
78
+ * Use with models that support web search (e.g., gpt-4o-search-preview).
50
79
  */
51
80
  interface OpenAIWebSearchOptions {
52
81
  /**
@@ -58,8 +87,22 @@ interface OpenAIWebSearchOptions {
58
87
  user_location?: OpenAICompletionsWebSearchUserLocation | null;
59
88
  }
60
89
  /**
61
- * OpenAI Chat Completions API parameters
62
- * These are passed through to the /v1/chat/completions endpoint
90
+ * Parameters for the OpenAI Chat Completions API.
91
+ *
92
+ * These parameters are passed directly to the `/v1/chat/completions` endpoint.
93
+ * The Chat Completions API is the legacy API for chat interactions with
94
+ * OpenAI models. For the modern API with built-in tools, see {@link OpenAIResponsesParams}.
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const params: OpenAICompletionsParams = {
99
+ * temperature: 0.7,
100
+ * max_tokens: 1000,
101
+ * reasoning_effort: 'medium'
102
+ * };
103
+ * ```
104
+ *
105
+ * @see {@link OpenAIResponsesParams} for the modern Responses API parameters
63
106
  */
64
107
  interface OpenAICompletionsParams {
65
108
  /** Maximum number of tokens to generate (legacy, prefer max_completion_tokens) */
@@ -145,7 +188,9 @@ interface OpenAICompletionsParams {
145
188
  web_search_options?: OpenAIWebSearchOptions;
146
189
  }
147
190
  /**
148
- * Prompt template reference for Responses API
191
+ * Reference to a prompt template stored in OpenAI's system.
192
+ *
193
+ * Allows using pre-defined prompt templates with variable substitution.
149
194
  */
150
195
  interface OpenAIPromptTemplate {
151
196
  /** Prompt template ID */
@@ -154,16 +199,43 @@ interface OpenAIPromptTemplate {
154
199
  variables?: Record<string, string>;
155
200
  }
156
201
  /**
157
- * Conversation reference for Responses API
158
- * Items from this conversation are prepended to input_items
202
+ * Reference to an existing conversation for the Responses API.
203
+ *
204
+ * Items from this conversation are prepended to the input items,
205
+ * enabling multi-turn conversations without resending full history.
206
+ * Cannot be used together with `previous_response_id`.
159
207
  */
160
208
  interface OpenAIConversation {
161
209
  /** Conversation ID */
162
210
  id: string;
163
211
  }
164
212
  /**
165
- * OpenAI Responses API parameters
166
- * These are passed through to the /v1/responses endpoint
213
+ * Parameters for the OpenAI Responses API.
214
+ *
215
+ * These parameters are passed directly to the `/v1/responses` endpoint.
216
+ * The Responses API is the modern, recommended API that supports built-in
217
+ * tools like web search, image generation, file search, and code interpreter.
218
+ *
219
+ * @example Basic usage
220
+ * ```typescript
221
+ * const params: OpenAIResponsesParams = {
222
+ * max_output_tokens: 1000,
223
+ * temperature: 0.7,
224
+ * reasoning: { effort: 'medium' }
225
+ * };
226
+ * ```
227
+ *
228
+ * @example With built-in tools
229
+ * ```typescript
230
+ * import { tools } from './types';
231
+ *
232
+ * const params: OpenAIResponsesParams = {
233
+ * max_output_tokens: 2000,
234
+ * tools: [tools.webSearch(), tools.imageGeneration()]
235
+ * };
236
+ * ```
237
+ *
238
+ * @see {@link OpenAICompletionsParams} for the legacy Chat Completions API parameters
167
239
  */
168
240
  interface OpenAIResponsesParams {
169
241
  /** Maximum output tokens */
@@ -259,32 +331,38 @@ interface OpenAIResponsesParams {
259
331
  tools?: OpenAIBuiltInTool[];
260
332
  }
261
333
  /**
262
- * API mode for OpenAI provider
334
+ * The API mode for the OpenAI provider.
335
+ *
336
+ * - `'responses'` - Modern Responses API (recommended)
337
+ * - `'completions'` - Legacy Chat Completions API
263
338
  */
264
339
  type OpenAIAPIMode = 'responses' | 'completions';
265
340
  /**
266
- * Model options when creating a model reference
341
+ * Options when creating an OpenAI model reference.
267
342
  */
268
343
  interface OpenAIModelOptions {
269
344
  /** Which API to use */
270
345
  api?: OpenAIAPIMode;
271
346
  }
272
347
  /**
273
- * Model reference with OpenAI-specific options
348
+ * Model reference with OpenAI-specific options.
349
+ * Used internally to track the selected model and API mode.
274
350
  */
275
351
  interface OpenAIModelReference {
352
+ /** The OpenAI model identifier (e.g., 'gpt-4o', 'o1-preview') */
276
353
  modelId: string;
354
+ /** Optional model-specific options */
277
355
  options?: OpenAIModelOptions;
278
356
  }
279
357
  /**
280
- * OpenAI provider configuration
358
+ * Configuration options for the OpenAI provider.
281
359
  */
282
360
  interface OpenAIConfig {
283
361
  /** Which API to use: 'responses' (modern) or 'completions' (legacy) */
284
362
  api?: 'responses' | 'completions';
285
363
  }
286
364
  /**
287
- * Response format
365
+ * Response format options for structured output.
288
366
  */
289
367
  type OpenAIResponseFormat = {
290
368
  type: 'text';
@@ -300,7 +378,8 @@ type OpenAIResponseFormat = {
300
378
  };
301
379
  };
302
380
  /**
303
- * Tool definition for Responses API
381
+ * Function tool definition for the Responses API.
382
+ * Uses a flatter structure than Chat Completions.
304
383
  */
305
384
  interface OpenAIResponsesTool {
306
385
  type: 'function';
@@ -467,15 +546,48 @@ type OpenAIBuiltInTool = OpenAIWebSearchTool | OpenAIFileSearchTool | OpenAICode
467
546
  */
468
547
  type OpenAIResponsesToolUnion = OpenAIResponsesTool | OpenAIBuiltInTool;
469
548
  /**
470
- * Helper to create a web search tool
471
- * Note: Configuration options are passed at the top level, not nested
549
+ * Creates a web search tool configuration for the Responses API.
550
+ *
551
+ * The web search tool enables the model to search the web for up-to-date information.
552
+ *
553
+ * @param options - Optional configuration for search behavior and user location
554
+ * @returns A web search tool configuration object
555
+ *
556
+ * @example
557
+ * ```typescript
558
+ * // Basic web search
559
+ * const search = webSearchTool();
560
+ *
561
+ * // With configuration
562
+ * const searchWithLocation = webSearchTool({
563
+ * search_context_size: 'high',
564
+ * user_location: {
565
+ * type: 'approximate',
566
+ * city: 'San Francisco',
567
+ * country: 'US'
568
+ * }
569
+ * });
570
+ * ```
472
571
  */
473
572
  declare function webSearchTool(options?: {
474
573
  search_context_size?: 'low' | 'medium' | 'high';
475
574
  user_location?: OpenAIWebSearchUserLocation | null;
476
575
  }): OpenAIWebSearchTool;
477
576
  /**
478
- * Helper to create a file search tool
577
+ * Creates a file search tool configuration for the Responses API.
578
+ *
579
+ * The file search tool enables the model to search through files in vector stores.
580
+ *
581
+ * @param options - Configuration including vector store IDs and search options
582
+ * @returns A file search tool configuration object
583
+ *
584
+ * @example
585
+ * ```typescript
586
+ * const fileSearch = fileSearchTool({
587
+ * vector_store_ids: ['vs_abc123'],
588
+ * max_num_results: 10
589
+ * });
590
+ * ```
479
591
  */
480
592
  declare function fileSearchTool(options: {
481
593
  vector_store_ids: string[];
@@ -487,13 +599,49 @@ declare function fileSearchTool(options: {
487
599
  filters?: Record<string, unknown>;
488
600
  }): OpenAIFileSearchTool;
489
601
  /**
490
- * Helper to create a code interpreter tool
602
+ * Creates a code interpreter tool configuration for the Responses API.
603
+ *
604
+ * The code interpreter tool allows the model to write and execute Python code
605
+ * in a sandboxed environment.
606
+ *
607
+ * @param options - Optional container configuration
608
+ * @returns A code interpreter tool configuration object
609
+ *
610
+ * @example
611
+ * ```typescript
612
+ * // Default configuration
613
+ * const interpreter = codeInterpreterTool();
614
+ *
615
+ * // With custom container settings
616
+ * const customInterpreter = codeInterpreterTool({
617
+ * container: {
618
+ * type: 'auto',
619
+ * memory_limit: '4g',
620
+ * file_ids: ['file_abc123']
621
+ * }
622
+ * });
623
+ * ```
491
624
  */
492
625
  declare function codeInterpreterTool(options?: {
493
626
  container?: string | OpenAICodeInterpreterContainer;
494
627
  }): OpenAICodeInterpreterTool;
495
628
  /**
496
- * Helper to create a computer tool
629
+ * Creates a computer tool configuration for the Responses API.
630
+ *
631
+ * The computer tool enables the model to interact with computer interfaces
632
+ * through mouse and keyboard actions.
633
+ *
634
+ * @param options - Display configuration and environment settings
635
+ * @returns A computer tool configuration object
636
+ *
637
+ * @example
638
+ * ```typescript
639
+ * const computer = computerTool({
640
+ * display_width: 1920,
641
+ * display_height: 1080,
642
+ * environment: { type: 'browser' }
643
+ * });
644
+ * ```
497
645
  */
498
646
  declare function computerTool(options: {
499
647
  display_width: number;
@@ -501,8 +649,25 @@ declare function computerTool(options: {
501
649
  environment?: OpenAIComputerEnvironment;
502
650
  }): OpenAIComputerTool;
503
651
  /**
504
- * Helper to create an image generation tool
505
- * Note: Configuration options are passed at the top level, not nested
652
+ * Creates an image generation tool configuration for the Responses API.
653
+ *
654
+ * The image generation tool allows the model to generate images based on prompts.
655
+ *
656
+ * @param options - Optional image generation settings
657
+ * @returns An image generation tool configuration object
658
+ *
659
+ * @example
660
+ * ```typescript
661
+ * // Default configuration
662
+ * const imageGen = imageGenerationTool();
663
+ *
664
+ * // With custom settings
665
+ * const customImageGen = imageGenerationTool({
666
+ * quality: 'high',
667
+ * size: '1024x1024',
668
+ * background: 'transparent'
669
+ * });
670
+ * ```
506
671
  */
507
672
  declare function imageGenerationTool(options?: {
508
673
  background?: 'transparent' | 'opaque' | 'auto';
@@ -512,7 +677,22 @@ declare function imageGenerationTool(options?: {
512
677
  output_format?: 'png' | 'jpeg' | 'webp';
513
678
  }): OpenAIImageGenerationTool;
514
679
  /**
515
- * Helper to create an MCP tool
680
+ * Creates an MCP (Model Context Protocol) tool configuration for the Responses API.
681
+ *
682
+ * The MCP tool enables connections to external MCP servers, allowing the model
683
+ * to use tools and resources provided by those servers.
684
+ *
685
+ * @param options - MCP server configuration
686
+ * @returns An MCP tool configuration object
687
+ *
688
+ * @example
689
+ * ```typescript
690
+ * const mcp = mcpTool({
691
+ * url: 'https://mcp-server.example.com',
692
+ * name: 'my-mcp-server',
693
+ * allowed_tools: ['tool1', 'tool2']
694
+ * });
695
+ * ```
516
696
  */
517
697
  declare function mcpTool(options: {
518
698
  url: string;
@@ -527,86 +707,185 @@ declare function mcpTool(options: {
527
707
  };
528
708
  }): OpenAIMcpTool;
529
709
  /**
530
- * Namespace for tool helper constructors
710
+ * Namespace object containing all tool helper constructors.
711
+ *
712
+ * Provides a convenient way to create built-in tool configurations
713
+ * for the Responses API.
714
+ *
715
+ * @example
716
+ * ```typescript
717
+ * import { tools } from './types';
718
+ *
719
+ * const params = {
720
+ * tools: [
721
+ * tools.webSearch(),
722
+ * tools.imageGeneration({ quality: 'high' }),
723
+ * tools.codeInterpreter()
724
+ * ]
725
+ * };
726
+ * ```
531
727
  */
532
728
  declare const tools: {
729
+ /** Creates a web search tool configuration */
533
730
  webSearch: typeof webSearchTool;
731
+ /** Creates a file search tool configuration */
534
732
  fileSearch: typeof fileSearchTool;
733
+ /** Creates a code interpreter tool configuration */
535
734
  codeInterpreter: typeof codeInterpreterTool;
735
+ /** Creates a computer tool configuration */
536
736
  computer: typeof computerTool;
737
+ /** Creates an image generation tool configuration */
537
738
  imageGeneration: typeof imageGenerationTool;
739
+ /** Creates an MCP tool configuration */
538
740
  mcp: typeof mcpTool;
539
741
  };
540
742
 
541
- /** Union type for modalities interface */
743
+ /**
744
+ * @fileoverview OpenAI Provider Factory
745
+ *
746
+ * This module provides the main OpenAI provider implementation that supports both
747
+ * the modern Responses API (default) and the legacy Chat Completions API.
748
+ *
749
+ * @example
750
+ * ```typescript
751
+ * import { openai } from './providers/openai';
752
+ * import { llm } from './core/llm';
753
+ *
754
+ * // Using the modern Responses API (default)
755
+ * const model = llm({
756
+ * model: openai('gpt-4o'),
757
+ * params: { max_output_tokens: 1000 }
758
+ * });
759
+ *
760
+ * // Using the legacy Chat Completions API
761
+ * const legacyModel = llm({
762
+ * model: openai('gpt-4o', { api: 'completions' }),
763
+ * params: { max_tokens: 1000 }
764
+ * });
765
+ * ```
766
+ *
767
+ * @module providers/openai
768
+ */
769
+
770
+ /**
771
+ * Union type for the LLM handler that supports both API modes.
772
+ * Used internally for the dynamic handler selection based on API mode.
773
+ */
542
774
  type OpenAILLMParamsUnion = OpenAICompletionsParams | OpenAIResponsesParams;
543
775
  /**
544
- * OpenAI provider options
776
+ * Configuration options for the OpenAI provider.
777
+ *
778
+ * Controls which underlying OpenAI API endpoint is used when making requests.
779
+ * The Responses API is the modern, recommended approach while the Chat Completions
780
+ * API provides backward compatibility with existing integrations.
545
781
  */
546
782
  interface OpenAIProviderOptions {
547
783
  /**
548
- * Which API to use:
549
- * - 'responses': Modern Responses API (default, recommended)
550
- * - 'completions': Legacy Chat Completions API
784
+ * Which API endpoint to use for requests.
785
+ *
786
+ * - `'responses'` - Modern Responses API (default, recommended). Supports built-in
787
+ * tools like web search, image generation, file search, and code interpreter.
788
+ * - `'completions'` - Legacy Chat Completions API. Standard chat completion endpoint
789
+ * with function calling support.
790
+ *
791
+ * @default 'responses'
551
792
  */
552
793
  api?: 'responses' | 'completions';
553
794
  }
554
795
  /**
555
- * OpenAI provider with configurable API mode
796
+ * OpenAI provider interface with configurable API mode.
556
797
  *
557
- * @example
558
- * // Using the modern Responses API (default)
798
+ * The provider is callable as a function to create model references, and also
799
+ * exposes metadata about the provider and its supported modalities.
800
+ *
801
+ * @example Creating model references
802
+ * ```typescript
803
+ * // Using the modern Responses API (default, recommended)
559
804
  * const model = openai('gpt-4o');
560
805
  *
561
- * @example
562
806
  * // Using the legacy Chat Completions API
563
- * const model = openai('gpt-4o', { api: 'completions' });
807
+ * const legacyModel = openai('gpt-4o', { api: 'completions' });
564
808
  *
565
- * @example
566
- * // Explicit Responses API
567
- * const model = openai('gpt-4o', { api: 'responses' });
809
+ * // Explicit Responses API selection
810
+ * const responsesModel = openai('gpt-4o', { api: 'responses' });
811
+ * ```
812
+ *
813
+ * @see {@link OpenAIProviderOptions} for available configuration options
814
+ * @see {@link OpenAIResponsesParams} for Responses API parameters
815
+ * @see {@link OpenAICompletionsParams} for Chat Completions API parameters
568
816
  */
569
817
  interface OpenAIProvider extends Provider<OpenAIProviderOptions> {
570
818
  /**
571
- * Create a model reference
572
- * @param modelId - The model identifier (e.g., 'gpt-4o', 'gpt-4-turbo', 'o1-preview')
573
- * @param options - Provider options including API selection
819
+ * Creates a model reference for the specified OpenAI model.
820
+ *
821
+ * @param modelId - The OpenAI model identifier (e.g., 'gpt-4o', 'gpt-4-turbo', 'o1-preview', 'gpt-4o-mini')
822
+ * @param options - Optional provider configuration including API mode selection
823
+ * @returns A model reference that can be used with the LLM core functions
824
+ *
825
+ * @example
826
+ * ```typescript
827
+ * const gpt4o = openai('gpt-4o');
828
+ * const gpt4turbo = openai('gpt-4-turbo', { api: 'completions' });
829
+ * ```
574
830
  */
575
831
  (modelId: string, options?: OpenAIProviderOptions): ModelReference<OpenAIProviderOptions>;
576
- /** Provider name */
832
+ /**
833
+ * The provider identifier.
834
+ * Always returns `'openai'` for this provider.
835
+ */
577
836
  readonly name: 'openai';
578
- /** Provider version */
837
+ /**
838
+ * The provider version following semantic versioning.
839
+ */
579
840
  readonly version: string;
580
- /** Supported modalities */
841
+ /**
842
+ * Supported modalities and their handlers.
843
+ * Currently supports LLM modality with both Responses and Completions API handlers.
844
+ */
581
845
  readonly modalities: {
846
+ /** The LLM handler for text generation and chat completion */
582
847
  llm: LLMHandler<OpenAILLMParamsUnion>;
583
848
  };
584
849
  }
585
850
  /**
586
- * OpenAI provider
851
+ * The OpenAI provider instance.
587
852
  *
588
- * Supports both the modern Responses API (default) and legacy Chat Completions API.
853
+ * Supports both the modern Responses API (default) and the legacy Chat Completions API.
854
+ * Use this provider to create model references for OpenAI models like GPT-4o, GPT-4 Turbo,
855
+ * and the o1 series.
589
856
  *
590
- * @example
591
- * ```ts
857
+ * @example Basic usage with Responses API (recommended)
858
+ * ```typescript
592
859
  * import { openai } from './providers/openai';
593
860
  * import { llm } from './core/llm';
594
861
  *
595
- * // Using Responses API (default, modern, recommended)
596
862
  * const model = llm({
597
863
  * model: openai('gpt-4o'),
598
- * params: { max_tokens: 1000 }
864
+ * params: { max_output_tokens: 1000 }
599
865
  * });
600
866
  *
601
- * // Using Chat Completions API (legacy)
867
+ * const turn = await model.generate('Hello!');
868
+ * console.log(turn.response.text);
869
+ * ```
870
+ *
871
+ * @example Using Chat Completions API
872
+ * ```typescript
602
873
  * const legacyModel = llm({
603
874
  * model: openai('gpt-4o', { api: 'completions' }),
604
875
  * params: { max_tokens: 1000 }
605
876
  * });
877
+ * ```
606
878
  *
607
- * // Generate
608
- * const turn = await model.generate('Hello!');
609
- * console.log(turn.response.text);
879
+ * @example With built-in tools (Responses API only)
880
+ * ```typescript
881
+ * import { openai, tools } from './providers/openai';
882
+ *
883
+ * const model = llm({
884
+ * model: openai('gpt-4o'),
885
+ * params: {
886
+ * tools: [tools.webSearch(), tools.imageGeneration()]
887
+ * }
888
+ * });
610
889
  * ```
611
890
  */
612
891
  declare const openai: OpenAIProvider;