Skip to content

Latest commit

 

History

History

with-openai

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

StepZen Example: with-openai

Introduction

This project shows how to create a GraphQL API connected for OpenAI using StepZen. We will use the @rest directive to generate our GraphQL schema. You can refer to the documentation here

Getting Started

You'll need to create a StepZen account first. Once you've got that set up, git clone this repository onto your machine and open the working directory:

git clone https://github.com/stepzen-dev/examples.git
cd examples/with-openai

You also need an OpenAI account and an API key. You can get one from the OpenAPI web site. Once you have it, please create a .env file and save it there:

echo "STEPZEN_OPENAI_API_KEY=sk-s6-yourkey-yourkey-yourkey-H3" > .env

Run StepZen

Open your terminal and install the StepZen CLI:

npm install -g stepzen

You need to login here using the command:

stepzen login

After you've installed the CLI and logged in, run:

stepzen start

A proxy of the GraphiQL playground becomes available at http://localhost/5001 (in example http://localhost:5001/api/with-openai), which you can use to explore the GraphQL API. Also, the endpoint at which your GraphQL API is deployed gets logged in the terminal. You can query your GraphQL API from any application, browser, or IDE by providing the API Key linked to your account.

Learn More

You can learn more in the StepZen documentation for REST. Questions? Head over to Discord or GitHub Discussions to ask questions.