{"id":20439318,"url":"https://github.com/skitsanos/openai-files-api","last_synced_at":"2026-04-17T10:31:04.508Z","repository":{"id":224740371,"uuid":"764057844","full_name":"skitsanos/openai-files-api","owner":"skitsanos","description":"Manage files on OpenAI via this Flask Microservice","archived":false,"fork":false,"pushed_at":"2025-12-03T16:19:44.000Z","size":42,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-06T21:09:33.592Z","etag":null,"topics":["flask","flask-api","haystack","haystack-ai","haystack-pipeline","openai","openai-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skitsanos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-27T12:05:53.000Z","updated_at":"2025-12-03T16:19:47.000Z","dependencies_parsed_at":"2024-05-06T01:39:05.062Z","dependency_job_id":"13685863-dbeb-4e39-8841-0ec54386f932","html_url":"https://github.com/skitsanos/openai-files-api","commit_stats":null,"previous_names":["skitsanos/openai-files-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/skitsanos/openai-files-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Fopenai-files-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Fopenai-files-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Fopenai-files-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Fopenai-files-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skitsanos","download_url":"https://codeload.github.com/skitsanos/openai-files-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Fopenai-files-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31925259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T10:19:20.377Z","status":"ssl_error","status_checked_at":"2026-04-17T10:19:18.682Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","flask-api","haystack","haystack-ai","haystack-pipeline","openai","openai-api"],"created_at":"2024-11-15T09:16:15.797Z","updated_at":"2026-04-17T10:31:04.463Z","avatar_url":"https://github.com/skitsanos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openai-files-api\n\u003e OpenAI-driven File Manager and Summarizer\n\n\nThis is a simple API to upload files into and interact with files from OpenAI's GPT engine.\nThe API is built using Flask and uses the OpenAI Python library to interact with the OpenAI API.\n\nMost of the tasks are automated via Taskfile used by [Task](https://taskfile.dev/) - a task runner / build tool that\naims to be simpler and easier to use than, for example, GNU Make.\n\n## Installation\n\n1. Clone the repository using `git clone` or download the repository as a zip file and extract it\n2. Install support for the Taskfile, details can be found [here](https://taskfile.dev/#/installation)\n3. Install the required packages using `pip install -r requirements.txt` or run `task install`\n4. Modify environment variables in the `Taskfile.yaml` file\n\n- `OPENAI_API_KEY` - Your OpenAI API key\n- `AUTH_TOKEN` - The token to be used for authentication\n\n## Configuration\n\nThe configuration file is located at `config.yaml` and contains the following options:\n\n```yaml\nserver:\n  bind: 0.0.0.0\n  port: 5000\n  uploads: .uploads\n\ncors:\n  origins: \"*\"\n  methods: [ \"GET\", \"POST\", \"DELETE\" ]\n  allow_headers: [ \"Content-Type\", \"Authorization\" ]\n\nopenai:\n  model: gpt-4-turbo-preview\n```\n\n- `server` - The server configuration section\n    - `bind` - The IP address to bind the server to\n    - `port` - The port to bind the server to\n    - `uploads` - The directory to store the uploaded files\n- `cors` - The CORS configuration section, used to configure the CORS policy for the server\n    - `origins` - The allowed origins\n    - `methods` - The allowed methods\n    - `allow_headers` - The allowed headers\n- `openai` - The OpenAI configuration section\n    - `model` - The model to use for the OpenAI API\n\nYou can also override `bind` and `port` using environment variables `BIND` and `PORT` respectively. Environment\nvariables have higher priority than the configuration file.\n\n## Usage\n\nTo start the server, run `task start`. The server will start on the IP address and port specified in the configuration.\n\nTo stop the server, press `Ctrl+C` in the terminal.\n\n## Generating Systemd Service File\n\nTo generate a systemd service file, run `task generate-unit-file`. The service file will be generated in the current\ndirectory. The name of the service file will be `openai-files-api.service` and can be overridden using\nthe `DEPLOYMENT_SERVICE_NAME` variable in Taskfile.yaml.\n\n## Deploying the Server\n\nTo deploy the server, run `task deploy-to-remote`. This will generate a systemd service file and copy it to\nthe `/etc/systemd/system` on remote machine. The service will be enabled and started. During deployment Task will copy\nthe `config.yaml`, code and `Taskfile.yaml` to the remote machine.\n\nTo deploy to the remote machine, you need to modify the `DEPLOYMENT_ENDPOINT` and `DEPLOYMENT_USERNAME` variables in\nthe `Taskfile.yaml` file.\n\nYou can also build a Docker image using `task docker-build`. You can override the image name using the `DOCKER_TAG`\nvariable.\n\n## API Endpoints\n\nThe API has the following endpoints:\n\n- `GET /api` - The root endpoint, returns a welcome message in JSON format\n- `POST /api/files` - Upload a file to the server\n- `GET /api/files` - List all the files on the server\n- `GET /api/files/\u003cfile_id\u003e` - Get the details of a file\n- `GET /api/files/\u003cfile_id\u003e/summarize` - Summarize the file using the OpenAI API\n- `DELETE /api/files/\u003cfile_id\u003e` - Delete the file from the server\n\n\u003e For the supported file types and the request and response formats, please refer to the OpenAPI documentation at\nhttps://platform.openai.com/docs/assistants/tools/supported-files.\n\n## Summarizing a File\n\nTo summarize a file, you can use the `GET /api/files/\u003cfile_id\u003e/summarize` endpoint. This endpoint is used to retrieve a\nsummary of the text content from a specified file identified by its unique `file_id`.\n\n### Request\n\n- **Method**: `POST`\n- **URL**: `/api/files/\u003cfile_id\u003e/summarize`\n#### Request Body\n\nThe request body should be a JSON object with the following optional fields:\n\n1. `user_input` (string, default: \"Summarize the text from the given file\"):\n   - Specifies the user input for the summarization process. If not provided, a default message will be used.\n\n2. `instructions` (string, default: \"You are a helpful assistant.\"):\n   - Provides instructions for the summarization task. If not provided, a default message will be used.\n\n3. `model` (string, default: \"gpt-4-0125-preview\"):\n   - Specifies the model to be used for summarization. If not provided, the default model specified in the server configuration will be used.\n\n### Response\n\n- **Success**: Returns a summary of the text content from the specified file.\n- **Error**: Returns an error message if an unexpected error occurs during the summarization process.\n\n#### Example Request\n\n```json\n{\n  \"user_input\": \"Please summarize the main points of the document.\",\n  \"instructions\": \"Focus on key ideas and provide a concise summary.\",\n  \"model\": \"gpt-4-0125-preview\"\n}","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskitsanos%2Fopenai-files-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskitsanos%2Fopenai-files-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskitsanos%2Fopenai-files-api/lists"}