๐ API is Live! Start making requests immediately โ no API key required.
๐ก Base URL
https://gpt-oss-2t.pages.dev/api/gpt-oss-2t
โก Quick Start
JavaScript (Fetch API)
const response = await fetch('https://gpt-oss-2t.pages.dev/api/gpt-oss-2t', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
messages: [
{ role: 'user', content: 'Hello! Who created you?' }
],
stream: false,
temperature: 0.8
})
});
const data = await response.json();
console.log(data.choices[0].message.content);
JavaScript (Streaming)
const response = await fetch('https://gpt-oss-2t.pages.dev/api/gpt-oss-2t', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
messages: [
{ role: 'user', content: 'Tell me a short story!' }
],
stream: true
})
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
const lines = chunk.split('\n').filter(line => line.trim());
for (const line of lines) {
if (line.startsWith('data: ')) {
const data = line.slice(6);
if (data === '[DONE]') continue;
try {
const parsed = JSON.parse(data);
const content = parsed.choices[0]?.delta?.content || '';
process.stdout.write(content); // Stream to console
} catch (e) {}
}
}
}
Python
import requests
response = requests.post(
'https://gpt-oss-2t.pages.dev/api/gpt-oss-2t',
json={
'messages': [
{'role': 'user', 'content': 'Hello! Who created you?'}
],
'stream': False,
'temperature': 0.8
}
)
data = response.json()
print(data['choices'][0]['message']['content'])
cURL
curl -X POST https://gpt-oss-2t.pages.dev/api/gpt-oss-2t \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Hello! Who created you?"}
],
"stream": false,
"temperature": 0.8
}'
๐ Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
messages |
array | โ Yes | Array of message objects with role and content |
stream |
boolean | โ No | Enable streaming responses (default: true) |
temperature |
number | โ No | Sampling temperature 0.0-2.0 (default: 0.8) |
max_tokens |
number | โ No | Maximum tokens to generate (default: -1 = unlimited) |
top_p |
number | โ No | Nucleus sampling parameter (default: 0.9) |
๐ Rate Limits
โ ๏ธ Per-IP Rate Limiting Enforced
- Maximum 2 requests per second per IP
- Minimum 500ms delay between requests
- Requests are queued and processed sequentially per IP
๐ Response Format
Non-Streaming Response
{
"id": "chatcmpl-xyz",
"object": "chat.completion",
"created": 1234567890,
"model": "gpt-oss:latest",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I was created by Riste Stev..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 20,
"completion_tokens": 50,
"total_tokens": 70
}
}
Streaming Response (SSE)
data: {"id":"chatcmpl-xyz","choices":[{"delta":{"content":"Hello"},"index":0}]}
data: {"id":"chatcmpl-xyz","choices":[{"delta":{"content":" there"},"index":0}]}
data: [DONE]
๐จ Error Responses
{
"error": "Missing messages array"
}
๐ค AI Implementation Prompt
Copy this prompt and paste it into any AI assistant (ChatGPT, Claude, etc.) to automatically implement this API:
I need you to integrate the GPT-OSS 2T API into my application.
API Endpoint: https://gpt-oss-2t.pages.dev/api/gpt-oss-2t
Method: POST
Request format (JSON):
{
"messages": [
{"role": "user", "content": "your message here"}
],
"stream": true, // or false for non-streaming
"temperature": 0.8,
"max_tokens": -1,
"top_p": 0.9
}
Requirements:
1. Create a chat interface with a text input and send button
2. Display user messages and AI responses in a conversation view
3. Support streaming responses (show AI response word-by-word as it arrives)
4. Handle the SSE stream format: "data: {json}\n\n" and stop on "data: [DONE]"
5. Add error handling for network issues and rate limits
6. Show a loading indicator while waiting for responses
7. Make the UI responsive and user-friendly
The API:
- Uses OpenAI-compatible format
- Has rate limiting: max 2 req/sec per IP, 500ms min gap between requests
- Supports both streaming and non-streaming responses
- No API key required
- CORS enabled for browser requests
Please implement this with clean, production-ready code.
๐งช Test the API
Health Check: GET https://gpt-oss-2t.pages.dev/api/gpt-oss-2t
Returns API status, model info, and rate limit details.
Returns API status, model info, and rate limit details.
๐ก Example Use Cases
- ๐ค Chatbots and conversational interfaces
- ๐ Content generation and writing assistance
- ๐ฌ Customer support automation
- ๐ Educational tools and tutoring apps
- ๐ Question answering systems
- ๐ Multi-language translation and localization
๐ ๏ธ Technical Details
Infrastructure:
- Hosted on Cloudflare Pages (global edge network)
- Automatic retry with exponential backoff (3 attempts)
- Per-IP sequential request queuing
- Built-in rate limiting and throttling
- System prompt auto-injection with current date/time
๐ License & Attribution
This API is powered by GPT-OSS, created by Riste Stev.
Please use responsibly and respect the rate limits. This is a free service provided for educational and development purposes.