FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
rozek
rozekGDI_AIChatCompletionService
Public
Like
GDI_AIChatCompletionService
Home
Code
2
README.md
H
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
main.tsx
https://rozek--774572ec26d511f0a5b3569c3dd06744.web.val.run
README.md

This val is part of a series of examples to introduce "val.town" in my computer science course at Stuttgart University of Applied Sciences.

The idea is to motivate even first-semester students not to wait but to put their ideas into practice from the very beginning and implement web apps with frontend and backend.

It contains a simple HTTP end point which expects a POST request with a JSON structure containing the properties "SystemMessage" and "UserMessage". These message are then used to run an OpenAI chat completion and produce an "assistant message" which is sent back to the client as plain text.

This val is the companion of

https://rozek-gdi_aichatcompletion.web.val.run/

which contains the browser part (aka "frontend") for this example.

The code was created using Townie - with only a few small manual corrections.

This val is licensed under the MIT License.

Migrated from folder: GDI_Examples/GDI_AIChatCompletionService

HTTP
  • main.tsx
    rozek--77…44.web.val.run
Code
README.md
H
main.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.