Technical Dig Deep

The code was based off of Shared Game Lobby
  • Thorough writeup of the technical details
  • Open source and free to use to start your own applications
  • Created by the same developers as Unacog
  • Authentication, Firestore, Cloud Functions and Hosting are covered in detail

Architecture


Firebase is used for realtime data and scale on demand hosting. The API keys are contained on the server using Firebase Functions. Session is the main document with 3 subcollections, tickets, assists and packets. The packets are the data sent to the model API, assists are the resuls and tickets are the user prompts that show the UI feed for a session.

Cost Tracking


Account usage is tracking using a unit called a credit. Credits are directly bound to the cost of each API call.
Credits = [Token Count] * [Token Cost / 1000] + [1 per Request]
So a Tokens per Credit ~ 1000 / [Token Cost]

Notes
  • Output tokens are about twice the cost of input
  • Only the token count returned is used for output (not the max)
  • 1 credit per request for overhead