Functions

create-assistant

fn (request: CreateAssistantRequest): CreateAssistantResponse
fn (request: CreateAssistantRequest, opts: Map): CreateAssistantResponse

POST /assistants - Create an assistant with instructions and tools.

Example

response ::openai::create/create-assistant(::openai::create/CreateAssistantRequest({
    model: "gpt-4o-mini",
    name: "Math Tutor",
    instructions: "You are a helpful math tutor."
}))

response.id   // => "asst_abc123"
response.name // => "Math Tutor"

create-batch

fn (request: CreateBatchRequest): CreateBatchResponse
fn (request: CreateBatchRequest, opts: Map): CreateBatchResponse

POST /batches - Create a batch of API requests for asynchronous processing.

Batches support chat completions, embeddings, and completions endpoints with a 24-hour completion window.

Example

response ::openai::create/create-batch(::openai::create/CreateBatchRequest({
    input_file_id: "file-abc123",
    endpoint: "/v1/chat/completions",
    completion_window: "24h"
}))

response.id     // => "batch_abc123"
response.status // => "validating"

create-chat-completion

fn (request: CreateChatCompletionRequest): CreateChatCompletionResponse
fn (request: CreateChatCompletionRequest, opts: Map): CreateChatCompletionResponse

POST /chat/completions - Create a chat completion.

For a more ergonomic API, see ::openai::chat/complete which provides typed request/response wrappers.

Example

response ::openai::create/create-chat-completion(::openai::create/CreateChatCompletionRequest({
    model: "gpt-4o-mini",
    messages: [{role: "user", content: "What is 1+1?"}],
    max_completion_tokens: 50
}))

response.choices[0].message.content // => "2"

create-checkpoint-permissions

fn (fine-tuned-model-checkpoint: Str, request: CreateFineTuningCheckpointPermissionRequest): CreateFineTuningCheckpointPermissionResponse
fn (fine-tuned-model-checkpoint: Str, request: CreateFineTuningCheckpointPermissionRequest, opts: Map): CreateFineTuningCheckpointPermissionResponse

POST /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions

  • Create checkpoint permissions

Example

permissions ::openai::create/create-checkpoint-permissions("ft:gpt-4o-mini-2024-07-18:acme::abc123:ckpt-step-100", ::openai::create/CreateFineTuningCheckpointPermissionRequest({
  project_ids: ["proj_abc123"]
}))
map(permissions.data, %.id)

create-completion

fn (request: CreateCompletionRequest): CreateCompletionResponse
fn (request: CreateCompletionRequest, opts: Map): CreateCompletionResponse

POST /completions - Create a text completion (legacy endpoint).

For chat-based completions, prefer create-chat-completion or ::openai::chat/complete.

Example

completion ::openai::create/create-completion(::openai::create/CreateCompletionRequest({
  model: "gpt-3.5-turbo-instruct",
  prompt: "Say hello",
  max_tokens: 16
}))
completion.choices[0].text

create-embeddings

fn (request: CreateEmbeddingRequest): CreateEmbeddingResponse
fn (request: CreateEmbeddingRequest, opts: Map): CreateEmbeddingResponse

POST /embeddings - Create vector embeddings for text input.

For a more ergonomic API, see ::openai::embeddings/create which provides typed request/response wrappers.

Example

response ::openai::create/create-embeddings(::openai::create/CreateEmbeddingRequest({
    input: "The quick brown fox",
    model: "text-embedding-3-small"
}))

response.data[0].embedding // => Vec<Dec> of embedding dimensions

create-eval

fn (request: CreateEvalRequest): CreateEvalResponse
fn (request: CreateEvalRequest, opts: Map): CreateEvalResponse

POST /evals - Create an evaluation to test model outputs against criteria.

Example

evaluation ::openai::create/create-eval(::openai::create/CreateEvalRequest({
  name: "Greeting check",
  data_source_config: {
    type: "custom",
    item_schema: {type: "object", properties: {ideal: {type: "string"}}},
    include_sample_schema: true
  },
  testing_criteria: [{
    type: "string_check",
    name: "Matches ideal",
    input: "{{sample.output_text}}",
    operation: "eq",
    reference: "{{item.ideal}}"
  }]
}))
evaluation.id

create-eval-run

fn (eval-id: Str, request: CreateEvalRunRequest): CreateEvalRunResponse
fn (eval-id: Str, request: CreateEvalRunRequest, opts: Map): CreateEvalRunResponse

POST /evals/{eval_id}/runs - Run an evaluation against a data source.

Example

eval-run ::openai::create/create-eval-run("eval_abc123", ::openai::create/CreateEvalRunRequest({
  name: "Nightly",
  data_source: {
    type: "completions",
    model: "gpt-4o-mini",
    source: {type: "file_id", id: "file-abc123"},
    input_messages: {type: "template", template: [{role: "user", content: "{{item.question}}"}]}
  }
}))
eval-run.status

create-finetuning-job

fn (request: CreateFineTuningJobRequest): CreateFineTuningJobResponse
fn (request: CreateFineTuningJobRequest, opts: Map): CreateFineTuningJobResponse

POST /fine_tuning/jobs - Create a fine-tuning job to customize a model with your training data.

Example

response ::openai::create/create-finetuning-job(::openai::create/CreateFineTuningJobRequest({
    model: "gpt-4o-mini-2024-07-18",
    training_file: "file-abc123"
}))

response.id     // => "ftjob-abc123"
response.status // => "validating_files"

create-image

fn (request: CreateImageRequest): CreateImageResponse
fn (request: CreateImageRequest, opts: Map): CreateImageResponse

POST /images/generations - Generate an image from a text prompt.

For a more ergonomic API, see ::openai::images/generate which provides typed request/response wrappers and auto-defaults to DALL-E 3.

Example

response ::openai::create/create-image(::openai::create/CreateImageRequest({
    prompt: "A simple red circle on a white background",
    model: "dall-e-2",
    size: "256x256",
    n: 1
}))

response.data[0].url // => "https://oaidalleapi..."

create-image-edit

fn (request: CreateImageEditRequest): CreateImageEditResponse
fn (request: CreateImageEditRequest, opts: Map): CreateImageEditResponse

POST /images/edits - Edit an image with a text prompt (inpainting).

For a more ergonomic API, see ::openai::images/edit.

Example

edited ::openai::create/create-image-edit(::openai::create/CreateImageEditRequest({
  image: "path/to/image.png",
  prompt: "Add a red hat to the person",
  model: "gpt-image-1"
}))
edited.data[0].b64_json

create-image-variation

fn (request: CreateImageVariationRequest): CreateImageVariationResponse
fn (request: CreateImageVariationRequest, opts: Map): CreateImageVariationResponse

POST /images/variations - Create variations of an existing image.

For a more ergonomic API, see ::openai::images/variation.

Example

variations ::openai::create/create-image-variation(::openai::create/CreateImageVariationRequest({
  image: "path/to/image.png",
  n: 2,
  size: "512x512"
}))
map(variations.data, %.url)

create-message

fn (thread-id: Str, request: CreateMessageRequest): CreateMessageResponse
fn (thread-id: Str, request: CreateMessageRequest, opts: Map): CreateMessageResponse

POST /threads/{thread_id}/messages - Create a message in a thread.

Example

message ::openai::create/create-message("thread_abc123", ::openai::create/CreateMessageRequest({
  role: "user",
  content: "What is 17 + 25?"
}))
message.id

create-model-response

fn (request: CreateResponseRequest): CreateResponseResponse
fn (request: CreateResponseRequest, opts: Map): CreateResponseResponse

POST /responses - Create a model response using the Responses API.

Example

response ::openai::create/create-model-response(::openai::create/CreateResponseRequest({
  model: "gpt-4o-mini",
  input: "Write a one-sentence bedtime story."
}))
response.status
response.output

create-moderation

fn (request: CreateModerationRequest): CreateModerationResponse
fn (request: CreateModerationRequest, opts: Map): CreateModerationResponse

POST /moderations - Check content for potentially harmful material.

For a more ergonomic API, see ::openai::moderations/create which provides typed request/response wrappers.

Example

response ::openai::create/create-moderation(::openai::create/CreateModerationRequest({
    input: "I love programming!"
}))

response.results[0].flagged // => false

create-run

fn (thread-id: Str, include: Str, request: CreateRunRequest): CreateRunResponse
fn (thread-id: Str, include: Str, request: CreateRunRequest, opts: Map): CreateRunResponse

POST /threads/{thread_id}/runs - Create a run to execute an assistant on a thread.

Example

// The second argument is the run's include[] query value. Pass "" for none.
run ::openai::create/create-run(
  "thread_abc123",
  "step_details.tool_calls[*].file_search.results[*].content",
  ::openai::create/CreateRunRequest({assistant_id: "asst_abc123", instructions: "Answer briefly."})
)
run.status

create-speech

fn (request: CreateSpeechRequest): CreateSpeechResponse
fn (request: CreateSpeechRequest, opts: Map): CreateSpeechResponse

POST /audio/speech - Generate audio from text (TTS).

For a more ergonomic API, see ::openai::audio/speech which provides typed request/response wrappers.

Example

response ::openai::create/create-speech(::openai::create/CreateSpeechRequest({
    model: "tts-1",
    input: "Hello, world!",
    voice: "alloy"
}))

create-thread

fn (request: CreateThreadRequest): CreateThreadResponse
fn (request: CreateThreadRequest, opts: Map): CreateThreadResponse

POST /threads - Create a new thread for the Assistants API.

Example

thread ::openai::create/create-thread(::openai::create/CreateThreadRequest({
  messages: [{role: "user", content: "How do I reset my password?"}],
  metadata: {user: "u_123"}
}))
thread.id

create-thread-and-run

fn (request: CreateThreadAndRunRequest): CreateThreadAndRunResponse
fn (request: CreateThreadAndRunRequest, opts: Map): CreateThreadAndRunResponse

POST /threads/runs - Create a thread and immediately run an assistant on it.

Example

run ::openai::create/create-thread-and-run(::openai::create/CreateThreadAndRunRequest({
  assistant_id: "asst_abc123",
  thread: {messages: [{role: "user", content: "Summarize this ticket."}]}
}))
run.thread_id
run.status

create-transcription

fn (request: CreateTranscriptionRequest): CreateTranscriptionResponse
fn (request: CreateTranscriptionRequest, opts: Map): CreateTranscriptionResponse

POST /audio/transcriptions - Transcribe audio to text using OpenAI.

Example

response ::openai::create/create-transcription(::openai::create/CreateTranscriptionRequest({
    file: "audio.mp3",
    model: "whisper-1"
}))

create-translation

fn (request: CreateTranslationRequest): CreateTranslationResponse
fn (request: CreateTranslationRequest, opts: Map): CreateTranslationResponse

POST /audio/translations - Translate audio to English text using Whisper.

Example

response ::openai::create/create-translation(::openai::create/CreateTranslationRequest({
    file: "french-audio.mp3",
    model: "whisper-1"
}))

create-upload

fn (request: CreateUploadRequest): CreateUploadResponse
fn (request: CreateUploadRequest, opts: Map): CreateUploadResponse

POST /uploads - Create a multi-part upload for large files.

Example

upload ::openai::create/create-upload(::openai::create/CreateUploadRequest({
  filename: "training.jsonl",
  purpose: "fine-tune",
  bytes: 2147483648,
  mime_type: "text/jsonl"
}))
upload.id

create-vector-store

fn (request: CreateVectorStoreRequest): CreateVectorStoreResponse
fn (request: CreateVectorStoreRequest, opts: Map): CreateVectorStoreResponse

POST /vector_stores - Create a vector store for file search.

Example

tenant {api-key: ::hot::ctx/get("tenant.openai.key")}
store ::openai::create/create-vector-store(::openai::create/CreateVectorStoreRequest({
  name: "Support docs",
  file_ids: ["file-abc123"],
  expires_after: {anchor: "last_active_at", days: 7}
}), tenant)
store.id
store.status

create-vector-store-file

fn (vector-store-id: Str, request: CreateVectorStoreFileRequest): CreateVectorStoreFileResponse
fn (vector-store-id: Str, request: CreateVectorStoreFileRequest, opts: Map): CreateVectorStoreFileResponse

POST /vector_stores/{vector_store_id}/files - Add a file to a vector store.

Example

store-file ::openai::create/create-vector-store-file("vs_abc123", ::openai::create/CreateVectorStoreFileRequest({
  file_id: "file-abc123"
}))
store-file.status

create-vector-store-file-batch

fn (vector-store-id: Str, request: CreateVectorStoreFileBatchRequest): CreateVectorStoreFileBatchResponse
fn (vector-store-id: Str, request: CreateVectorStoreFileBatchRequest, opts: Map): CreateVectorStoreFileBatchResponse

POST /vector_stores/{vector_store_id}/file_batches - Add a batch of files to a vector store.

Example

file-batch ::openai::create/create-vector-store-file-batch("vs_abc123", ::openai::create/CreateVectorStoreFileBatchRequest({
  file_ids: ["file-abc123", "file-def456"]
}))
file-batch.status
file-batch.file_counts

upload-file

fn (request: CreateFileRequest): CreateFileResponse
fn (request: CreateFileRequest, opts: Map): CreateFileResponse

POST /files - Upload a file for use with assistants, fine-tuning, or batch API.

Example

response ::openai::create/upload-file(::openai::create/CreateFileRequest({
    file: "training-data.jsonl",
    purpose: "fine-tune"
}))

response.id       // => "file-abc123"
response.filename  // => "training-data.jsonl"
response.status    // => "uploaded"

Types

AssistantObject

AssistantObject type {
    id: Str,
    object: "assistant",
    created_at: Int,
    name: Str?,
    description: Str?,
    model: Str,
    instructions: Str?,
    tools: Vec<AssistantTool>,
    tool_resources: Map?,
    metadata: Metadata?,
    temperature: Dec?,
    top_p: Dec?,
    response_format: AssistantsApiResponseFormatOption?
}

AssistantTool

AssistantTool type Map

AssistantsApiResponseFormatOption

AssistantsApiResponseFormatOption type Any

AudioResponseFormat

AudioResponseFormat type Str

Batch

Batch type {
    id: Str,
    object: "batch",
    endpoint: Str,
    errors: Map?,
    input_file_id: Str,
    completion_window: Str,
    status: BatchStatus,
    output_file_id: Str?,
    error_file_id: Str?,
    created_at: Int,
    in_progress_at: Int?,
    expires_at: Int?,
    finalizing_at: Int?,
    completed_at: Int?,
    failed_at: Int?,
    expired_at: Int?,
    cancelling_at: Int?,
    cancelled_at: Int?,
    request_counts: BatchRequestCounts?,
    metadata: Metadata?
}

BatchRequestCounts

BatchRequestCounts type {
    total: Int,
    completed: Int,
    failed: Int
}

BatchStatus

BatchStatus type "validating" | "failed" | "in_progress" | "finalizing" | "completed" | "expired" | "cancelling" | "cancelled"

ChatCompletionStreamOptions

ChatCompletionStreamOptions type {
    include_usage: Bool?,
    include_obfuscation: Bool?
}

ChunkingStrategyRequestParam

ChunkingStrategyRequestParam type Map

ChunkingStrategyResponse

ChunkingStrategyResponse type Map

CompletionUsage

CompletionUsage type {
    completion_tokens: Int,
    prompt_tokens: Int,
    total_tokens: Int,
    completion_tokens_details: Map?,
    prompt_tokens_details: Map?
}

CreateAssistantRequest

CreateAssistantRequest type {
    model: Any,
    name: Str?,
    description: Str?,
    instructions: Str?,
    reasoning_effort: ReasoningEffort?,
    tools: Vec<AssistantTool>?,
    tool_resources: Map?,
    metadata: Metadata?,
    temperature: Dec?,
    top_p: Dec?,
    response_format: AssistantsApiResponseFormatOption?
}

CreateAssistantRequest

CreateAssistantRequest type {
    model: Any,
    name: Str?,
    description: Str?,
    instructions: Str?,
    reasoning_effort: ReasoningEffort?,
    tools: Vec<AssistantTool>?,
    tool_resources: Map?,
    metadata: Metadata?,
    temperature: Dec?,
    top_p: Dec?,
    response_format: AssistantsApiResponseFormatOption?
}

CreateAssistantResponse

CreateAssistantResponse type {
    id: Str,
    object: "assistant",
    created_at: Int,
    name: Str?,
    description: Str?,
    model: Str,
    instructions: Str?,
    tools: Vec<AssistantTool>,
    tool_resources: Map?,
    metadata: Metadata?,
    temperature: Dec?,
    top_p: Dec?,
    response_format: AssistantsApiResponseFormatOption?
}

CreateBatchRequest

CreateBatchRequest type {
    input_file_id: Str,
    endpoint: "/v1/responses" | "/v1/chat/completions" | "/v1/embeddings" | "/v1/completions",
    completion_window: "24h",
    metadata: Metadata?
}

CreateBatchResponse

CreateBatchResponse type {
    id: Str,
    object: "batch",
    endpoint: Str,
    errors: Map?,
    input_file_id: Str,
    completion_window: Str,
    status: BatchStatus,
    output_file_id: Str?,
    error_file_id: Str?,
    created_at: Int,
    in_progress_at: Int?,
    expires_at: Int?,
    finalizing_at: Int?,
    completed_at: Int?,
    failed_at: Int?,
    expired_at: Int?,
    cancelling_at: Int?,
    cancelled_at: Int?,
    request_counts: BatchRequestCounts?,
    metadata: Metadata?
}

CreateChatCompletionRequest

CreateChatCompletionRequest type Map

CreateChatCompletionRequest

CreateChatCompletionRequest type Map

CreateChatCompletionResponse

CreateChatCompletionResponse type {
    id: Str,
    choices: Vec<Map>,
    created: Int,
    model: Str,
    service_tier: ServiceTier?,
    system_fingerprint: Str?,
    object: "chat.completion",
    usage: CompletionUsage?
}

CreateChatCompletionResponse

CreateChatCompletionResponse type {
    id: Str,
    choices: Vec<Map>,
    created: Int,
    model: Str,
    service_tier: ServiceTier?,
    system_fingerprint: Str?,
    object: "chat.completion",
    usage: CompletionUsage?
}

CreateCompletionRequest

CreateCompletionRequest type {
    model: Any,
    prompt: Any,
    best_of: Int?,
    echo: Bool?,
    frequency_penalty: Dec?,
    logit_bias: Map?,
    logprobs: Int?,
    max_tokens: Int?,
    n: Int?,
    presence_penalty: Dec?,
    seed: Int?,
    stop: StopConfiguration?,
    stream: Bool?,
    stream_options: ChatCompletionStreamOptions?,
    suffix: Str?,
    temperature: Dec?,
    top_p: Dec?,
    user: Str?
}

CreateCompletionRequest

CreateCompletionRequest type {
    model: Any,
    prompt: Any,
    best_of: Int?,
    echo: Bool?,
    frequency_penalty: Dec?,
    logit_bias: Map?,
    logprobs: Int?,
    max_tokens: Int?,
    n: Int?,
    presence_penalty: Dec?,
    seed: Int?,
    stop: StopConfiguration?,
    stream: Bool?,
    stream_options: ChatCompletionStreamOptions?,
    suffix: Str?,
    temperature: Dec?,
    top_p: Dec?,
    user: Str?
}

CreateCompletionResponse

CreateCompletionResponse type {
    id: Str,
    choices: Vec<Map>,
    created: Int,
    model: Str,
    system_fingerprint: Str?,
    object: "text_completion",
    usage: CompletionUsage?
}

CreateCompletionResponse

CreateCompletionResponse type {
    id: Str,
    choices: Vec<Map>,
    created: Int,
    model: Str,
    system_fingerprint: Str?,
    object: "text_completion",
    usage: CompletionUsage?
}

CreateEmbeddingRequest

CreateEmbeddingRequest type {
    input: Any,
    model: Any,
    encoding_format: "float" | "base64"?,
    dimensions: Int?,
    user: Str?
}

CreateEmbeddingRequest

CreateEmbeddingRequest type {
    input: Any,
    model: Any,
    encoding_format: "float" | "base64"?,
    dimensions: Int?,
    user: Str?
}

CreateEmbeddingResponse

CreateEmbeddingResponse type {
    data: Vec<Embedding>,
    model: Str,
    object: "list",
    usage: Map
}

CreateEmbeddingResponse

CreateEmbeddingResponse type {
    data: Vec<Embedding>,
    model: Str,
    object: "list",
    usage: Map?
}

CreateEvalRequest

CreateEvalRequest type {
    name: Str?,
    metadata: Metadata?,
    data_source_config: Map,
    testing_criteria: Vec
}

CreateEvalRequest

CreateEvalRequest type {
    name: Str?,
    metadata: Metadata?,
    data_source_config: Map,
    testing_criteria: Vec
}

CreateEvalResponse

CreateEvalResponse type {
    object: "eval",
    id: Str,
    name: Str?,
    data_source_config: Map,
    testing_criteria: Vec,
    created_at: Int,
    metadata: Metadata?
}

CreateEvalRunRequest

CreateEvalRunRequest type {
    name: Str?,
    metadata: Metadata?,
    data_source: Map
}

CreateEvalRunRequest

CreateEvalRunRequest type {
    name: Str?,
    metadata: Metadata?,
    data_source: Map
}

CreateEvalRunResponse

CreateEvalRunResponse type {
    object: "eval.run",
    id: Str,
    eval_id: Str,
    status: Str,
    model: Str,
    name: Str?,
    created_at: Int,
    report_url: Str?,
    result_counts: Map,
    per_model_usage: Vec<Map>,
    per_testing_criteria_results: Vec<Map>,
    data_source: Map,
    metadata: Metadata?,
    error: EvalApiError?
}

CreateFileRequest

CreateFileRequest type {
    file: Str,
    purpose: FilePurpose
}

CreateFileRequest

CreateFileRequest type {
    file: Str,
    purpose: FilePurpose
}

CreateFileResponse

CreateFileResponse type {
    id: Str,
    bytes: Int,
    created_at: Int,
    expires_at: Int?,
    filename: Str,
    object: "file",
    purpose: OpenAIFilePurpose,
    status: OpenAIFileStatus,
    status_details: Str?
}

CreateFineTuningCheckpointPermissionRequest

CreateFineTuningCheckpointPermissionRequest type {
    project_ids: Vec<Str>
}

CreateFineTuningCheckpointPermissionRequest

CreateFineTuningCheckpointPermissionRequest type {
    project_ids: Vec<Str>
}

CreateFineTuningCheckpointPermissionResponse

CreateFineTuningCheckpointPermissionResponse type {
    data: Vec<FineTuningCheckpointPermission>,
    object: "list",
    first_id: Str?,
    last_id: Str?,
    has_more: Bool
}

CreateFineTuningJobRequest

CreateFineTuningJobRequest type {
    model: Any,
    training_file: Str,
    hyperparameters: Map?,
    suffix: Str?,
    validation_file: Str?,
    integrations: Vec<Map>?,
    seed: Int?,
    method: FineTuneMethod?,
    metadata: Metadata?
}

CreateFineTuningJobRequest

CreateFineTuningJobRequest type {
    model: Any,
    training_file: Str,
    hyperparameters: Map?,
    suffix: Str?,
    validation_file: Str?,
    integrations: Vec<Map>?,
    seed: Int?,
    method: FineTuneMethod?,
    metadata: Metadata?
}

CreateFineTuningJobResponse

CreateFineTuningJobResponse type {
    id: Str,
    created_at: Int,
    error: Map?,
    fine_tuned_model: Str?,
    finished_at: Int?,
    hyperparameters: Map,
    model: Str,
    object: "fine_tuning.job",
    organization_id: Str,
    result_files: Vec<Str>,
    status: FineTuningJobStatus,
    trained_tokens: Int?,
    training_file: Str,
    validation_file: Str?,
    integrations: Vec?,
    seed: Int,
    estimated_finish: Int?,
    method: FineTuneMethod?,
    metadata: Metadata?
}

CreateImageEditRequest

CreateImageEditRequest type {
    image: Any,
    prompt: Str,
    mask: Str?,
    background: "transparent" | "opaque" | "auto"?,
    model: Any?,
    n: Int?,
    size: "256x256" | "512x512" | "1024x1024" | "1536x1024" | "1024x1536" | "auto"?,
    response_format: "url" | "b64_json"?,
    output_format: "png" | "jpeg" | "webp"?,
    output_compression: Int?,
    user: Str?,
    input_fidelity: ImageInputFidelity?,
    stream: Bool?,
    partial_images: PartialImages?,
    quality: "standard" | "low" | "medium" | "high" | "auto"?
}

CreateImageEditRequest

CreateImageEditRequest type {
    image: Any,
    prompt: Str,
    mask: Str?,
    background: "transparent" | "opaque" | "auto"?,
    model: Any?,
    n: Int?,
    size: "256x256" | "512x512" | "1024x1024" | "1536x1024" | "1024x1536" | "auto"?,
    response_format: "url" | "b64_json"?,
    output_format: "png" | "jpeg" | "webp"?,
    output_compression: Int?,
    user: Str?,
    input_fidelity: ImageInputFidelity?,
    stream: Bool?,
    partial_images: PartialImages?,
    quality: "standard" | "low" | "medium" | "high" | "auto"?
}

CreateImageEditResponse

CreateImageEditResponse type {
    created: Int,
    data: Vec<Image>?,
    background: ImagesResponseBackground?,
    output_format: ImagesResponseOutputFormat?,
    size: ImagesResponseSize?,
    quality: ImagesResponseQuality?,
    usage: ImageGenUsage?
}

CreateImageRequest

CreateImageRequest type {
    prompt: Str,
    model: Any?,
    n: Int?,
    quality: "standard" | "hd" | "low" | "medium" | "high" | "auto"?,
    response_format: "url" | "b64_json"?,
    output_format: "png" | "jpeg" | "webp"?,
    output_compression: Int?,
    stream: Bool?,
    partial_images: PartialImages?,
    size: "auto" | "1024x1024" | "1536x1024" | "1024x1536" | "256x256" | "512x512" | "1792x1024" | "1024x1792"?,
    moderation: "low" | "auto"?,
    background: "transparent" | "opaque" | "auto"?,
    style: "vivid" | "natural"?,
    user: Str?
}

CreateImageRequest

CreateImageRequest type {
    prompt: Str,
    model: Any?,
    n: Int?,
    quality: "standard" | "hd" | "low" | "medium" | "high" | "auto"?,
    response_format: "url" | "b64_json"?,
    output_format: "png" | "jpeg" | "webp"?,
    output_compression: Int?,
    stream: Bool?,
    partial_images: PartialImages?,
    size: "auto" | "1024x1024" | "1536x1024" | "1024x1536" | "256x256" | "512x512" | "1792x1024" | "1024x1792"?,
    moderation: "low" | "auto"?,
    background: "transparent" | "opaque" | "auto"?,
    style: "vivid" | "natural"?,
    user: Str?
}

CreateImageResponse

CreateImageResponse type {
    created: Int,
    data: Vec<Image>?,
    background: ImagesResponseBackground?,
    output_format: ImagesResponseOutputFormat?,
    size: ImagesResponseSize?,
    quality: ImagesResponseQuality?,
    usage: ImageGenUsage?
}

CreateImageVariationRequest

CreateImageVariationRequest type {
    image: Str,
    model: Any?,
    n: Int?,
    response_format: "url" | "b64_json"?,
    size: "256x256" | "512x512" | "1024x1024"?,
    user: Str?
}

CreateImageVariationRequest

CreateImageVariationRequest type {
    image: Str,
    model: Any?,
    n: Int?,
    response_format: "url" | "b64_json"?,
    size: "256x256" | "512x512" | "1024x1024"?,
    user: Str?
}

CreateImageVariationResponse

CreateImageVariationResponse type {
    created: Int,
    data: Vec<Image>?,
    background: ImagesResponseBackground?,
    output_format: ImagesResponseOutputFormat?,
    size: ImagesResponseSize?,
    quality: ImagesResponseQuality?,
    usage: ImageGenUsage?
}

CreateMessageRequest

CreateMessageRequest type {
    role: "user" | "assistant",
    content: Any,
    attachments: Vec<Map>?,
    metadata: Metadata?
}

CreateMessageRequest

CreateMessageRequest type {
    role: "user" | "assistant",
    content: Any,
    attachments: Vec<Map>?,
    metadata: Metadata?
}

CreateMessageResponse

CreateMessageResponse type {
    id: Str,
    object: "thread.message",
    created_at: Int,
    thread_id: Str,
    status: MessageStatus,
    incomplete_details: Map?,
    completed_at: Int?,
    incomplete_at: Int?,
    role: MessageRole,
    content: Vec<MessageContent>,
    assistant_id: Str?,
    run_id: Str?,
    attachments: Vec<Map>?,
    metadata: Metadata?
}

CreateModerationRequest

CreateModerationRequest type {
    input: Any,
    model: Any?
}

CreateModerationRequest

CreateModerationRequest type {
    input: Any,
    model: Any?
}

CreateModerationResponse

CreateModerationResponse type {
    id: Str,
    model: Str,
    results: Vec<Map>
}

CreateModerationResponse

CreateModerationResponse type {
    id: Str,
    model: Str,
    results: Vec<Map>
}

CreateResponse

CreateResponse type Map

CreateResponseRequest

CreateResponseRequest type Map

CreateResponseResponse

CreateResponseResponse type Map

CreateRunRequest

CreateRunRequest type {
    assistant_id: Str,
    model: Any?,
    reasoning_effort: ReasoningEffort?,
    instructions: Str?,
    additional_instructions: Str?,
    additional_messages: Vec<CreateMessageRequest>?,
    tools: Vec<AssistantTool>?,
    metadata: Metadata?,
    temperature: Dec?,
    top_p: Dec?,
    stream: Bool?,
    max_prompt_tokens: Int?,
    max_completion_tokens: Int?,
    truncation_strategy: Any?,
    tool_choice: Any?,
    parallel_tool_calls: ParallelToolCalls?,
    response_format: AssistantsApiResponseFormatOption?
}

CreateRunRequest

CreateRunRequest type {
    assistant_id: Str,
    model: Any?,
    reasoning_effort: ReasoningEffort?,
    instructions: Str?,
    additional_instructions: Str?,
    additional_messages: Vec<CreateMessageRequest>?,
    tools: Vec<AssistantTool>?,
    metadata: Metadata?,
    temperature: Dec?,
    top_p: Dec?,
    stream: Bool?,
    max_prompt_tokens: Int?,
    max_completion_tokens: Int?,
    truncation_strategy: Any?,
    tool_choice: Any?,
    parallel_tool_calls: ParallelToolCalls?,
    response_format: AssistantsApiResponseFormatOption?
}

CreateRunResponse

CreateRunResponse type {
    id: Str,
    object: "thread.run",
    created_at: Int,
    thread_id: Str,
    assistant_id: Str?,
    status: RunStatus,
    required_action: Map?,
    last_error: Map?,
    expires_at: Int?,
    started_at: Int?,
    cancelled_at: Int?,
    failed_at: Int?,
    completed_at: Int?,
    incomplete_details: Map?,
    model: Str,
    instructions: Str?,
    tools: Vec<AssistantTool>,
    metadata: Metadata?,
    usage: RunCompletionUsage?,
    temperature: Dec?,
    top_p: Dec?,
    max_prompt_tokens: Int?,
    max_completion_tokens: Int?,
    truncation_strategy: Any,
    tool_choice: Any,
    parallel_tool_calls: ParallelToolCalls,
    response_format: AssistantsApiResponseFormatOption
}

CreateSpeechRequest

CreateSpeechRequest type {
    model: Any,
    input: Str,
    instructions: Str?,
    voice: VoiceIdsShared,
    response_format: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm"?,
    speed: Dec?,
    stream_format: "sse" | "audio"?
}

CreateSpeechRequest

CreateSpeechRequest type {
    model: Any,
    input: Str,
    instructions: Str?,
    voice: VoiceIdsShared,
    response_format: "mp3" | "opus" | "aac" | "flac" | "wav" | "pcm"?,
    speed: Dec?,
    stream_format: "sse" | "audio"?
}

CreateSpeechResponse

CreateSpeechResponse type {
    value: Str
}

CreateThreadAndRunRequest

CreateThreadAndRunRequest type {
    assistant_id: Str,
    thread: CreateThreadRequest?,
    model: Any?,
    instructions: Str?,
    tools: Vec<AssistantTool>?,
    tool_resources: Map?,
    metadata: Metadata?,
    temperature: Dec?,
    top_p: Dec?,
    stream: Bool?,
    max_prompt_tokens: Int?,
    max_completion_tokens: Int?,
    truncation_strategy: Any?,
    tool_choice: Any?,
    parallel_tool_calls: ParallelToolCalls?,
    response_format: AssistantsApiResponseFormatOption?
}

CreateThreadAndRunRequest

CreateThreadAndRunRequest type {
    assistant_id: Str,
    thread: CreateThreadRequest?,
    model: Any?,
    instructions: Str?,
    tools: Vec<AssistantTool>?,
    tool_resources: Map?,
    metadata: Metadata?,
    temperature: Dec?,
    top_p: Dec?,
    stream: Bool?,
    max_prompt_tokens: Int?,
    max_completion_tokens: Int?,
    truncation_strategy: Any?,
    tool_choice: Any?,
    parallel_tool_calls: ParallelToolCalls?,
    response_format: AssistantsApiResponseFormatOption?
}

CreateThreadAndRunResponse

CreateThreadAndRunResponse type {
    id: Str,
    object: "thread.run",
    created_at: Int,
    thread_id: Str,
    assistant_id: Str?,
    status: RunStatus,
    required_action: Map?,
    last_error: Map?,
    expires_at: Int?,
    started_at: Int?,
    cancelled_at: Int?,
    failed_at: Int?,
    completed_at: Int?,
    incomplete_details: Map?,
    model: Str,
    instructions: Str?,
    tools: Vec<AssistantTool>,
    metadata: Metadata?,
    usage: RunCompletionUsage?,
    temperature: Dec?,
    top_p: Dec?,
    max_prompt_tokens: Int?,
    max_completion_tokens: Int?,
    truncation_strategy: Any,
    tool_choice: Any,
    parallel_tool_calls: ParallelToolCalls,
    response_format: AssistantsApiResponseFormatOption
}

CreateThreadRequest

CreateThreadRequest type {
    messages: Vec<CreateMessageRequest>?,
    tool_resources: Map?,
    metadata: Metadata?
}

CreateThreadRequest

CreateThreadRequest type {
    messages: Vec<CreateMessageRequest>?,
    tool_resources: Map?,
    metadata: Metadata?
}

CreateThreadResponse

CreateThreadResponse type {
    id: Str,
    object: "thread",
    created_at: Int,
    tool_resources: Map?,
    metadata: Metadata?
}

CreateTranscriptionRequest

CreateTranscriptionRequest type {
    file: Str,
    model: Any,
    language: Str?,
    prompt: Str?,
    response_format: AudioResponseFormat?,
    temperature: Dec?,
    stream: Bool?,
    chunking_strategy: TranscriptionChunkingStrategy?,
    timestamp_granularities: Vec<"word" | "segment">?,
    include: Vec<TranscriptionInclude>?
}

CreateTranscriptionRequest

CreateTranscriptionRequest type {
    file: Str,
    model: Any,
    language: Str?,
    prompt: Str?,
    response_format: AudioResponseFormat?,
    temperature: Dec?,
    stream: Bool?,
    chunking_strategy: TranscriptionChunkingStrategy?,
    timestamp_granularities: Vec<"word" | "segment">?,
    include: Vec<TranscriptionInclude>?
}

CreateTranscriptionResponse

CreateTranscriptionResponse type {
    value: Any
}

CreateTranslationRequest

CreateTranslationRequest type {
    file: Str,
    model: Any,
    prompt: Str?,
    response_format: "json" | "text" | "srt" | "verbose_json" | "vtt"?,
    temperature: Dec?
}

CreateTranslationRequest

CreateTranslationRequest type {
    file: Str,
    model: Any,
    prompt: Str?,
    response_format: "json" | "text" | "srt" | "verbose_json" | "vtt"?,
    temperature: Dec?
}

CreateTranslationResponse

CreateTranslationResponse type {
    value: Any
}

CreateUploadRequest

CreateUploadRequest type {
    filename: Str,
    purpose: "assistants" | "batch" | "fine-tune" | "vision",
    bytes: Int,
    mime_type: Str
}

CreateUploadRequest

CreateUploadRequest type {
    filename: Str,
    purpose: "assistants" | "batch" | "fine-tune" | "vision",
    bytes: Int,
    mime_type: Str
}

CreateUploadResponse

CreateUploadResponse type {
    id: Str,
    created_at: Int,
    filename: Str,
    bytes: Int,
    purpose: Str,
    status: UploadStatus,
    expires_at: Int?,
    object: "upload",
    file: Any?
}

CreateVectorStoreFileBatchRequest

CreateVectorStoreFileBatchRequest type {
    file_ids: Vec<Str>,
    chunking_strategy: ChunkingStrategyRequestParam?,
    attributes: VectorStoreFileAttributes?
}

CreateVectorStoreFileBatchRequest

CreateVectorStoreFileBatchRequest type {
    file_ids: Vec<Str>,
    chunking_strategy: ChunkingStrategyRequestParam?,
    attributes: VectorStoreFileAttributes?
}

CreateVectorStoreFileBatchResponse

CreateVectorStoreFileBatchResponse type {
    id: Str,
    object: "vector_store.files_batch",
    created_at: Int,
    vector_store_id: Str,
    status: VectorStoreFileStatus,
    file_counts: Map
}

CreateVectorStoreFileRequest

CreateVectorStoreFileRequest type {
    file_id: Str,
    chunking_strategy: ChunkingStrategyRequestParam?,
    attributes: VectorStoreFileAttributes?
}

CreateVectorStoreFileRequest

CreateVectorStoreFileRequest type {
    file_id: Str,
    chunking_strategy: ChunkingStrategyRequestParam?,
    attributes: VectorStoreFileAttributes?
}

CreateVectorStoreFileResponse

CreateVectorStoreFileResponse type {
    id: Str,
    object: "vector_store.file",
    usage_bytes: Int,
    created_at: Int,
    vector_store_id: Str,
    status: VectorStoreFileStatus,
    last_error: Map?,
    chunking_strategy: ChunkingStrategyResponse?,
    attributes: VectorStoreFileAttributes?
}

CreateVectorStoreRequest

CreateVectorStoreRequest type {
    file_ids: Vec<Str>?,
    name: Str?,
    expires_after: VectorStoreExpirationAfter?,
    chunking_strategy: ChunkingStrategyRequestParam?,
    metadata: Metadata?
}

CreateVectorStoreRequest

CreateVectorStoreRequest type {
    file_ids: Vec<Str>?,
    name: Str?,
    expires_after: VectorStoreExpirationAfter?,
    chunking_strategy: ChunkingStrategyRequestParam?,
    metadata: Metadata?
}

CreateVectorStoreResponse

CreateVectorStoreResponse type {
    id: Str,
    object: "vector_store",
    created_at: Int,
    name: Str?,
    usage_bytes: Int,
    file_counts: Map,
    status: VectorStoreStatus,
    expires_after: VectorStoreExpirationAfter?,
    expires_at: Int?,
    last_active_at: Int?,
    metadata: Metadata?
}

Embedding

Embedding type {
    index: Int,
    embedding: Vec<Dec>,
    object: "embedding"
}

Error

Error type {
    code: Str,
    message: Str,
    param: Str,
    type: Str
}

Eval

Eval type {
    object: "eval",
    id: Str,
    name: Str?,
    data_source_config: Map,
    testing_criteria: Vec,
    created_at: Int,
    metadata: Metadata?
}

EvalApiError

EvalApiError type {
    code: Str?,
    message: Str
}

EvalRun

EvalRun type {
    object: "eval.run",
    id: Str,
    eval_id: Str,
    status: Str,
    model: Str,
    name: Str?,
    created_at: Int,
    report_url: Str?,
    result_counts: Map,
    per_model_usage: Vec<Map>,
    per_testing_criteria_results: Vec<Map>,
    data_source: Map,
    metadata: Metadata?,
    error: EvalApiError?
}

FilePurpose

FilePurpose type Str

FineTuneDPOHyperparameters

FineTuneDPOHyperparameters type {
    beta: Any?,
    batch_size: Any?,
    learning_rate_multiplier: Any?,
    n_epochs: Any?
}

FineTuneDPOMethod

FineTuneDPOMethod type {
    hyperparameters: FineTuneDPOHyperparameters?
}

FineTuneMethod

FineTuneMethod type {
    type: FineTuneMethodType,
    supervised: FineTuneSupervisedMethod?,
    dpo: FineTuneDPOMethod?,
    reinforcement: FineTuneReinforcementMethod?
}

FineTuneMethodType

FineTuneMethodType type "supervised" | "dpo" | "reinforcement"

FineTuneReasoningEffort

FineTuneReasoningEffort type "default" | "low" | "medium" | "high"

FineTuneReinforcementHyperparameters

FineTuneReinforcementHyperparameters type {
    batch_size: Any?,
    learning_rate_multiplier: Any?,
    n_epochs: Any?,
    reasoning_effort: FineTuneReasoningEffort?,
    compute_multiplier: Any?,
    eval_interval: Any?,
    eval_samples: Any?
}

FineTuneReinforcementMethod

FineTuneReinforcementMethod type {
    grader: Map,
    hyperparameters: FineTuneReinforcementHyperparameters?
}

FineTuneSupervisedHyperparameters

FineTuneSupervisedHyperparameters type {
    batch_size: Any?,
    learning_rate_multiplier: Any?,
    n_epochs: Any?
}

FineTuneSupervisedMethod

FineTuneSupervisedMethod type {
    hyperparameters: FineTuneSupervisedHyperparameters?
}

FineTuningCheckpointPermission

FineTuningCheckpointPermission type {
    id: Str,
    created_at: Int,
    project_id: Str,
    object: "checkpoint.permission"
}

FineTuningJob

FineTuningJob type {
    id: Str,
    created_at: Int,
    error: Map?,
    fine_tuned_model: Str?,
    finished_at: Int?,
    hyperparameters: Map,
    model: Str,
    object: "fine_tuning.job",
    organization_id: Str,
    result_files: Vec<Str>,
    status: FineTuningJobStatus,
    trained_tokens: Int?,
    training_file: Str,
    validation_file: Str?,
    integrations: Vec?,
    seed: Int,
    estimated_finish: Int?,
    method: FineTuneMethod?,
    metadata: Metadata?
}

FineTuningJobStatus

FineTuningJobStatus type "validating_files" | "queued" | "running" | "succeeded" | "failed" | "cancelled"

Image

Image type {
    b64_json: Str?,
    url: Str?,
    revised_prompt: Str?
}

ImageGenInputUsageDetails

ImageGenInputUsageDetails type {
    text_tokens: Int,
    image_tokens: Int
}

ImageGenUsage

ImageGenUsage type {
    input_tokens: Int,
    total_tokens: Int,
    output_tokens: Int,
    input_tokens_details: ImageGenInputUsageDetails
}

ImageInputFidelity

ImageInputFidelity type Str

ImagesResponse

ImagesResponse type {
    created: Int,
    data: Vec<Image>?,
    background: ImagesResponseBackground?,
    output_format: ImagesResponseOutputFormat?,
    size: ImagesResponseSize?,
    quality: ImagesResponseQuality?,
    usage: ImageGenUsage?
}

ImagesResponseBackground

ImagesResponseBackground type "transparent" | "opaque"

ImagesResponseOutputFormat

ImagesResponseOutputFormat type "png" | "webp" | "jpeg"

ImagesResponseQuality

ImagesResponseQuality type "low" | "medium" | "high"

ImagesResponseSize

ImagesResponseSize type "1024x1024" | "1024x1536" | "1536x1024"

ListFineTuningCheckpointPermissionResponse

ListFineTuningCheckpointPermissionResponse type {
    data: Vec<FineTuningCheckpointPermission>,
    object: "list",
    first_id: Str?,
    last_id: Str?,
    has_more: Bool
}

MessageContent

MessageContent type Any

MessageObject

MessageObject type {
    id: Str,
    object: "thread.message",
    created_at: Int,
    thread_id: Str,
    status: MessageStatus,
    incomplete_details: Map?,
    completed_at: Int?,
    incomplete_at: Int?,
    role: MessageRole,
    content: Vec<MessageContent>,
    assistant_id: Str?,
    run_id: Str?,
    attachments: Vec<Map>?,
    metadata: Metadata?
}

MessageRole

MessageRole type "user" | "assistant"

MessageStatus

MessageStatus type "in_progress" | "incomplete" | "completed"

Metadata

Metadata type Map

OpenAIFile

OpenAIFile type {
    id: Str,
    bytes: Int,
    created_at: Int,
    expires_at: Int?,
    filename: Str,
    object: "file",
    purpose: OpenAIFilePurpose,
    status: OpenAIFileStatus,
    status_details: Str?
}

OpenAIFilePurpose

OpenAIFilePurpose type "assistants" | "assistants_output" | "batch" | "batch_output" | "fine-tune" | "fine-tune-results" | "vision" | "user_data"

OpenAIFileStatus

OpenAIFileStatus type "uploaded" | "processed" | "error"

ParallelToolCalls

ParallelToolCalls type Bool

PartialImages

PartialImages type Map

ReasoningEffort

ReasoningEffort type Str

Response

Response type Map

RunCompletionUsage

RunCompletionUsage type {
    completion_tokens: Int,
    prompt_tokens: Int,
    total_tokens: Int
}

RunObject

RunObject type {
    id: Str,
    object: "thread.run",
    created_at: Int,
    thread_id: Str,
    assistant_id: Str?,
    status: RunStatus,
    required_action: Map?,
    last_error: Map?,
    expires_at: Int?,
    started_at: Int?,
    cancelled_at: Int?,
    failed_at: Int?,
    completed_at: Int?,
    incomplete_details: Map?,
    model: Str,
    instructions: Str?,
    tools: Vec<AssistantTool>,
    metadata: Metadata?,
    usage: RunCompletionUsage?,
    temperature: Dec?,
    top_p: Dec?,
    max_prompt_tokens: Int?,
    max_completion_tokens: Int?,
    truncation_strategy: Any,
    tool_choice: Any,
    parallel_tool_calls: ParallelToolCalls,
    response_format: AssistantsApiResponseFormatOption
}

RunStatus

RunStatus type Str

ServiceTier

ServiceTier type Str

StopConfiguration

StopConfiguration type Any

ThreadObject

ThreadObject type {
    id: Str,
    object: "thread",
    created_at: Int,
    tool_resources: Map,
    metadata: Metadata?
}

TranscriptionChunkingStrategy

TranscriptionChunkingStrategy type Map

TranscriptionInclude

TranscriptionInclude type Str

Upload

Upload type {
    id: Str,
    created_at: Int,
    filename: Str,
    bytes: Int,
    purpose: Str,
    status: UploadStatus,
    expires_at: Int,
    object: "upload",
    file: Any?
}

UploadStatus

UploadStatus type "pending" | "completed" | "cancelled" | "expired"

VectorStoreExpirationAfter

VectorStoreExpirationAfter type {
    anchor: "last_active_at",
    days: Int
}

VectorStoreFileAttributes

VectorStoreFileAttributes type Map

VectorStoreFileBatchObject

VectorStoreFileBatchObject type {
    id: Str,
    object: "vector_store.files_batch",
    created_at: Int,
    vector_store_id: Str,
    status: VectorStoreFileStatus,
    file_counts: Map
}

VectorStoreFileObject

VectorStoreFileObject type {
    id: Str,
    object: "vector_store.file",
    usage_bytes: Int,
    created_at: Int,
    vector_store_id: Str,
    status: VectorStoreFileStatus,
    last_error: Map?,
    chunking_strategy: ChunkingStrategyResponse?,
    attributes: VectorStoreFileAttributes?
}

VectorStoreFileStatus

VectorStoreFileStatus type "in_progress" | "completed" | "cancelled" | "failed"

VectorStoreObject

VectorStoreObject type {
    id: Str,
    object: "vector_store",
    created_at: Int,
    name: Str?,
    usage_bytes: Int,
    file_counts: Map,
    status: VectorStoreStatus,
    expires_after: VectorStoreExpirationAfter?,
    expires_at: Int?,
    last_active_at: Int?,
    metadata: Metadata?
}

VectorStoreStatus

VectorStoreStatus type "expired" | "in_progress" | "completed"

VoiceIdsShared

VoiceIdsShared type Str