Python scrips to interact with the OpenAI API. This repo is mirrored at https://github.com/kikobar/openai-api
Go to file
2025-08-31 18:52:41 +08:00
.gitignore Add create and delete conversation functionality 2025-08-30 20:26:29 +08:00
__init__.py Add create and delete conversation functionality 2025-08-30 20:26:29 +08:00
cancel_model_response.py Add cancel model response functionality 2025-08-31 10:47:22 +08:00
CODE_OF_CONDUCT.md Add license and code of conduct 2025-08-31 10:54:46 +08:00
config-sample.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
CONTRIBUTING.md Add contributing guidelines 2025-08-31 11:01:10 +08:00
create_conversation.py Add create and delete conversation functionality 2025-08-30 20:26:29 +08:00
create_model_response.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
create_text_item.py Add create model response and create text item 2025-08-30 23:04:59 +08:00
create_vector_store.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
create_vector_store_file.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
delete_conversation.py Add create and delete conversation functionality 2025-08-30 20:26:29 +08:00
delete_file.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
delete_item.py Add delete item functionality 2025-08-31 09:49:50 +08:00
delete_model_response.py Add functionality to delte model response 2025-08-31 10:36:58 +08:00
delete_vector_store.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
delete_vector_store_file.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
LICENSE.md Add license and code of conduct 2025-08-31 10:54:46 +08:00
list_files.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
list_input_items.py Add functionality for list input items, retrieve item and retrieve model response 2025-08-31 10:31:15 +08:00
list_items.py Add list items 2025-08-30 22:21:30 +08:00
list_vector_store_files.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
list_vector_stores.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
README.md Update README.md 2025-08-31 18:49:01 +08:00
retrieve_conversation.py Add retrieve conversation 2025-08-31 09:58:31 +08:00
retrieve_file.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
retrieve_file_content.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
retrieve_item.py Add functionality for list input items, retrieve item and retrieve model response 2025-08-31 10:31:15 +08:00
retrieve_model_response.py Add functionality for list input items, retrieve item and retrieve model response 2025-08-31 10:31:15 +08:00
retrieve_vector_store.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
retrieve_vector_store_file.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
retrieve_vector_store_file_content.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00
SECURITY.md Update SECURITY.md 2025-08-31 18:52:41 +08:00
update_conversation.py Add list items 2025-08-30 22:21:30 +08:00
upload_file.py Add functionality for using vector storages and file uploads 2025-08-31 18:20:09 +08:00

Objective

These Python scripts allow to interact with the OpenAI API. You can manipulate the main abstractions of the OpenAI model:

  • Conversations
  • Responses
  • Inputs
  • Items
  • Vector Stores
  • Files

Requirements

  • Python installed on the machine running this application.
  • Credentials for accessing the OpenAI API - you will need to singup to the OpenAI portal. You will then be able to craete your credentials from within the portal.

How to run this application

  • Copy the file config-sample.py to config.py.

  • Edit config.py with your credentials and defaults.

  • Each script has a number of mandatory parameters in strict order:

    Script Parameter 1 Parameter 2 Parameter 3 Purpose
    cancel_model_response.py response_id Cancel a Response running in the background
    create_conversation.py Create a new Conversation
    create_model_response.py conversation_id model_id input_message Create a Response within a Conversation
    create_text_item.py conversation_id input_message Create a user input or instruction within a Conversation
    create_vector_store.py Create a Vector Store
    create_vector_store_file.py vector_store_id file_id Create a File in a Vector Store
    delete_conversation.py conversation_id Delete a Conversation
    delete_file.py file_id Delete a File
    delete_item.py conversation_id item_id Delete an Item (input or Response) from a Conversation
    delete_model_response.py response_id Delete a Response
    delete_vector_store.py vector_store_id Delete a Vector Store
    delete_vector_store_file.py vector_store_id file_id Delete a File from a Vector Store
    list_files.py List all uploaded Files
    list_input_items.py response_id List all input Items used to generate a Response
    list_items.py conversation_id List all Items (inputs or Responses) in a Conversation
    list_vector_store_files.py vector_store_id List all Files in a Vector Store
    list_vector_stores.py List all Vector Stores
    retrieve_conversation.py conversation_id Retrieve a Conversation
    retrieve_file.py file_id Retrieve a File
    retrieve_file_content.py file_id Retrieve the content of File
    retrieve_item.py conversation_id item_id Retrieve an Item from a Conversation
    retrieve_model_response.py response_id Retrieve a model Response
    retrieve_vector_store.py vector_store_id Retrieve a Vector Store
    retrieve_vector_store_file.py vector_store_id file_id Retrieve a File from a Vector Store
    retrieve_vector_store_file_content.py vector_store_id file_id Retrieve the content of a File from a Vector Store
    update_conversation.py conversation_id metadata Update a Conversation metadata
    upload_file.py filename path-to-file Upload a File to the OpenAI platform
  • To execute these scripts run python3 <script.py> <parameter_1> ....