😎 OpenAI caching proxy 💵

github repo

This is an api to help developers use openAI with caching.

Proxy/Post Mode

Proxy mode mirrors the openai chat api and adds caching
📋 copy
curl -s -X POST --json '{ "model": "gpt-3.5-turbo", "messages": [ { "role": "system", "content": "who is the leader of Cambodia. just output the name" } ] }' "https://aiapi.cash/" { "id": "12345", "object": "chat.completion", "created": 00000000, "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hun Sen" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 0, // 0 because this is a cached response "completion_tokens": 0, "total_tokens": 0 } }

GET Mode

Proxy mode is any get request to this api This mode attempts to use the file extension to determine mime type, we generate three versions and try to parse out the valid fileformat

Example 1: Typescript code

https://aiapi.cash/output zod types to parse reddits subreddit api.ts

zod types for reddit subreddit api


Example 2: package.json

https://aiapi.cash/node package myexampleproject with express, zod, express-session, typescript.json


Example 3: html file

https://aiapi.cash/american presidents from 1820 to 1900 as table include name (with link to wikipedia), birthplace, years served and political party.html