{"openapi":"3.1.0","info":{"title":"impala.ai OpenAI API v0.1.0","description":"An OpenAI API compatible server for impala.ai","version":"0.1.0"},"paths":{"/health":{"get":{"summary":"Health","description":"Liveness probe - returns 200 if server is running.","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/ready":{"get":{"summary":"Ready","description":"Readiness probe - returns 200 if services are initialized and ready.","operationId":"ready_ready_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/files":{"post":{"tags":["Files"],"summary":"Upload File","description":"Upload a file using true streaming without buffering to disk.","operationId":"upload_file_v1_files_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileObjectModel"}}}}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file","purpose"],"properties":{"file":{"type":"string","format":"binary","description":"The File object (not file name) to be uploaded."},"purpose":{"type":"string","enum":["assistants","batch","fine-tune","vision","user_data","evals"],"description":"The intended purpose of the uploaded file."},"expires_after":{"type":"object","description":"The expiration policy for a file. By default, files with purpose=batch expire after 30 days and all other files are persisted until they are manually deleted.","properties":{"anchor":{"type":"string","enum":["created_at"],"description":"Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`."},"seconds":{"type":"integer","minimum":3600,"maximum":2592000,"description":"The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days)."}},"required":["anchor","seconds"]}}}}}}},"get":{"tags":["Files"],"summary":"List Files","description":"List all uploaded files.","operationId":"list_files_v1_files_get","parameters":[{"name":"after","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"After"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":10000,"minimum":1},{"type":"null"}],"default":10000,"title":"Limit"}},{"name":"order","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/FileListOrder"},{"type":"null"}],"default":"desc","title":"Order"}},{"name":"purpose","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/FilePurpose"},{"type":"null"}],"title":"Purpose"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListFilesResponseModel"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseModel"}}},"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/files/{file_id}":{"get":{"tags":["Files"],"summary":"Get File","description":"Retrieve metadata for a specific file.","operationId":"get_file_v1_files__file_id__get","parameters":[{"name":"file_id","in":"path","required":true,"schema":{"type":"string","title":"File Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileObjectModel"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseModel"}}},"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Files"],"summary":"Delete File","description":"Delete a specific file.","operationId":"delete_file_v1_files__file_id__delete","parameters":[{"name":"file_id","in":"path","required":true,"schema":{"type":"string","title":"File Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteFileResponseModel"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseModel"}}},"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/files/{file_id}/content":{"get":{"tags":["Files"],"summary":"Get File Content","description":"Retrieve the content of a specific file.","operationId":"get_file_content_v1_files__file_id__content_get","parameters":[{"name":"file_id","in":"path","required":true,"schema":{"type":"string","title":"File Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseModel"}}},"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/batches":{"post":{"tags":["Batches"],"summary":"Create Batch","description":"Create a new batch of API requests.","operationId":"create_batch_v1_batches_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBatchRequestModel"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchModel"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseModel"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseModel"}}},"description":"Unprocessable Content"}}},"get":{"tags":["Batches"],"summary":"List Batches","description":"List all batches.","operationId":"list_batches_v1_batches_get","parameters":[{"name":"after","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"After"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":100,"minimum":1},{"type":"null"}],"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListBatchesResponse"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseModel"}}},"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/batches/{batch_id}":{"get":{"tags":["Batches"],"summary":"Get Batch","description":"Retrieve a specific batch.","operationId":"get_batch_v1_batches__batch_id__get","parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","title":"Batch Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchModel"}}}},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseModel"}}},"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/batches/{batch_id}/cancel":{"post":{"tags":["Batches"],"summary":"Cancel Batch","description":"Cancel a batch.\n\n**Note:** This endpoint is not yet implemented and will return a `501 Not Implemented` error.","operationId":"cancel_batch_v1_batches__batch_id__cancel_post","parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","title":"Batch Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchModel"}}}},"501":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponseModel"}}},"description":"Not Implemented"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"BatchErrorModel":{"properties":{"code":{"type":"string","title":"Code","description":"An error code identifying the error type."},"line":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Line","description":"The line number of the input file where the error occurred, if applicable."},"message":{"type":"string","title":"Message","description":"A human-readable message providing more details about the error."},"param":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Param","description":"The name of the parameter that caused the error, if applicable."}},"type":"object","required":["code","line","message","param"],"title":"BatchErrorModel"},"BatchErrorsModel":{"properties":{"data":{"items":{"$ref":"#/components/schemas/BatchErrorModel"},"type":"array","title":"Data","description":"A list of errors encountered during batch processing."},"object":{"type":"string","const":"list","title":"Object","description":"The object type, which is always `list`.","default":"list"}},"type":"object","required":["data"],"title":"BatchErrorsModel"},"BatchModel":{"properties":{"cancelled_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cancelled At","description":"The Unix timestamp (in seconds) for when the batch was cancelled."},"cancelling_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cancelling At","description":"The Unix timestamp (in seconds) for when the batch started cancelling."},"completed_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completed At","description":"The Unix timestamp (in seconds) for when the batch was completed."},"completion_window":{"type":"string","title":"Completion Window","description":"The time frame within which the batch should be processed."},"created_at":{"type":"integer","title":"Created At","description":"The Unix timestamp (in seconds) for when the batch was created."},"endpoint":{"type":"string","title":"Endpoint","description":"The OpenAI API endpoint used by the batch."},"error_file_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error File Id","description":"The ID of the file containing the outputs of requests with errors."},"errors":{"anyOf":[{"$ref":"#/components/schemas/BatchErrorsModel"},{"type":"null"}],"description":"The errors encountered during batch processing."},"expired_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expired At","description":"The Unix timestamp (in seconds) for when the batch expired."},"expires_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires At","description":"The Unix timestamp (in seconds) for when the batch will expire."},"failed_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Failed At","description":"The Unix timestamp (in seconds) for when the batch failed."},"finalizing_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Finalizing At","description":"The Unix timestamp (in seconds) for when the batch started finalizing."},"id":{"type":"string","title":"Id","description":"The unique identifier for the batch."},"job_id":{"type":"string","title":"Job Id","description":"ID of the Job definition this batch belongs to."},"in_progress_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"In Progress At","description":"The Unix timestamp (in seconds) for when the batch started processing."},"input_file_id":{"type":"string","title":"Input File Id","description":"The ID of the input file for the batch."},"metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Metadata","description":"Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters."},"object":{"type":"string","const":"batch","title":"Object","description":"The object type, which is always `batch`.","default":"batch"},"output_file_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Output File Id","description":"The ID of the file containing the outputs of successfully executed requests."},"request_counts":{"$ref":"#/components/schemas/RequestCountsModel","description":"The request counts for different statuses within the batch."},"status":{"$ref":"#/components/schemas/BatchStatus","description":"The current status of the batch."}},"type":"object","required":["completion_window","created_at","endpoint","id","job_id","input_file_id","request_counts","status"],"title":"BatchModel"},"BatchStatus":{"type":"string","enum":["validating","failed","in_progress","finalizing","completed","expired","cancelling","cancelled"],"title":"BatchStatus"},"CreateBatchRequestModel":{"properties":{"completion_window":{"type":"string","title":"Completion Window","description":"The time frame within which the batch should be processed. Currently only `unlimited` is supported."},"endpoint":{"type":"string","title":"Endpoint","description":"The endpoint to be used for all requests in the batch. Currently `v1/responses`, `v1/chat/completions`, `v1/embeddings`, and `v1/completions` are supported. Note that `v1/embeddings` batches are also restricted to a maximum of 50,000 embedding inputs across all requests in the batch."},"input_file_id":{"type":"string","title":"Input File Id","description":"The ID of an uploaded file that contains requests for the new batch. See upload file for how to upload a file. Your input file must be formatted as a JSONL file, and must be uploaded with the purpose batch. The file can contain up to 50,000 requests, and can be up to 200 MB in size."},"job_id":{"type":"string","title":"Job Id","description":"ID of the Job definition this batch belongs to. Links the batch to a specific model, use case, and SLA."},"metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Metadata","description":"Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters."},"output_expires_after":{"anyOf":[{"$ref":"#/components/schemas/FileExpirationModel"},{"type":"null"}],"description":"The expiration policy for the output and/or error file that are generated for a batch."}},"type":"object","required":["completion_window","endpoint","input_file_id","job_id"],"title":"CreateBatchRequestModel"},"DeleteFileResponseModel":{"properties":{"id":{"type":"string","title":"Id","description":"The ID of the deleted file."},"object":{"type":"string","const":"file","title":"Object","description":"The object type, which is always file."},"deleted":{"type":"boolean","title":"Deleted","description":"Whether the file was deleted successfully."}},"type":"object","required":["id","object","deleted"],"title":"DeleteFileResponseModel"},"ErrorDetail":{"properties":{"message":{"type":"string","title":"Message","description":"A human-readable error message."},"type":{"type":"string","title":"Type","description":"The type of error."},"param":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Param","description":"The parameter that caused the error, if applicable."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"An error code, if applicable."}},"type":"object","required":["message","type"],"title":"ErrorDetail"},"ErrorResponseModel":{"properties":{"error":{"$ref":"#/components/schemas/ErrorDetail","description":"The error details."}},"type":"object","required":["error"],"title":"ErrorResponseModel"},"FileExpirationModel":{"properties":{"anchor":{"type":"string","const":"created_at","title":"Anchor","description":"Anchor timestamp after which the expiration policy applies. Supported anchors: `created_at`."},"seconds":{"type":"integer","maximum":2592000.0,"minimum":3600.0,"title":"Seconds","description":"The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days)."}},"type":"object","required":["anchor","seconds"],"title":"FileExpirationModel"},"FileListOrder":{"type":"string","enum":["asc","desc"],"title":"FileListOrder"},"FileObjectModel":{"properties":{"id":{"type":"string","title":"Id","description":"The file identifier, which can be referenced in the API endpoints."},"object":{"type":"string","const":"file","title":"Object","description":"The object type, which is always file."},"bytes":{"type":"integer","title":"Bytes","description":"The size of the file, in bytes."},"created_at":{"type":"integer","title":"Created At","description":"The Unix timestamp (in seconds) for when the file was created."},"expires_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires At","description":"The Unix timestamp (in seconds) for when the file will expire."},"filename":{"type":"string","title":"Filename","description":"The name of the file."},"purpose":{"$ref":"#/components/schemas/FilePurpose","description":"The intended purpose of the file. Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`, `vision`, and `user_data`."}},"type":"object","required":["id","object","bytes","created_at","expires_at","filename","purpose"],"title":"FileObjectModel"},"FilePurpose":{"type":"string","enum":["assistants","assistants_output","batch","batch_output","fine-tune","fine-tune-results","vision","user_data"],"title":"FilePurpose"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ListBatchesResponse":{"properties":{"object":{"type":"string","const":"list","title":"Object","description":"The object type, which is always `list`.","default":"list"},"data":{"items":{"$ref":"#/components/schemas/BatchModel"},"type":"array","title":"Data","description":"A list of batch objects."},"first_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Id","description":"The ID of the first batch in the list."},"last_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Id","description":"The ID of the last batch in the list."},"has_more":{"type":"boolean","title":"Has More","description":"Whether there are more batches available after this list."}},"type":"object","required":["data","first_id","last_id","has_more"],"title":"ListBatchesResponse"},"ListFilesResponseModel":{"properties":{"object":{"type":"string","const":"list","title":"Object","description":"The object type, which is always `list`.","default":"list"},"data":{"items":{"$ref":"#/components/schemas/FileObjectModel"},"type":"array","title":"Data","description":"A list of file objects."},"first_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Id","description":"The ID of the first file in the list."},"last_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Id","description":"The ID of the last file in the list."},"has_more":{"type":"boolean","title":"Has More","description":"Whether there are more files available after this list."}},"type":"object","required":["data","first_id","last_id","has_more"],"title":"ListFilesResponseModel"},"RequestCountsModel":{"properties":{"completed":{"type":"integer","title":"Completed","description":"Number of requests that have been completed successfully."},"failed":{"type":"integer","title":"Failed","description":"Number of requests that have failed."},"total":{"type":"integer","title":"Total","description":"Total number of requests in the batch."}},"type":"object","required":["completed","failed","total"],"title":"RequestCountsModel"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}