Skip to content

Documentation / @agentick/openai / OpenAIModelProps

Interface: OpenAIModelProps ​

Defined in: openai-model.tsx:14

Props for OpenAIModel component. Extends adapter config with optional Model component props.

Extends ​

  • OpenAIAdapterConfig

Indexable ​

[key: string]: unknown

Properties ​

apiKey? ​

optional apiKey: string

Defined in: types.ts:13

API key used for authentication.

  • Accepts either a static string or an async function that resolves to a string.
  • Defaults to process.env['OPENAI_API_KEY'].
  • When a function is provided, it is invoked before each request so you can rotate or refresh credentials at runtime.
  • The function must return a non-empty string; otherwise an OpenAIError is thrown.
  • If the function throws, the error is wrapped in an OpenAIError with the original error available as cause.

Inherited from ​

OpenAIAdapterConfig.apiKey


baseURL? ​

optional baseURL: string

Defined in: types.ts:14

Override the default base URL for the API, e.g., "https://api.example.com/v2/"

Defaults to process.env['OPENAI_BASE_URL'].

Inherited from ​

OpenAIAdapterConfig.baseURL


client? ​

optional client: OpenAI

Defined in: types.ts:20

Inherited from ​

OpenAIAdapterConfig.client


customBlocks? ​

optional customBlocks: Record<string, CustomBlockDefinition>

Defined in: types.ts:27

Custom blocks to intercept from model output. Forwarded to createAdapter.

Inherited from ​

OpenAIAdapterConfig.customBlocks


deltaTransform? ​

optional deltaTransform: DeltaTransformInput

Defined in: types.ts:29

User-facing delta transform. Forwarded to createAdapter.

Inherited from ​

OpenAIAdapterConfig.deltaTransform


discoverModels? ​

optional discoverModels: boolean

Defined in: types.ts:25

Auto-discover models via /v1/models endpoint and register metadata

Inherited from ​

OpenAIAdapterConfig.discoverModels


embeddingModel? ​

optional embeddingModel: string

Defined in: types.ts:31

Embedding model name (enables .embed() on the returned ModelClass)

Inherited from ​

OpenAIAdapterConfig.embeddingModel


headers? ​

optional headers: Record<string, string>

Defined in: types.ts:17

Inherited from ​

OpenAIAdapterConfig.headers


maxRetries? ​

optional maxRetries: number

Defined in: types.ts:19

The maximum number of times that the client will retry a request in case of a temporary failure, like a network error or a 5XX error from the server.

Default ​

ts
2

Inherited from ​

OpenAIAdapterConfig.maxRetries


model? ​

optional model: string

Defined in: types.ts:12

Inherited from ​

OpenAIAdapterConfig.model


onMount()? ​

optional onMount: (ctx) => void | Promise<void>

Defined in: openai-model.tsx:16

Optional callback when model is mounted

Parameters ​

ctx ​

ContextObjectModel

Returns ​

void | Promise<void>


onUnmount()? ​

optional onUnmount: (ctx) => void | Promise<void>

Defined in: openai-model.tsx:18

Optional callback when model is unmounted

Parameters ​

ctx ​

ContextObjectModel

Returns ​

void | Promise<void>


organization? ​

optional organization: string

Defined in: types.ts:15

Defaults to process.env['OPENAI_ORG_ID'].

Inherited from ​

OpenAIAdapterConfig.organization


parseThinkTags? ​

optional parseThinkTags: boolean

Defined in: types.ts:23

Parse <think>...</think> tags in content as reasoning blocks (for local models)

Inherited from ​

OpenAIAdapterConfig.parseThinkTags


project? ​

optional project: string

Defined in: types.ts:16

Defaults to process.env['OPENAI_PROJECT_ID'].

Inherited from ​

OpenAIAdapterConfig.project


providerOptions? ​

optional providerOptions: ProviderClientOptions

Defined in: types.ts:21

Inherited from ​

OpenAIAdapterConfig.providerOptions


timeout? ​

optional timeout: number

Defined in: types.ts:18

The maximum amount of time (in milliseconds) that the client should wait for a response from the server before timing out a single request.

Note that request timeouts are retried by default, so in a worst-case scenario you may wait much longer than this timeout before the promise succeeds or fails.

Unit ​

milliseconds

Inherited from ​

OpenAIAdapterConfig.timeout

Released under the ISC License.