- Download openai-translator and double-click to install.
- Install SnipDo according to the documentation. Remember to disable proxy software when downloading the application from the Microsoft Store.
- Open the proxy software and select the proxy with US IP.
- Open the OpenAI API keys page and create an API key (
delete all others, hahaha). Obtain a free ChatGPT account from Unicorn Daily Sharing or other platforms and log in. - Fill in the created API key in OpenAI Translator.
Delete script (run in F12 > Console):
I'm sorry, really sorry, because the free quota for each account is too small.
// !! The Authorization and apiKeySentitiveId parameters need to be set before the first run
const authorizationHeader = {
Authorization: "Bearer sess-p70aSrrGmA5ZrlDCSFTlvmZoogv2Sjbx7OiYJgP6",
};
let apiKeySentitiveId = "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";
const apiKeyName = "this-account-belongs-me";
const interval = 5000;
async function bootstrap() {
console.log("Process started");
const apiKeys = await retrieveApiKeys();
// Delete all apiKeyName that do not match
const otherApiKeys = apiKeys.filter((x) => x.name !== apiKeyName);
for (const otherApiKey of otherApiKeys) {
await deleteApiKey(otherApiKey.sensitive_id, otherApiKey.created);
}
console.log("Irrelevant data deleted");
const apiKey = apiKeys.find((x) => x.name === apiKeyName);
if (!apiKey) {
console.log(`Cannot find ${apiKeyName}, creating automatically`);
await createApiKey(apiKeyName);
console.warn(`API Key created automatically, please copy and reset the translation software manually:`);
console.log(apiKeySentitiveId);
} else {
console.log(`API Key already exists, no need to recreate:`);
console.log(apiKeySentitiveId);
}
console.log(`Process started, will execute again after ${interval} milliseconds`);
setTimeout(bootstrap, interval);
}
bootstrap();
async function retrieveApiKeys() {
var apiKeysResponse = await fetch(
"https://api.openai.com/dashboard/user/api_keys",
{
headers: {
...authorizationHeader,
},
}
);
var apiKeys = (await apiKeysResponse.json()).data;
return apiKeys;
}
async function createApiKey(name) {
var deleteApiKeyResponse = await fetch(
"https://api.openai.com/dashboard/user/api_keys",
{
method: "POST",
headers: {
...authorizationHeader,
"Content-Type": "application/json",
},
body: JSON.stringify({
action: "create",
name,
}),
}
);
const content = await deleteApiKeyResponse.json();
const isSuccess = content.result === "success";
if (isSuccess) {
// Save the latest key
apiKeySentitiveId = content.key.sensitive_id;
}
return isSuccess;
}
async function deleteApiKey(redacted_key, created_at) {
var deleteApiKeyResponse = await fetch(
"https://api.openai.com/dashboard/user/api_keys",
{
method: "POST",
headers: {
...authorizationHeader,
"Content-Type": "application/json",
},
body: JSON.stringify({
action: "delete",
redacted_key: redacted_key,
created_at: created_at,
}),
}
);
const content = await deleteApiKeyResponse.json();
return content.result === "success";
}