curl -X POST "https://stapi.pw/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Tell me a fun fact."}]
}'
import requests
import json
url = "https://stapi.pw/v1/chat/completions"
payload = {
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Tell me a fun fact."}
]
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
print(response.json())
const fetch = require('node-fetch');
const url = 'https://stapi.pw/v1/chat/completions';
const data = {
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Tell me a fun fact.' }]
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(json => console.log(json))
.catch(error => console.error('Error:', error));