Skip to content

Boilerplate project to quickly launch a NestJS powered API for ChatGPT GPT actions

License

Notifications You must be signed in to change notification settings

pAIrprogio/nestjs-gpt-action-api-template

Repository files navigation

NestJS GPT Action API Template

Social Image with alt text

Installation

git clone https://github.com/pairprog/nestjs-gpt-action-template.git
cd nestjs-gpt-action-template
pnpm install
cp .env.example .env

Configure

  • In package.json > scripts > tunnel , change domain_name with yours
  • In .env
    • Change BASE_URL with yours
    • (Not required) Set SENTRY_DSN to enable Sentry error reporting
  • In main.ts
    • Set the Title and Description of the API

Run Locally

pnpm run tunnel

And in another terminal window

pnpm run start:dev
# or
pnpm run start:debug
  • The OpenAPI schema's URL will be shown in the terminal window in blue.
    • Copy it
    • In "actions" section of your GPT app:
      • Click "Create New Action"
      • Click on "Import from URL"
      • Paste the URL.
      • Click "Import"

Add an action

Other

OpenAI specific headers

OpenAI provides identifying information with each query. You can access them in routes using the ChatGptHeaders decorator

@Post('/my/path')
function myPath(@ChatGptHeaders() headers: ChatGptHeaders) {
  // ...
}

About

Boilerplate project to quickly launch a NestJS powered API for ChatGPT GPT actions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published