Skip to content

backmesh/backmesh

Repository files navigation

Backmesh

😵‍💫 Problem

Shipping private API keys in your app can lead to bad actors that hack your API account and rack up thousands of dollars in API costs

🛠️ Solution

Backmesh is an open-source, thoroughly tested backend that uses military grade encryption to protect your private API key and offer an API Gatekeeper to let your web or mobile app safely call the API using any SDK without exposing private API keys. Only 2 changes needed in your app:

  1. Replace the API URL with the Backmesh Gatekeeper URL.
  2. Replace the API private key with the authenticated user's JWT.
import OpenAI from "openai";
import supabase from "supabase-js";

const BACKMESH_URL =
 "https://edge.backmesh.com/v1/proxy/gbBbHCDBxqb8zwMk6dCio63jhOP2/wjlwRswvSXp4FBXwYLZ1/v1";

const jwt = supabase.auth.session().access_token;
const client = new OpenAI({
  httpAgent: new HttpsProxyAgent(BACKMESH_URL),
  dangerouslyAllowBrowser: true, // no longer dangerous
  apiKey: jwt,
});

🔒 How is the LLM API protected

  • JWT Authentication: Requests are verified with JWTs from the app's authentication provider so only your users have access to the LLM API via Backmesh.
  • Rate limits per user: Configurable per-user rate limits to prevent abuse (e.g. no more than 5 OpenAI API calls per user per hour).

🛡️ Additional Protections for LLM APIs

  • Resource access control: Sensitive API resources like Files and Threads are protected so only the users that create them can continue to access them.

For more details, see the security documentation.

⚡️ Try out Backmesh

Get started with Backmesh using our dashboard or if you would like to self host make sure to check out the self hosting guide.

🚀 Contribute

To contribute, visit Contributing.md

About

open-source, tested backend to protect LLM keys in your app

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Contributors