OpenAiClient
Constructors
Signature
declare function make(options: {
readonly apiKey?: Redacted<string>;
readonly apiUrl?: string;
readonly organizationId?: Redacted<string>;
readonly projectId?: Redacted<string>;
readonly transformClient?: (client: HttpClient) => HttpClient;
}): Effect<Service, never, any>;Context
OpenAiClient
Signature
declare class OpenAiClient extends any {
constructor();
}Layers
Signature
declare function layer(options: {
readonly apiKey?: Redacted<string>;
readonly apiUrl?: string;
readonly organizationId?: Redacted<string>;
readonly projectId?: Redacted<string>;
readonly transformClient?: (client: HttpClient) => HttpClient;
}): Layer<OpenAiClient, never, HttpClient>;layerConfig
Signature
declare function layerConfig(options: {
readonly apiKey?: Config<Redacted<string> | undefined>;
readonly apiUrl?: Config<string | undefined>;
readonly organizationId?: Config<Redacted<string> | undefined>;
readonly projectId?: Config<Redacted<string> | undefined>;
readonly transformClient?: (client: HttpClient) => HttpClient;
}): Layer<OpenAiClient, ConfigError, HttpClient>;Models
ResponseStreamEvent type
Signature
type ResponseStreamEvent = typeof ResponseStreamEvent.Type;Signature
interface Service {
readonly client: Client;
readonly createEmbedding: (options: {
[key: string]: any;
}) => Effect<CreateEmbeddingResponse, AiError>;
readonly createResponse: (options: { [key: string]: any }) => Effect<Response, AiError>;
readonly createResponseStream: (
options: Omit<typeof Generated.CreateResponse.Encoded, "stream">,
) => Stream<
| ResponseCreatedEvent
| ResponseQueuedEvent
| ResponseInProgressEvent
| ResponseCompletedEvent
| ResponseIncompleteEvent
| ResponseFailedEvent
| ResponseOutputItemAddedEvent
| ResponseOutputItemDoneEvent
| ResponseContentPartAddedEvent
| ResponseContentPartDoneEvent
| ResponseOutputTextDeltaEvent
| ResponseOutputTextDoneEvent
| ResponseOutputTextAnnotationAddedEvent
| ResponseRefusalDeltaEvent
| ResponseRefusalDoneEvent
| ResponseFunctionCallArgumentsDeltaEvent
| ResponseFunctionCallArgumentsDoneEvent
| ResponseFileSearchCallInProgressEvent
| ResponseFileSearchCallSearchingEvent
| ResponseFileSearchCallCompletedEvent
| ResponseWebSearchCallInProgressEvent
| ResponseWebSearchCallSearchingEvent
| ResponseWebSearchCallCompletedEvent
| ResponseReasoningSummaryPartAddedEvent
| ResponseReasoningSummaryPartDoneEvent
| ResponseReasoningSummaryTextDeltaEvent
| ResponseReasoningSummaryTextDoneEvent
| ResponseReasoningTextDeltaEvent
| ResponseReasoningTextDoneEvent
| ResponseImageGenerationCallInProgressEvent
| ResponseImageGenerationCallGeneratingEvent
| ResponseImageGenerationCallPartialImageEvent
| ResponseImageGenerationCallCompletedEvent
| ResponseMcpCallArgumentsDeltaEvent
| ResponseMcpCallArgumentsDoneEvent
| ResponseMcpCallInProgressEvent
| ResponseMcpCallCompletedEvent
| ResponseMcpCallFailedEvent
| ResponseMcpListToolsInProgressEvent
| ResponseMcpListToolsCompletedEvent
| ResponseMcpListToolsFailedEvent
| ResponseCodeInterpreterCallInProgressEvent
| ResponseCodeInterpreterCallInterpretingEvent
| ResponseCodeInterpreterCallCompletedEvent
| ResponseCodeInterpreterCallCodeDeltaEvent
| ResponseCodeInterpreterCallCodeDoneEvent
| ResponseCustomToolCallInputDeltaEvent
| ResponseCustomToolCallInputDoneEvent
| ResponseErrorEvent,
AiError
>;
readonly streamRequest: <A, I, R>(
request: HttpClientRequest,
schema: any,
) => Stream<A, AiError, R>;
}StreamCompletionRequest type
Signature
type StreamCompletionRequest = Omit<typeof Generated.CreateChatCompletionRequest.Encoded, "stream">;Schemas
Signature
declare class LogProbs extends ReadonlySide<
{
readonly logprob: Number;
readonly token: String;
readonly top_logprobs: $Array<
Struct<{
readonly logprob: Number;
readonly token: String;
}>
>;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly logprob: Number;
readonly token: String;
readonly top_logprobs: $Array<
Struct<{
readonly logprob: Number;
readonly token: String;
}>
>;
}>,
options?: MakeOptions,
]
);
}ResponseCodeInterpreterCallCodeDeltaEvent
Emitted when a partial code snippet is streamed by the code interpreter.
Signature
declare class ResponseCodeInterpreterCallCodeDeltaEvent extends ReadonlySide<
{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call_code.delta">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call_code.delta">;
}>,
options?: MakeOptions,
]
);
}ResponseCodeInterpreterCallCodeDoneEvent
Emitted when the code snippet is finalized by the code interpreter.
Signature
declare class ResponseCodeInterpreterCallCodeDoneEvent extends ReadonlySide<
{
readonly code: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call_code.done">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly code: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call_code.done">;
}>,
options?: MakeOptions,
]
);
}ResponseCodeInterpreterCallCompletedEvent
Emitted when the code interpreter call is completed.
Signature
declare class ResponseCodeInterpreterCallCompletedEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call.completed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call.completed">;
}>,
options?: MakeOptions,
]
);
}ResponseCodeInterpreterCallInProgressEvent
Emitted when a code interpreter call is in progress.
Signature
declare class ResponseCodeInterpreterCallInProgressEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call.in_progress">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call.in_progress">;
}>,
options?: MakeOptions,
]
);
}ResponseCodeInterpreterCallInterpretingEvent
Emitted when the code interpreter is actively interpreting the code snippet.
Signature
declare class ResponseCodeInterpreterCallInterpretingEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call.interpreting">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.code_interpreter_call.interpreting">;
}>,
options?: MakeOptions,
]
);
}ResponseCompletedEvent
Emitted when the model response is complete.
Signature
declare class ResponseCompletedEvent extends ReadonlySide<
{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.completed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.completed">;
}>,
options?: MakeOptions,
]
);
}ResponseContentPartAddedEvent
Emitted when a new content part is added.
Signature
declare class ResponseContentPartAddedEvent extends ReadonlySide<{
readonly content_index: Int;
readonly item_id: String;
readonly output_index: Int;
readonly part: Union<readonly Array<Constraint>>;
readonly sequence_number: Int;
readonly type: Literal<"response.content_part.added">;
}, "Type"> {
constructor(...args: [props: ReadonlyMakeIn<{
readonly content_index: Int;
readonly item_id: String;
readonly output_index: Int;
readonly part: Union<readonly Array<Constraint>>;
readonly sequence_number: Int;
readonly type: Literal<"response.content_part.added">;
}>, options?: MakeOptions]);
}ResponseContentPartDoneEvent
Emitted when a content part is done.
Signature
declare class ResponseContentPartDoneEvent extends ReadonlySide<{
readonly content_index: Int;
readonly item_id: String;
readonly output_index: Int;
readonly part: Union<readonly Array<Constraint>>;
readonly sequence_number: Int;
readonly type: Literal<"response.content_part.done">;
}, "Type"> {
constructor(...args: [props: ReadonlyMakeIn<{
readonly content_index: Int;
readonly item_id: String;
readonly output_index: Int;
readonly part: Union<readonly Array<Constraint>>;
readonly sequence_number: Int;
readonly type: Literal<"response.content_part.done">;
}>, options?: MakeOptions]);
}ResponseCreatedEvent
An event that is emitted when a response is created.
Signature
declare class ResponseCreatedEvent extends ReadonlySide<
{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.created">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.created">;
}>,
options?: MakeOptions,
]
);
}ResponseCustomToolCallInputDeltaEvent
Event representing a delta (partial update) to the input of a custom tool call.
Signature
declare class ResponseCustomToolCallInputDeltaEvent extends ReadonlySide<
{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.custom_tool_call_input.delta">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.custom_tool_call_input.delta">;
}>,
options?: MakeOptions,
]
);
}ResponseCustomToolCallInputDoneEvent
Event indicating that input for a custom tool call is complete.
Signature
declare class ResponseCustomToolCallInputDoneEvent extends ReadonlySide<
{
readonly input: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.custom_tool_call_input.done">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly input: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.custom_tool_call_input.done">;
}>,
options?: MakeOptions,
]
);
}ResponseErrorEvent
Emitted when an error occurs.
Signature
declare class ResponseErrorEvent extends {
readonly code?: string | null;
readonly message: string;
readonly param?: string | null;
readonly sequence_number: number;
readonly type: "error";
} {
constructor(...args: [props: {
readonly code?: string | null;
readonly message: string;
readonly param?: string | null;
readonly sequence_number: number;
readonly type: "error";
}, options?: MakeOptions]);
}ResponseFailedEvent
An event that is emitted when a response fails.
Signature
declare class ResponseFailedEvent extends ReadonlySide<
{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.failed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.failed">;
}>,
options?: MakeOptions,
]
);
}ResponseFileSearchCallCompletedEvent
Emitted when a file search call is completed (results found).
Signature
declare class ResponseFileSearchCallCompletedEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.file_search_call.completed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.file_search_call.completed">;
}>,
options?: MakeOptions,
]
);
}ResponseFileSearchCallInProgressEvent
Emitted when a file search call is initiated.
Signature
declare class ResponseFileSearchCallInProgressEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.file_search_call.in_progress">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.file_search_call.in_progress">;
}>,
options?: MakeOptions,
]
);
}ResponseFileSearchCallSearchingEvent
Emitted when a file search is currently searching.
Signature
declare class ResponseFileSearchCallSearchingEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.file_search_call.searching">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.file_search_call.searching">;
}>,
options?: MakeOptions,
]
);
}ResponseFunctionCallArgumentsDeltaEvent
Emitted when there is a partial function-call arguments delta.
Signature
declare class ResponseFunctionCallArgumentsDeltaEvent extends ReadonlySide<
{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.function_call_arguments.delta">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.function_call_arguments.delta">;
}>,
options?: MakeOptions,
]
);
}ResponseFunctionCallArgumentsDoneEvent
Emitted when function-call arguments are finalized.
Signature
declare class ResponseFunctionCallArgumentsDoneEvent extends ReadonlySide<
{
readonly arguments: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.function_call_arguments.done">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly arguments: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.function_call_arguments.done">;
}>,
options?: MakeOptions,
]
);
}ResponseImageGenerationCallCompletedEvent
Emitted when an image generation tool call has completed and the final image is available.
Signature
declare class ResponseImageGenerationCallCompletedEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.image_generation_call.completed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.image_generation_call.completed">;
}>,
options?: MakeOptions,
]
);
}ResponseImageGenerationCallGeneratingEvent
Emitted when an image generation tool call is actively generating an image (intermediate state).
Signature
declare class ResponseImageGenerationCallGeneratingEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.image_generation_call.generating">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.image_generation_call.generating">;
}>,
options?: MakeOptions,
]
);
}ResponseImageGenerationCallInProgressEvent
Emitted when an image generation tool call is in progress.
Signature
declare class ResponseImageGenerationCallInProgressEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.image_generation_call.in_progress">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.image_generation_call.in_progress">;
}>,
options?: MakeOptions,
]
);
}ResponseImageGenerationCallPartialImageEvent
Emitted when a partial image is available during image generation streaming.
Signature
declare class ResponseImageGenerationCallPartialImageEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly partial_image_b64: String;
readonly partial_image_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.image_generation_call.partial_image">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly partial_image_b64: String;
readonly partial_image_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.image_generation_call.partial_image">;
}>,
options?: MakeOptions,
]
);
}ResponseIncompleteEvent
An event that is emitted when a response finishes as incomplete.
Signature
declare class ResponseIncompleteEvent extends ReadonlySide<
{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.incomplete">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.incomplete">;
}>,
options?: MakeOptions,
]
);
}ResponseInProgressEvent
Emitted when the response is in progress.
Signature
declare class ResponseInProgressEvent extends ReadonlySide<
{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.in_progress">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.in_progress">;
}>,
options?: MakeOptions,
]
);
}ResponseMcpCallArgumentsDeltaEvent
Emitted when there is a delta (partial update) to the arguments of an MCP tool call.
Signature
declare class ResponseMcpCallArgumentsDeltaEvent extends ReadonlySide<
{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call_arguments.delta">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call_arguments.delta">;
}>,
options?: MakeOptions,
]
);
}ResponseMcpCallArgumentsDoneEvent
Emitted when the arguments for an MCP tool call are finalized.
Signature
declare class ResponseMcpCallArgumentsDoneEvent extends ReadonlySide<
{
readonly arguments: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call_arguments.done">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly arguments: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call_arguments.done">;
}>,
options?: MakeOptions,
]
);
}ResponseMcpCallCompletedEvent
Emitted when an MCP tool call has completed successfully.
Signature
declare class ResponseMcpCallCompletedEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call.completed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call.completed">;
}>,
options?: MakeOptions,
]
);
}ResponseMcpCallFailedEvent
Emitted when an MCP tool call has failed.
Signature
declare class ResponseMcpCallFailedEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call.failed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call.failed">;
}>,
options?: MakeOptions,
]
);
}ResponseMcpCallInProgressEvent
Emitted when an MCP tool call is in progress.
Signature
declare class ResponseMcpCallInProgressEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call.in_progress">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_call.in_progress">;
}>,
options?: MakeOptions,
]
);
}ResponseMcpListToolsCompletedEvent
Emitted when the list of available MCP tools has been successfully retrieved.
Signature
declare class ResponseMcpListToolsCompletedEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_list_tools.completed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_list_tools.completed">;
}>,
options?: MakeOptions,
]
);
}ResponseMcpListToolsFailedEvent
Emitted when the attempt to list available MCP tools has failed.
Signature
declare class ResponseMcpListToolsFailedEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_list_tools.failed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_list_tools.failed">;
}>,
options?: MakeOptions,
]
);
}ResponseMcpListToolsInProgressEvent
Emitted when the system is in the process of retrieving the list of available MCP tools.
Signature
declare class ResponseMcpListToolsInProgressEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_list_tools.in_progress">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.mcp_list_tools.in_progress">;
}>,
options?: MakeOptions,
]
);
}ResponseOutputItemAddedEvent
Emitted when a new output item is added.
Signature
declare class ResponseOutputItemAddedEvent extends ReadonlySide<{
readonly item: Union<readonly Array<Constraint>>;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.output_item.added">;
}, "Type"> {
constructor(...args: [props: ReadonlyMakeIn<{
readonly item: Union<readonly Array<Constraint>>;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.output_item.added">;
}>, options?: MakeOptions]);
}ResponseOutputItemDoneEvent
Emitted when an output item is marked done.
Signature
declare class ResponseOutputItemDoneEvent extends ReadonlySide<Fields, "Type"> {
[key: string]: unknown;
[key: number]: unknown;
[key: symbol]: unknown;
constructor(...args: [props?: ReadonlyMakeIn<Fields>, options?: MakeOptions]);
}ResponseOutputTextAnnotationAddedEvent
Emitted when an annotation is added to output text content.
Signature
declare class ResponseOutputTextAnnotationAddedEvent extends ReadonlySide<Fields, "Type"> {
[key: string]: unknown;
[key: number]: unknown;
[key: symbol]: unknown;
constructor(...args: [props?: ReadonlyMakeIn<Fields>, options?: MakeOptions]);
}ResponseOutputTextDeltaEvent
Emitted when there is an additional text delta.
Signature
declare class ResponseOutputTextDeltaEvent extends {
readonly content_index: number;
readonly delta: string;
readonly item_id: string;
readonly logprobs?: readonly Array<LogProbs> | null;
readonly output_index: number;
readonly sequence_number: number;
readonly type: "response.output_text.delta";
} {
constructor(...args: [props: {
readonly content_index: number;
readonly delta: string;
readonly item_id: string;
readonly logprobs?: readonly Array<LogProbs> | null;
readonly output_index: number;
readonly sequence_number: number;
readonly type: "response.output_text.delta";
}, options?: MakeOptions]);
}ResponseOutputTextDoneEvent
Emitted when text content is finalized.
Signature
declare class ResponseOutputTextDoneEvent extends {
readonly content_index: number;
readonly item_id: string;
readonly logprobs?: readonly Array<LogProbs> | null;
readonly output_index: number;
readonly sequence_number: number;
readonly text: string;
readonly type: "response.output_text.done";
} {
constructor(...args: [props: {
readonly content_index: number;
readonly item_id: string;
readonly logprobs?: readonly Array<LogProbs> | null;
readonly output_index: number;
readonly sequence_number: number;
readonly text: string;
readonly type: "response.output_text.done";
}, options?: MakeOptions]);
}ResponseQueuedEvent
Emitted when a response is queued and waiting to be processed.
Signature
declare class ResponseQueuedEvent extends ReadonlySide<
{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.queued">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly response: typeof Response;
readonly sequence_number: Int;
readonly type: Literal<"response.queued">;
}>,
options?: MakeOptions,
]
);
}ResponseReasoningSummaryPartAddedEvent
Emitted when a reasoning summary part is completed.
Signature
declare class ResponseReasoningSummaryPartAddedEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly part: typeof SummaryPart;
readonly sequence_number: Int;
readonly summary_index: Int;
readonly type: Literal<"response.reasoning_summary_part.added">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly part: typeof SummaryPart;
readonly sequence_number: Int;
readonly summary_index: Int;
readonly type: Literal<"response.reasoning_summary_part.added">;
}>,
options?: MakeOptions,
]
);
}ResponseReasoningSummaryPartDoneEvent
Emitted when a new reasoning summary part is added.
Signature
declare class ResponseReasoningSummaryPartDoneEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly part: typeof SummaryPart;
readonly sequence_number: Int;
readonly summary_index: Int;
readonly type: Literal<"response.reasoning_summary_part.done">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly part: typeof SummaryPart;
readonly sequence_number: Int;
readonly summary_index: Int;
readonly type: Literal<"response.reasoning_summary_part.done">;
}>,
options?: MakeOptions,
]
);
}ResponseReasoningSummaryTextDeltaEvent
Emitted when a delta is added to a reasoning summary text.
Signature
declare class ResponseReasoningSummaryTextDeltaEvent extends ReadonlySide<
{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly summary_index: Int;
readonly type: Literal<"response.reasoning_summary_text.delta">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly summary_index: Int;
readonly type: Literal<"response.reasoning_summary_text.delta">;
}>,
options?: MakeOptions,
]
);
}ResponseReasoningSummaryTextDoneEvent
Emitted when a reasoning summary text is completed.
Signature
declare class ResponseReasoningSummaryTextDoneEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly summary_index: Int;
readonly text: String;
readonly type: Literal<"response.reasoning_summary_text.done">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly summary_index: Int;
readonly text: String;
readonly type: Literal<"response.reasoning_summary_text.done">;
}>,
options?: MakeOptions,
]
);
}ResponseReasoningTextDeltaEvent
Emitted when a delta is added to a reasoning text.
Signature
declare class ResponseReasoningTextDeltaEvent extends ReadonlySide<
{
readonly content_index: Int;
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.reasoning_text.delta">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly content_index: Int;
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.reasoning_text.delta">;
}>,
options?: MakeOptions,
]
);
}ResponseReasoningTextDoneEvent
Emitted when a reasoning text is completed.
Signature
declare class ResponseReasoningTextDoneEvent extends ReadonlySide<
{
readonly content_index: Int;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly text: String;
readonly type: Literal<"response.reasoning_text.done">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly content_index: Int;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly text: String;
readonly type: Literal<"response.reasoning_text.done">;
}>,
options?: MakeOptions,
]
);
}ResponseRefusalDeltaEvent
Emitted when there is a partial refusal text.
Signature
declare class ResponseRefusalDeltaEvent extends ReadonlySide<
{
readonly content_index: Int;
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.refusal.delta">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly content_index: Int;
readonly delta: String;
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.refusal.delta">;
}>,
options?: MakeOptions,
]
);
}ResponseRefusalDoneEvent
Emitted when refusal text is finalized.
Signature
declare class ResponseRefusalDoneEvent extends ReadonlySide<
{
readonly content_index: Int;
readonly item_id: String;
readonly output_index: Int;
readonly refusal: String;
readonly sequence_number: Int;
readonly type: Literal<"response.refusal.done">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly content_index: Int;
readonly item_id: String;
readonly output_index: Int;
readonly refusal: String;
readonly sequence_number: Int;
readonly type: Literal<"response.refusal.done">;
}>,
options?: MakeOptions,
]
);
}ResponseStreamEvent
Represents the events that can be emitted during a streaming response.
Signature
declare const ResponseStreamEvent: Schema.Union<
[
typeof ResponseCreatedEvent,
typeof ResponseQueuedEvent,
typeof ResponseInProgressEvent,
typeof ResponseCompletedEvent,
typeof ResponseIncompleteEvent,
typeof ResponseFailedEvent,
typeof ResponseOutputItemAddedEvent,
typeof ResponseOutputItemDoneEvent,
typeof ResponseContentPartAddedEvent,
typeof ResponseContentPartDoneEvent,
typeof ResponseOutputTextDeltaEvent,
typeof ResponseOutputTextDoneEvent,
typeof ResponseOutputTextAnnotationAddedEvent,
typeof ResponseRefusalDeltaEvent,
typeof ResponseRefusalDoneEvent,
typeof ResponseFunctionCallArgumentsDeltaEvent,
typeof ResponseFunctionCallArgumentsDoneEvent,
typeof ResponseFileSearchCallInProgressEvent,
typeof ResponseFileSearchCallSearchingEvent,
typeof ResponseFileSearchCallCompletedEvent,
typeof ResponseWebSearchCallInProgressEvent,
typeof ResponseWebSearchCallSearchingEvent,
typeof ResponseWebSearchCallCompletedEvent,
typeof ResponseReasoningSummaryPartAddedEvent,
typeof ResponseReasoningSummaryPartDoneEvent,
typeof ResponseReasoningSummaryTextDeltaEvent,
typeof ResponseReasoningSummaryTextDoneEvent,
typeof ResponseReasoningTextDeltaEvent,
typeof ResponseReasoningTextDoneEvent,
typeof ResponseImageGenerationCallInProgressEvent,
typeof ResponseImageGenerationCallGeneratingEvent,
typeof ResponseImageGenerationCallPartialImageEvent,
typeof ResponseImageGenerationCallCompletedEvent,
typeof ResponseMcpCallArgumentsDeltaEvent,
typeof ResponseMcpCallArgumentsDoneEvent,
typeof ResponseMcpCallInProgressEvent,
typeof ResponseMcpCallCompletedEvent,
typeof ResponseMcpCallFailedEvent,
typeof ResponseMcpListToolsInProgressEvent,
typeof ResponseMcpListToolsCompletedEvent,
typeof ResponseMcpListToolsFailedEvent,
typeof ResponseCodeInterpreterCallInProgressEvent,
typeof ResponseCodeInterpreterCallInterpretingEvent,
typeof ResponseCodeInterpreterCallCompletedEvent,
typeof ResponseCodeInterpreterCallCodeDeltaEvent,
typeof ResponseCodeInterpreterCallCodeDoneEvent,
typeof ResponseCustomToolCallInputDeltaEvent,
typeof ResponseCustomToolCallInputDoneEvent,
typeof ResponseErrorEvent,
]
>;ResponseWebSearchCallCompletedEvent
Emitted when a web search call is completed.
Signature
declare class ResponseWebSearchCallCompletedEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.web_search_call.completed">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.web_search_call.completed">;
}>,
options?: MakeOptions,
]
);
}ResponseWebSearchCallInProgressEvent
Emitted when a web search call is initiated.
Signature
declare class ResponseWebSearchCallInProgressEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.web_search_call.in_progress">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.web_search_call.in_progress">;
}>,
options?: MakeOptions,
]
);
}ResponseWebSearchCallSearchingEvent
Emitted when a web search call is executing.
Signature
declare class ResponseWebSearchCallSearchingEvent extends ReadonlySide<
{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.web_search_call.searching">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly item_id: String;
readonly output_index: Int;
readonly sequence_number: Int;
readonly type: Literal<"response.web_search_call.searching">;
}>,
options?: MakeOptions,
]
);
}SummaryPart
Signature
declare class SummaryPart extends ReadonlySide<
{
readonly text: String;
readonly type: Literal<"summary_text">;
},
"Type"
> {
constructor(
...args: [
props: ReadonlyMakeIn<{
readonly text: String;
readonly type: Literal<"summary_text">;
}>,
options?: MakeOptions,
]
);
}
Represents the events that can be emitted during a streaming response.