This code defines fundamental OpenAI text completion API via Tapir and make HTTP request it via Http4s.
OPENAI_APIKEY="..." OPENAI_ORG="..." sbt run
Tapir is Endpoint definition library. You can define library(framework)-agnostic endpoint definition.
Tapir can define just an endpoint. So you can make use of it for both client code and server code.
See OpenAI.scala for actual endpoint definition.
Http4s is an HTTP server/client library, highly integrated with Cats and other functional components.