Skip to content

prompt caching to save dollars on generative AI API usage.

Notifications You must be signed in to change notification settings

NumexaHQ/captainCache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

captainCache

Proxy for the Generative AI application using OpenAI, Use it for cahing the prompts and monitoring the number of API calls.

Prerequisites

  • Go installed on your machine
  • Redis installed and running locally or accessible via a Redis server

Installation

  1. Clone this repository.

  2. Change into the Project directory.

  3. Install the project dependencies.

    go mod download
    
  4. Set up the Redis connection details in the main.go file

    redisClient = redis.NewClient(&redis.Options{
     Addr:     "localhost:6379",
     Password: "", // Enter your Redis password if applicable
     DB:       0,  // Use default Redis database
     })
    

Usage

  • start the Proxy server using
    go run main.go
    
  • Make HTTP requests via Proxy
    GET http://localhost:8080/?api_key=<YOUR_API_KEY>&prompt=Hello%20World