Type reference
@glexir/sdk exports a TypeScript type for every request, response and stream event it handles. This page lists every export, grouped by area, with a one-line description and a link to the page that covers it in depth.
Import types with import type. The Responses API object is named Response, like the global Response, so alias it:
Request parameter types accept unknown keys where OpenAI adds parameters often (ResponseCreateParamsBase, ChatCompletionCreateParamsBase, EmbeddingCreateParams, TranscriptionCreateParamsBase). Unknown keys are sent unchanged. Model and enum types such as ChatModel and ServiceTier list known values and also accept any string.
Client and runtime
| Export | Kind | What it is | Page |
|---|---|---|---|
Glexir | class | The client. Also the default export. | Client configuration |
ClientOptions | type | Options for new Glexir(): apiKey, baseURL, timeout, maxRetries, fetch, defaultHeaders. | Client configuration |
RequestOptions | type | The last argument of every method: signal, timeout, maxRetries, headers, idempotencyKey. | Client configuration |
DEFAULT_BASE_URL | const | "https://api.glexir.com/v1", used when no baseURL or GLEXIR_BASE_URL is set. | Client configuration |
VERSION | const | The SDK version, "0.2.0". Sent as x-glexir-sdk: js/<VERSION>. | Client configuration |
APIPromise<T> | class | What every method returns. Await it, or call withRawResponse() or asResponse(). | Client configuration |
WithRawResponse<T> | type | { data, response, requestId }, from withRawResponse(). | Client configuration |
CursorPage<Item> | class | One page of a list, with hasNextPage(), getNextPage() and iterPages(). | Pagination |
PagePromise<Item> | class | What list methods return: a promise for the first page that you can also iterate with for await. | Pagination |
CursorPageParams | type | { after?, limit? }, the base of every list params type. | Pagination |
Stream<Item> | class | A raw server-sent event stream, from create({ stream: true }). | Streaming |
ServerSentEvent | type | { event, data, raw }, one parsed SSE message. | Streaming |
ResponseStream | class | The helper returned by responses.stream(). | Streaming |
ChatCompletionStream | class | The helper returned by chat.completions.stream(). | Streaming |
toFile() | function | Wraps bytes, a Blob, a stream or a Response in a named File. | Audio |
Uploadable | type | File | Blob | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array> | Response. | Audio |
toBatchJSONL() | function | Builds a batch.jsonl File from request lines. | Batches |
toStrictJsonSchema() | function | Rewrites a JSON Schema for strict structured output. | Responses |
Errors
| Export | What it is | Page |
|---|---|---|
GlexirError | Base class of every SDK error. | Errors & retries |
APIError | Any non-2xx response, or an error event inside a stream. | Errors & retries |
APIErrorBody | The error object of an error body: message, type, code, param and extra fields. | Errors & retries |
BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError | APIError subclasses for 400, 401, 403, 404, 409, 422, 429 and 500+. | Errors & retries |
APIConnectionError, APIConnectionTimeoutError, APIUserAbortError | No HTTP response: network failure, timeout, or your signal. status is undefined. | Errors & retries |
LengthFinishReasonError, ContentFilterFinishReasonError | Thrown by parse() when output was truncated or filtered. | Errors & retries |
StrictSchemaError | Thrown by toStrictJsonSchema(). | Errors & retries |
Shared
| Export | What it is |
|---|---|
Metadata | Record<string, string>. Up to 16 pairs; keys up to 64 characters, values up to 512. |
ChatModel | Text model IDs, for example gpt-5.4-mini. Accepts any string. |
ResponsesModel | ChatModel plus the Responses-only -pro models. |
ReasoningEffort | none, minimal, low, medium, high, xhigh, max, or any string. |
ServiceTier | auto, default, flex, scale, priority, fast, ultrafast, or any string. See Pricing. |
Verbosity | low, medium or high. |
ErrorObject | { code, message, param, type }, the error object in error bodies and stream error fields. |
PromptCacheBreakpoint | { mode: "explicit" }, set on a content part to mark an explicit cache breakpoint. |
PromptCacheOptions | { mode?, ttl? } for Chat Completions. |
ModerationConfig | Inline moderation settings: { model, policy? }. |
ModerationResult, ModerationResults, ModerationError | Moderation output returned when you set moderation. |
FunctionDefinition, FunctionParameters | A function's name, description?, parameters? (JSON Schema) and strict?. Used by Chat Completions tools. |
CustomToolInputFormat, CustomToolInputFormatText, CustomToolInputFormatGrammar | A custom tool's input format on the Responses API: { type: "text" } or { type: "grammar", syntax, definition }. |
ResponseFormatText, ResponseFormatJSONObject, ResponseFormatJSONSchema, JSONSchemaFormat | Chat Completions response_format values. JSONSchemaFormat is the json_schema object: name, schema?, description?, strict?. |
ListResponse<Item> | A cursor list body: { object: "list", data, has_more, first_id?, last_id? }. |
DeletedObject<TObject> | { id, deleted, object }. |
Responses
Covered on Responses and Streaming.
| Export | What it is |
|---|---|
ResponseCreateParams, ResponseCreateParamsBase, ResponseCreateParamsNonStreaming, ResponseCreateParamsStreaming | Parameters for responses.create(). See Create parameters. |
ResponseStreamParams, ResponseStreamResumeParams | Parameters for responses.stream(): create parameters, or { response_id, starting_after? } to resume a background stream. |
ParseOptions<T>, ParsedResponse<T> | RequestOptions plus validate?, and the Response plus output_parsed, for responses.parse(). |
ResponseRetrieveParams | { include?, include_obfuscation?, starting_after? } for responses.retrieve(). The method also takes stream in the same object. |
InputItemListParams | { after?, limit?, order?, include? } for responses.inputItems.list(). |
InputTokenCountParams, InputTokenCountResponse | Body and result of responses.inputTokens.count(). |
ResponseCompactParams, CompactedResponse | Body and result of responses.compact(). |
Response | The response object. output_text is added by the SDK. |
ResponseStatus | queued, in_progress, completed, incomplete, failed or cancelled. |
ResponseUsage | Token usage: input_tokens, input_tokens_details, output_tokens, output_tokens_details, total_tokens. |
ResponseError | { code, message } on a failed response. |
ResponseInput | string | ResponseInputItem[]. |
ResponseInputItem | Any item you can send as input. |
ResponseOutputItem | Any item in response.output. |
ResponseItem | A stored item, from inputItems.list() and conversation item endpoints. |
EasyInputMessage | { role, content, phase? }, the simplest message form. |
ResponseInputMessage | A typed input message with user, system or developer role and content parts. |
ResponseOutputMessage | An assistant message: id, status, content, phase?. |
MessagePhase | commentary or final_answer. Keep it on assistant messages you replay. |
ResponseInputContent | ResponseInputText | ResponseInputImage | ResponseInputFile. |
ResponseInputText | { type: "input_text", text }. |
ResponseInputImage | { type: "input_image", detail, image_url?, file_id? }. |
ResponseInputFile | { type: "input_file", file_url?, file_data?, file_id?, filename?, detail? }. |
ResponseOutputText | { type: "output_text", text, annotations, logprobs? }. |
ResponseOutputRefusal | { type: "refusal", refusal }. |
Annotation | FileCitation | URLCitation | ContainerFileCitation | FilePath, attached to output text. |
FileCitation, URLCitation, ContainerFileCitation, FilePath | The annotation shapes. Citations from hosted tools do not occur on Glexir, because hosted tools are not available. |
Logprob | { token, bytes, logprob, top_logprobs } for output text. |
ResponseReasoningItem | A reasoning item, with encrypted_content when requested. Replay it unchanged. |
ResponseFunctionToolCall, ResponseFunctionCallOutput | A function call from the model and the output you send back. |
ResponseCustomToolCall, ResponseCustomToolCallOutput | A custom tool call and its output. |
ToolCaller | Who made a tool call: { type: "direct" } or { type: "program", caller_id }. |
ResponseCompactionItem | An opaque compaction item from compact() or automatic compaction. |
ResponseCompactionTrigger | { type: "compaction_trigger" }. Asks the model to compact now; must be the last input item. |
ResponseItemReference | { type?: "item_reference", id }, a reference to a stored item. |
ResponseConfigurationUpdate | Changes reasoning effort for later turns. |
Tool, FunctionTool, CustomTool, NamespaceTool | The tool types Glexir accepts. See Tools. |
ToolChoice | none, auto, required, a named function or custom tool, or allowed_tools. |
ResponseTextConfig | { format?, verbosity? }. |
ResponseFormatTextConfig, ResponseFormatTextJSONSchemaConfig | text.format values: text, json_object, or { type: "json_schema", name, schema, description?, strict? }. |
Reasoning | { effort?, summary?, context?, mode? }. |
ResponseIncludable | Values for include, such as reasoning.encrypted_content. |
ResponsePromptCacheOptions | { mode?, ttl?, prewarm?, comparison_response_id? }. |
ContextManagement | { type: "compaction", compact_threshold? }. |
ResponseStreamEvent and the 28 event types | Every Responses stream event, from ResponseQueuedEvent to ResponseKeepaliveEvent. Listed in Event types. |
Conversations
Covered on Conversations.
| Export | What it is |
|---|---|
Conversation | { id, object: "conversation", created_at, metadata }. |
ConversationCreateParams | { items?, metadata? }. |
ConversationUpdateParams | { metadata }. |
ConversationDeleted | { id, deleted, object: "conversation.deleted" }. |
ConversationItem | Same as ResponseItem. |
ConversationItemList | { object: "list", data, first_id, last_id, has_more }, from items.create(). |
ItemCreateParams | { items, include? }. |
ItemListParams | { after?, limit?, order?, include? }. |
ItemRetrieveParams | { include? }. |
Chat Completions
Covered on Chat Completions.
| Export | What it is |
|---|---|
ChatCompletionCreateParams, ChatCompletionCreateParamsBase, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming | Parameters for chat.completions.create(). |
ParsedChatCompletion<T>, ParsedChatCompletionMessage<T>, ParsedFunctionToolCall | Results of chat.completions.parse(). |
ChatCompletion | The completion object. |
ChatCompletionChoice | { index, finish_reason, logprobs, message }. |
ChatCompletionMessage | The assistant reply: role, content, refusal, tool_calls?, annotations?. |
ChatCompletionFinishReason | stop, length, tool_calls, content_filter or function_call. |
ChatCompletionTokenLogprob | { token, bytes, logprob, top_logprobs }. |
CompletionUsage | prompt_tokens, completion_tokens, total_tokens and their details. |
ChatCompletionChunk | One streamed chunk. |
ChatCompletionChunkToolCallDelta | A tool-call fragment in a chunk, merged by index. |
ChatCompletionMessageParam | Any input message. |
ChatCompletionDeveloperMessageParam, ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam, ChatCompletionToolMessageParam | Input messages by role. See Messages. |
ChatCompletionContentPart | A user content part: text, image or file. |
ChatCompletionContentPartText | { type: "text", text }. |
ChatCompletionContentPartImage | { type: "image_url", image_url: { url, detail? } }. |
ChatCompletionContentPartFile | { type: "file", file: { file_data?, file_id?, filename? } }. |
ChatCompletionContentPartRefusal | { type: "refusal", refusal }, in assistant message content. |
ChatCompletionMessageToolCall | ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall. |
ChatCompletionMessageFunctionToolCall | { id, type: "function", function: { name, arguments } }. |
ChatCompletionMessageCustomToolCall | { id, type: "custom", custom: { name, input } }. |
ChatCompletionTool, ChatCompletionFunctionTool, ChatCompletionCustomTool | Tools for Chat Completions. See Tools. |
ChatCustomToolFormat | A custom tool's format on Chat Completions: { type: "text" } or { type: "grammar", grammar: { definition, syntax } }. |
ChatCompletionToolChoiceOption | none, auto, required, a named function or custom tool, or allowed_tools. |
ChatCompletionUpdateParams | { metadata }. |
ChatCompletionListParams | { after?, limit?, metadata?, model?, order? }. |
ChatCompletionDeleted | { id, deleted, object: "chat.completion.deleted" }. |
ChatCompletionStoreMessage | A stored message: a ChatCompletionMessage with id and content_parts?. |
MessageListParams | { after?, limit?, order? }. |
Audio
Covered on Audio.
| Export | What it is |
|---|---|
TranscriptionModel | Speech-to-text model IDs. Accepts any string. |
AudioResponseFormat | json, text, srt, verbose_json, vtt or diarized_json. |
TranscriptionCreateParamsBase | Parameters for audio.transcriptions.create(). |
VadConfig | { type: "server_vad", prefix_padding_ms?, silence_duration_ms?, threshold? }. |
Transcription, TranscriptionVerbose, TranscriptionDiarized | Results for json, verbose_json and diarized_json. |
TranscriptionSegment, TranscriptionWord, TranscriptionDiarizedSegment | Segments and words inside those results. |
TranscriptionLogprob | { token?, bytes?, logprob? }. |
TranscriptionUsage, TranscriptionDurationUsage, TranscriptionTokenUsage | { type: "duration", seconds } or { type: "tokens", ... }. |
TranscriptionStreamEvent, TranscriptionTextDeltaEvent, TranscriptionTextDoneEvent, TranscriptionTextSegmentEvent | Events from create({ stream: true }). |
TranslationCreateParams, Translation, TranslationVerbose | Parameters and results of the deprecated audio.translations.create(). |
Embeddings, files, batches and models
| Export | What it is | Page |
|---|---|---|
EmbeddingModel | Embedding model IDs. Accepts any string. | Embeddings |
EmbeddingCreateParams | { model, input, dimensions?, encoding_format?, user? }. | Embeddings |
Embedding<TVector> | { object: "embedding", index, embedding }. | Embeddings |
CreateEmbeddingResponse<TVector> | { object: "list", data, model, usage }. | Embeddings |
FilePurpose | user_data or batch on Glexir. The type also lists OpenAI purposes the gateway rejects. | Files |
FileObject | A file: id, bytes, created_at, filename, purpose, expires_at?. | Files |
FileCreateParams | { file, purpose, expires_after? }. | Files |
FileListParams | { after?, limit?, order?, purpose? }. | Files |
FileDeleted | { id, deleted, object: "file" }. | Files |
BatchEndpoint | /v1/responses, /v1/chat/completions or /v1/embeddings. | Batches |
BatchCreateParams | { input_file_id, endpoint, completion_window, metadata?, output_expires_after? }. | Batches |
BatchStatus | validating, failed, in_progress, finalizing, completed, expired, cancelling or cancelled. | Batches |
Batch | A batch job. | Batches |
BatchListParams | { after?, limit? }. | Batches |
BatchRequestLine<TBody> | One line of a batch input file: { custom_id, method, url, body }. | Batches |
Model | { id, object: "model", created, owned_by, shutdown_date? }. | Models |