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.
stevekrouse avatar
cron2
@stevekrouse
HTTP
Forked from stevekrouse/cron
chatgpt avatar
myApi
@chatgpt
Script
An interactive, runnable TypeScript val by chatgpt
chriswmartin avatar
calories
@chriswmartin
HTTP
Forked from stevekrouse/calories
stevekrouse avatar
purpleHornet
@stevekrouse
HTTP
Forked from willthereader/Bringing_My_OCD_Online
willthereader avatar
Bringing_My_OCD_Online
@willthereader
HTTP
Forked from willthereader/homepage
elsif_maj avatar
topHNThreadByHour
@elsif_maj
Email
// set at Thu Nov 30 2023 14:22:53 GMT+0000 (Coordinated Universal Time)
u avatar
modifyImage
@u
Script
Forked from stevekrouse/modifyImage
willthereader avatar
projects
@willthereader
HTTP
@jsxImportSource https://esm.sh/hono@latest/jsx
dvsj avatar
subscribeToNewsletter
@dvsj
HTTP
Add an email entry option to your static website/blog. Easy peasy. 🚀 PoV: You just hacked together a portfolio website or launched a blog as a static website. Some people who visit might be interested in hearing more from you. ❤️ But you don't want to get lost building your backend, API, DB or fancy apps like SubstandardStack or MailMachineGun for people to sign up to your newsletter. 😩 All you want is a simple input box on your website - when someone types their email , username or social link in and submits it, you want to be notified. psst...do you want another one that uses the DB instead of email so you can look up all entries at once? Let me know and I'll get cooking! Quickstart Call the val URL with data in the query param userContact . That's it! // Format `https://<val_url>?userContact=<mandatory_primary_contact>` // Examples `https://dvsj-subscribeToNewsletter.web.val.run?userContact=dav.is@zohomail.in` `https://dvsj-subscribeToNewsletter.web.val.run?userContact=CatalanCabbage` Bonus Have extra data apart from email? Pass any encoded data in the queryParam userData , will be included in the email. It's optional. // Format `https://<val_url>?userContact=<mandatory_primary_contact>&userData=<optional_any_data>` //Examples `https://dvsj-subscribeToNewsletter.web.val.run?userContact=dav.is@zohomail.in&userData={"time": "2/2/1969", "twitter": "https://twitter.com/dvsj_in"}` // Note: All values should be URL encoded. Example: let userData = {"time": "2/2/1969", "twitter": "https://twitter.com/dvsj_in"} let encodedUserData = encodeURIComponent(userData) //This should go in the query param Want bot protection? Add a simple question to your website, like "okay, so what's one minus one?" . In the val, set isBotProtectionOn = true and botProtectionAnswer="0" . When you call the val, include the encoded user's answer to the bot question as botProtection query param. Answer will be compared with botProtectionAnswer ; if the answer is wrong, the request is rejected. // Format `https://<val_url>?userContact=<mandatory_primary_contact>&userData=<optional_any_data>&botProtection=<answer>` //Examples `https://dvsj-subscribeToNewsletter.web.val.run?userContact=dav.is@zohomail.in&botProtection=123` Add it to your website Want to add it to your site but get a headstart coding it? Use this ChatGPT prompt to get code for your website! I'm building a simple form submission component. It should a submit button and these 2 input boxes: 1. "userContact" to get the user's email (mandatory) 2. "userData" to get a custom message from the user (optional) On clicking the submit button: 1. Both input values should be encoded using "encodeURIComponent" 2. A GET URL should be built in this format with query params. Include userData query param only if input is not null or empty. `https://dvsj-subscribeToNewsletter.web.val.run?userContact=<encodedUserContact>&userData=<encodedUserData>` 3. The GET URL should be called and result printed in the console. I'm using React, so make it a react component.
domingo1987 avatar
problemPython
@domingo1987
HTTP
// Privacy policy template in Markdown
yawnxyz avatar
valwriter
@yawnxyz
HTTP
Forked from stevekrouse/valwriter
stevekrouse avatar
modifyImage
@stevekrouse
Script
Code from https://deno.com/blog/build-image-resizing-api Useful for compressing an image before sending to chatgpt4v, for example
cameronpak avatar
homeless
@cameronpak
HTTP
Homeless Services by OurTechnology At OurTechnology , we create technology solutions to empower and equip those who serve the homeless. We have a large data set of available resources in the US to aid in helping those experiencing homelessness find local resources, community, and support. This private ( but public to read ) API is used in our ChatGPT Assistant, Homeless Services . Why a ChatGPT Assistant ? OpenAI announced on May 13, 2024 that free users will soon be able to "discover and use GPTs and the GPT Store ( OpenAI )" There's a larger number of people experiencing homelessness who own a phone than what I imagined. ChatGPT allows for a simple interface, even with voice chat (a more natural way to navigate the tool), to find resources to help those experiencing homelessness. And, it's fast! Technical details The data set has been compiled together over the years and will continue to be updated as new techniques and partnerships make that possible. We use Typesense , a search as a service tool, to provide lightning fast search results for homeless resources near you. This endpoint is created with Hono and is an incredibly easy way to create an API. Contact OurTechnology Visit our website Email us! Find us on LinkedIn While this is on Cameron Pak's ValTown, this code is owned and operated by OurTechnology.
envl avatar
calc_qq_string
@envl
Script
一个计算“QQ等级”的函数,用来自动更新签名还挺好玩的。
tfayyaz avatar
tahirsTil
@tfayyaz
HTTP
Forked from stevekrouse/linkInBioTemplate
ilikescience avatar
modifyImage
@ilikescience
Script
Forked from stevekrouse/modifyImage