@namzu/openai 1.3.0 → 1.5.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/src/index.ts CHANGED
@@ -1,15 +1,23 @@
1
1
  import { ProviderRegistry, type RegisterOptions } from '@namzu/sdk'
2
2
  import { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js'
3
+ import { CODEX_CAPABILITIES, CodexProvider } from './codex.js'
3
4
  import type { OpenAIProviderConfig } from './types.js'
5
+ import type { CodexProviderConfig } from './types.js'
4
6
 
5
7
  // Module augmentation: register openai's config type in the sdk's registry interface.
6
8
  // This must live inside index.ts (not a .d.ts) so it executes when index.ts is imported.
7
9
  declare module '@namzu/sdk' {
8
10
  interface ProviderConfigRegistry {
9
11
  openai: OpenAIProviderConfig
12
+ codex: CodexProviderConfig
10
13
  }
11
14
  }
12
15
 
16
+ /** Register the ChatGPT subscription-backed Codex Responses transport. */
17
+ export function registerCodex(options?: RegisterOptions): void {
18
+ ProviderRegistry.register('codex', CodexProvider, CODEX_CAPABILITIES, options)
19
+ }
20
+
13
21
  /**
14
22
  * Register `OpenAIProvider` under the `'openai'` type in `@namzu/sdk`'s
15
23
  * `ProviderRegistry`. Call once at app startup before
@@ -22,5 +30,18 @@ export function registerOpenAI(options?: RegisterOptions): void {
22
30
  ProviderRegistry.register('openai', OpenAIProvider, OPENAI_CAPABILITIES, options)
23
31
  }
24
32
 
25
- export { OPENAI_CAPABILITIES, OpenAIProvider } from './client.js'
26
- export type { OpenAIConfig, OpenAIProviderConfig } from './types.js'
33
+ export {
34
+ OPENAI_CAPABILITIES,
35
+ OpenAIProvider,
36
+ openAIReasoningEffortLevels,
37
+ } from './client.js'
38
+ export {
39
+ CODEX_CAPABILITIES,
40
+ CodexProvider,
41
+ } from './codex.js'
42
+ export type {
43
+ CodexConfig,
44
+ CodexProviderConfig,
45
+ OpenAIConfig,
46
+ OpenAIProviderConfig,
47
+ } from './types.js'
package/src/types.ts CHANGED
@@ -26,3 +26,20 @@ export interface OpenAIConfig {
26
26
  export interface OpenAIProviderConfig extends OpenAIConfig {
27
27
  type: 'openai'
28
28
  }
29
+
30
+ /** ChatGPT subscription transport used by the Codex Responses backend. */
31
+ export interface CodexConfig {
32
+ accessToken: string
33
+ accountId: string
34
+ /** Default model. Can be overridden per call. */
35
+ model?: string
36
+ /** Defaults to the ChatGPT Codex backend. */
37
+ baseURL?: string
38
+ /** Request timeout in milliseconds. */
39
+ timeout?: number
40
+ defaultHeaders?: Record<string, string>
41
+ }
42
+
43
+ export interface CodexProviderConfig extends CodexConfig {
44
+ type: 'codex'
45
+ }