Skip to main content
POST
Completions

Generates a completion

Generates a completion from endpoint . Your endpoint ID can be found in the API tab of your endpoint or in the URL.

Parameters

Paths

id
string
required
Baseplate endpoint ID
Authorization
string
required
Baseplate API key. Needs to be in the format “Bearer &BASEPLATE_API_KEY”
Content-Type
string
Use application/json

Body

values
json
A json object with keys matching the variables of your deployed template
prompt
array
A prompt for Anthropic, ada, babbage, curie, and davinci models. One of messages or prompt is required.
messages
array
An array of the chat history, for gpt-3.5 and gpt-4 models. One of messages or prompt is required.
stream
boolean
If true, response will be sent back as Server Sent Events. A [DONE] message is sent at the end of the completion and the search results (if applicable) are sent after the [DONE]. See below for example.
user
string
A user string to use for OpenAI’s API.

Steaming Example (Next.js 13)

Heres an example if you are using NextJS 13/React: Backend (/api/completions/chat/route.ts):
Front end (inside some function):