Simple reverse proxy server for the OpenAI API.
If you have an API key you want to share with a friend, you can use this to keep your key safe while still allowing them to generate text with the API.
OpenAI keys have full account permissions. They can revoke themselves, generate new keys, modify spend quotas, etc. You absolutely should not share them.
If you still want to share access to your key, you can put it behind this proxy to ensure it can't be used to do anything but generate text. You can also set a separate key on the proxy to gatekeep access.
+
button in the top right corner and select Duplicate this Space
.Repository Secrets
section and click New Secret
.OPENAI_KEY
as the name and your OpenAI API key as the value.Do not paste the key into server.js
! That file is public and anyone can see it. Leave it alone; it will load the key from the secret you just created.
Factory Reset
from that same Settings menu.PROXY_KEY
. This key will need to be passed in the Authentication header of every request to the server, just like an OpenAI API key.Note: The keys
section in the serverinfo screen may not correctly identify keys as trial/paid/GPT-4 unless you use the more advanced configuration described in .env.example
.
{ "message": "OpenAI Reverse Proxy", "uptime": 211082.571080388, "timestamp": 1741059616331, "baseUrl": "https://migsadventure-openai-proxy.hf.space", "kobold": "https://migsadventure-openai-proxy.hf.space/proxy/kobold (not yet implemented)", "openai": "https://migsadventure-openai-proxy.hf.space/proxy/openai", "keys": { "all": 1, "active": 1, "trial": 0, "gpt4": 1, "proompts": 0 } }