OpenAIRequest
Defined in: adapters/openai.ts:108
OpenAI Chat Completions API request structure.
Defines all parameters for making a chat completion request to OpenAI’s API. This matches the official OpenAI API specification and is compatible with OpenAI-compatible endpoints (Azure OpenAI, local models, etc.).
- OpenAIMessage
- OpenAIResponse
- https://platform.openai.com/docs/api-reference/chat/create
Example
Section titled “Example”const request: OpenAIRequest = { model: 'gpt-4', messages: [ { role: 'system', content: 'You are a helpful assistant.' }, { role: 'user', content: 'Hello!' } ], temperature: 0.7, max_tokens: 150};Properties
Section titled “Properties”frequency_penalty?
Section titled “frequency_penalty?”
optionalfrequency_penalty:number
Defined in: adapters/openai.ts:125
Penalty for token frequency -2 to 2. Reduces repetition
max_tokens?
Section titled “max_tokens?”
optionalmax_tokens:number
Defined in: adapters/openai.ts:119
Maximum tokens to generate in the response
messages
Section titled “messages”messages:
OpenAIMessage[]
Defined in: adapters/openai.ts:113
Array of conversation messages
model:
string
Defined in: adapters/openai.ts:110
Model ID (e.g., ‘gpt-4’, ‘gpt-3.5-turbo’)
presence_penalty?
Section titled “presence_penalty?”
optionalpresence_penalty:number
Defined in: adapters/openai.ts:128
Penalty for token presence -2 to 2. Encourages new topics
optionalseed:number
Defined in: adapters/openai.ts:140
Deterministic sampling seed for reproducible outputs
optionalstop:string|string[]
Defined in: adapters/openai.ts:131
Stop sequence(s) - generation stops when encountered
stream?
Section titled “stream?”
optionalstream:boolean
Defined in: adapters/openai.ts:134
Enable streaming responses via Server-Sent Events
temperature?
Section titled “temperature?”
optionaltemperature:number
Defined in: adapters/openai.ts:116
Sampling temperature 0-2. Higher = more random. Default 1
top_p?
Section titled “top_p?”
optionaltop_p:number
Defined in: adapters/openai.ts:122
Nucleus sampling parameter 0-1. Alternative to temperature
optionaluser:string
Defined in: adapters/openai.ts:137
Unique user identifier for abuse monitoring