Back to APIs list

ChatGPT API examples & templates

Use these vals as a playground to view and fork ChatGPT API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
janpaul123 avatar
valTownChatGPT2
@janpaul123
HTTP
https://x.com/JanPaul123/status/1811801305066651997 Fork it and authenticate with your Val Town API token as the password.
mttlws avatar
valTownChatGPT
@mttlws
HTTP
ChatGPT Implemented in Val Town Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events.
simonw avatar
valTownChatGPT
@simonw
HTTP
ChatGPT Implemented in Val Town Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events.
willthereader avatar
valTownChatGPT
@willthereader
HTTP
ChatGPT Implemented in Val Town Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events
xuybin avatar
valTownChatGPT
@xuybin
HTTP
ChatGPT Implemented in Val Town Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events.
fadi avatar
promptChatGPT
@fadi
Script
An interactive, runnable TypeScript val by fadi
gtrufitt avatar
handleChatGPTRequest
@gtrufitt
Script
An interactive, runnable TypeScript val by gtrufitt
maxdrake avatar
chatGPTExample
@maxdrake
Script
An interactive, runnable TypeScript val by maxdrake
maxm avatar
selfEditingWebsiteGPT
@maxm
HTTP
Self Editing Website - GPT Version Visit and ask ChatGPT to edit the site at: https://maxm-selfeditingwebsitegpt.web.val.run/
ktodaz avatar
getGPTResponse
@ktodaz
Script
Get a response from GPT for the player.
stevekrouse avatar
openai
@stevekrouse
Script
OpenAI ChatGPT helper function This val uses your OpenAI token if you have one, and the @std/openai if not, so it provides limited OpenAI usage for free. import { chat } from "https://esm.town/v/stevekrouse/openai"; const { content } = await chat("Hello, GPT!"); console.log(content); import { chat } from "https://esm.town/v/stevekrouse/openai"; const { content } = await chat( [ { role: "system", content: "You are Alan Kay" }, { role: "user", content: "What is the real computer revolution?"} ], { max_tokens: 50, model: "gpt-4o" } ); console.log(content);
bingo16 avatar
newChatGPT35
@bingo16
Script
An interactive, runnable TypeScript val by bingo16
chatgpt avatar
chat
@chatgpt
Script
// Forked from @webup.chat
bingo16 avatar
getChatgpt
@bingo16
Script
An interactive, runnable TypeScript val by bingo16
stevekrouse avatar
chatGPT
@stevekrouse
HTTP
ChatGPT Implemented in Val Town Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events. ⚠️ Note: Requires your own OpenAI API key to get this to run in a fork
bitbloxhub avatar
chatGptUnoCss
@bitbloxhub
Script
// Forked from @patrickjm.chatGptExample