File size: 6,700 Bytes
177e4c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3655a2f
31585bb
 
 
 
f6874c9
 
 
 
3655a2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177e4c2
 
 
f6874c9
 
 
 
 
 
 
 
 
177e4c2
 
 
 
3655a2f
 
 
 
 
177e4c2
 
 
3655a2f
 
 
 
 
 
 
177e4c2
 
 
 
 
 
 
 
 
 
 
3655a2f
 
 
 
 
 
 
177e4c2
 
 
 
 
 
 
 
3655a2f
 
 
 
 
 
 
177e4c2
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Quardo's OpenAI proxy</title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="Quardo's OpenAI proxy documentation">
		<meta name="keywords" content="OpenAI, proxy, API, documentation, GPT-4O-mini">
		<meta name="author" content="Quardo">
		<meta property="og:title" content="Quardo's OpenAI proxy">
		<meta property="og:description" content="Documentation for Quardo's OpenAI proxy">
		<meta property="og:type" content="website">
		<meta property="og:url" content="https://quardo-gpt-4o-mini.hf.space/api/v1/docs">
		<meta property="og:image" content="https://tenor.com/view/cat-cat-e-cat-meme-cat-face-gif-23642589">
		<meta name="twitter:card" content="summary_large_image">
		<meta name="twitter:title" content="Quardo's OpenAI proxy">
		<meta name="twitter:description" content="Documentation for Quardo's OpenAI proxy">
		<meta name="twitter:image" content="https://tenor.com/view/cat-cat-e-cat-meme-cat-face-gif-23642589">
		<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/codemirror.min.css">
		<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/theme/monokai.min.css">
		<style>
			body {font-family: Arial, sans-serif; background-color: #f4f4f9; color: #333; margin: 0; padding: 0;}
			h1, h2 {color: #444; text-align: center;}
			.main {max-width: 800px; margin: 20px auto; padding: 20px; background-color: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); border-radius: 8px;}
			.CodeMirror {border: 1px solid #ddd; border-radius: 8px; margin: 20px 0;}
			hr {border: 0; height: 1px; background: #ddd; margin: 40px 0;}
			p {line-height: 1.6;}
		</style>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/codemirror.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/mode/python/python.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/mode/shell/shell.min.js"></script>
	</head>
	<body>
		<div class="main">
			<hr/>
			<h1>Documentation of the API/updates</h1>
			<hr/>
			<h2>Updates</h2>
			<div>
				<div>
					<strong> - 5. Update.</strong>
					<p> * Added extreamly strict moderation, as the last model didn't support multi languages.</p>
				</div><hr/>
				<div>
					<strong> - 4. Update.</strong>
					<p> * Added a user consent feature for the application's terms of use.</p>
				</div><hr/>
				<div>
					<strong> - 3. Update.</strong>
					<p> * Managed to fix the file being non-visible to the AI model after one round.</p>
					<p> * And fix the div error on this page.</p>
				</div><hr/>
				<div>
					<strong> - 2. Update.</strong>
					<p> * Added light moderation. [Might add more strict detection later]</p>
				</div><hr/>
				<div>
					<strong> - 1. Update.</strong>
					<p> * Fixed a bug where file encoding could trash the entire chat.</p>
					<p> * Made models allowed set by the maintainer. [OPENAI_API_MODELS variable]</p>
				</div><hr/>
				<div>
					<p><strong id="w" alt="yes i love fear"> * </strong>yippeeee</p>
					<script>let q=25;setInterval(_=>{q+=.001;w.style.fontSize=`${q}px`},100);</script>
					<label style="font-size: 2px;">The message above is edited by a script every 100ms. you can check it via view-source.</label>
				</div>
			</div>
			<hr/>
			<h2>API Endpoints</h2>
			<p>Here are some example codes to interact with the API:</p>
			<p><strong>Note:</strong> By using our API, you acknowledge and agree to the following terms regarding the data you provide:</p>
			<ul>
				<li>Data Collection: This application may collect data shared through the Gradio endpoint or the API endpoint.</li>
				<li>Privacy: Please avoid sharing any personal information.</li>
				<li>Data Retention and Removal: Data files are deleted every 30 days, and the API is restarted to ensure data clearance.</li>
				<li>Scope of Data Collected: The data collected includes model settings, chat history, and responses from the model. This applies only to 'chat' endpoints (Gradio and API) and excludes moderation checks.</li>
				<li>Data Usage: The collected data is periodically reviewed, and if any concerning activity is detected, the code is updated accordingly.</li>
			</ul>
			<p>By continuing to use our API, you explicitly consent to the collection, use, and potential sharing of your data as described above. If you disagree with our data collection, usage, and sharing practices, we advise you not to use our API.</p>
			<textarea id="example1" name="example1"># Example 1: Using OpenAI Python client
from openai import OpenAI

client = OpenAI(
	# Or use the `OPENAI_BASE_URL` env var
	base_url="https://quardo-gpt-4o-mini.hf.space/api/v1",
	
	# No key is needed cause this is a proxy 
	api_key="none"
)

completion = client.chat.completions.create( # or openai.ChatCompletion.create (idk)
	model="gpt-4o-mini",
	messages=[
		{
			"role": "user",
			"content": "Say this is a test",
		}
	],
)

print(completion.choices[0].message.content)</textarea>
			<hr/>
			<textarea id="example2" name="example2"># Example 2: Using OpenAI Python client with different syntax
import openai

openai.api_key = 'none'
openai.base_url = "https://quardo-gpt-4o-mini.hf.space/api/v1"

completion = openai.chat.completions.create( # or openai.ChatCompletion.create (idk)
	model="gpt-4o-mini",
	messages=[
		{
			"role": "user",
			"content": "Say this is a test",
		},
	],
)

print(completion.choices[0].message.content)</textarea>
			<hr/>
			<textarea id="example3" name="example3"># For Node.js:
# I am too lazy to look into openai's docs
# so please kindly take a look at github there is probably examples there.</textarea>
			<hr/>
			<div>
				<h3>Actual endpoints:</h3>
				<p><strong>1. [GET]</strong> <a href="https://quardo-gpt-4o-mini.hf.space/api/v1/models">/api/v1/models</a></p>
					<label>Simply shows you the available models</label>
				<p><strong>3. [POST]</strong> <a href="https://quardo-gpt-4o-mini.hf.space/api/v1/chat/completions">/api/v1/chat/completions</a></p>
					<label>Generates a chat completion based on the provided messages and model</label>
			</div>
		</div>
		<script>
			CodeMirror.fromTextArea(document.getElementById("example1"), { lineNumbers: true, mode: "python", theme: "monokai", readOnly: true });
			CodeMirror.fromTextArea(document.getElementById("example2"), { lineNumbers: true, mode: "python", theme: "monokai", readOnly: true });
			CodeMirror.fromTextArea(document.getElementById("example3"), { lineNumbers: true, mode: "shell",  theme: "monokai", readOnly: true });
		</script>
	</body>
</html>