OpenAI

Get started using OpenAI's chat completion without the need to set your own API keys.

Usage

Here's a quick example to get you started with the Val Town OpenAI wrapper:

import { OpenAI } from "https://esm.town/v/std/openai"; const openai = new OpenAI(); const functionExpression = await openai.chat.completions.create({ "messages": [ { "role": "user", "content": "Say hello in a creative way" }, ], model: "gpt-4", max_tokens: 30, }); console.log(functionExpression.choices[0].message.content);