{"id":13625387,"url":"https://github.com/openai/openai-assistants-quickstart","last_synced_at":"2025-05-14T07:08:08.829Z","repository":{"id":237567103,"uuid":"794712823","full_name":"openai/openai-assistants-quickstart","owner":"openai","description":"OpenAI Assistants API quickstart with Next.js.","archived":false,"fork":false,"pushed_at":"2025-03-07T18:50:12.000Z","size":37,"stargazers_count":1822,"open_issues_count":18,"forks_count":510,"subscribers_count":95,"default_branch":"main","last_synced_at":"2025-04-14T05:53:30.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://platform.openai.com/docs/assistants","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-05-01T19:48:19.000Z","updated_at":"2025-04-14T03:22:37.000Z","dependencies_parsed_at":"2024-08-01T21:59:36.362Z","dependency_job_id":"d9762696-e385-46e4-9dfa-81dd1f621702","html_url":"https://github.com/openai/openai-assistants-quickstart","commit_stats":null,"previous_names":["openai/openai-assistants-quickstart"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fopenai-assistants-quickstart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fopenai-assistants-quickstart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fopenai-assistants-quickstart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openai%2Fopenai-assistants-quickstart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openai","download_url":"https://codeload.github.com/openai/openai-assistants-quickstart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254092655,"owners_count":22013290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-01T21:01:54.959Z","updated_at":"2025-05-14T07:08:08.810Z","avatar_url":"https://github.com/openai.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Chatbots"],"sub_categories":[],"readme":"# OpenAI Assistants API Quickstart\n\nA quick-start template using the OpenAI [Assistants API](https://platform.openai.com/docs/assistants/overview) with [Next.js](https://nextjs.org/docs).\n\u003cbr/\u003e\n\u003cbr/\u003e\n![OpenAI Assistants API Quickstart](https://github.com/openai/openai-assistants-quickstart/assets/27232/755e85e9-3ea4-421f-b202-3b0c435ea270)\n\n## Quickstart Setup\n\n### 1. Clone repo\n\n```shell\ngit clone https://github.com/openai/openai-assistants-quickstart.git\ncd openai-assistants-quickstart\n```\n\n### 2. Set your [OpenAI API key](https://platform.openai.com/api-keys)\n\n```shell\nexport OPENAI_API_KEY=\"sk_...\"\n```\n\n(or in `.env.example` and rename it to `.env`).\n\n### 3. Install dependencies\n\n```shell\nnpm install\n```\n\n### 4. Run\n\n```shell\nnpm run dev\n```\n\n### 5. Navigate to [http://localhost:3000](http://localhost:3000).\n\n## Deployment\n\nYou can deploy this project to Vercel or any other platform that supports Next.js.\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fopenai%2Fopenai-assistants-quickstart\u0026env=OPENAI_API_KEY,OPENAI_ASSISTANT_ID\u0026envDescription=API%20Keys%20and%20Instructions\u0026envLink=https%3A%2F%2Fgithub.com%2Fopenai%2Fopenai-assistants-quickstart%2Fblob%2Fmain%2F.env.example)\n\n## Overview\n\nThis project is intended to serve as a template for using the Assistants API in Next.js with [streaming](https://platform.openai.com/docs/assistants/overview/step-4-create-a-run), tool use ([code interpreter](https://platform.openai.com/docs/assistants/tools/code-interpreter) and [file search](https://platform.openai.com/docs/assistants/tools/file-search)), and [function calling](https://platform.openai.com/docs/assistants/tools/function-calling). While there are multiple pages to demonstrate each of these capabilities, they all use the same underlying assistant with all capabilities enabled.\n\nThe main logic for chat will be found in the `Chat` component in `app/components/chat.tsx`, and the handlers starting with `api/assistants/threads` (found in `api/assistants/threads/...`). Feel free to start your own project and copy some of this logic in! The `Chat` component itself can be copied and used directly, provided you copy the styling from `app/components/chat.module.css` as well.\n\n### Pages\n\n- Basic Chat Example: [http://localhost:3000/examples/basic-chat](http://localhost:3000/examples/basic-chat)\n- Function Calling Example: [http://localhost:3000/examples/function-calling](http://localhost:3000/examples/function-calling)\n- File Search Example: [http://localhost:3000/examples/file-search](http://localhost:3000/examples/file-search)\n- Full-featured Example: [http://localhost:3000/examples/all](http://localhost:3000/examples/all)\n\n### Main Components\n\n- `app/components/chat.tsx` - handles chat rendering, [streaming](https://platform.openai.com/docs/assistants/overview?context=with-streaming), and [function call](https://platform.openai.com/docs/assistants/tools/function-calling/quickstart?context=streaming\u0026lang=node.js) forwarding\n- `app/components/file-viewer.tsx` - handles uploading, fetching, and deleting files for [file search](https://platform.openai.com/docs/assistants/tools/file-search)\n\n### Endpoints\n\n- `api/assistants` - `POST`: create assistant (only used at startup)\n- `api/assistants/threads` - `POST`: create new thread\n- `api/assistants/threads/[threadId]/messages` - `POST`: send message to assistant\n- `api/assistants/threads/[threadId]/actions` - `POST`: inform assistant of the result of a function it decided to call\n- `api/assistants/files` - `GET`/`POST`/`DELETE`: fetch, upload, and delete assistant files for file search\n\n## Feedback\n\nLet us know if you have any thoughts, questions, or feedback in [this form](https://docs.google.com/forms/d/e/1FAIpQLScn_RSBryMXCZjCyWV4_ebctksVvQYWkrq90iN21l1HLv3kPg/viewform?usp=sf_link)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenai%2Fopenai-assistants-quickstart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenai%2Fopenai-assistants-quickstart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenai%2Fopenai-assistants-quickstart/lists"}