Bem-vindo, Usuário!
Créditos
--
Chaves
0
Reqs Hoje
0
Tokens Hoje
0
Suas Chaves de API
Uso dos Últimos 7 Dias
Carregando...
Histórico de Requisições
Clique na aba para carregar...
Documentação da API
A FuieuAPI é compatível com a API da OpenAI. Use qualquer SDK oficial apontando para nosso endpoint.
Base URL
https://api.fuieu.xyz/v1Autenticação
Use sua chave de API no header Authorization:
Authorization: Bearer fuieu_SUA_CHAVE_AQUIModelos Disponíveis
Carregando...
Chat Completions (curl)
bash
curl -X POST https://api.fuieu.xyz/v1/chat/completions \
-H "Authorization: Bearer fuieu_SUA_CHAVE" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4","messages":[{"role":"user","content":"Olá!"}]}'
Python (OpenAI SDK)
python
from openai import OpenAI
client = OpenAI(
base_url="https://api.fuieu.xyz/v1",
api_key="fuieu_SUA_CHAVE"
)
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role":"user","content":"Olá!"}]
)
print(response.choices[0].message.content)
JavaScript
javascript
const res = await fetch('https://api.fuieu.xyz/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer fuieu_SUA_CHAVE',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'gpt-4',
messages: [{role:'user',content:'Olá!'}],
}),
});
const data = await res.json();
Streaming (SSE)
javascript
const res = await fetch('https://api.fuieu.xyz/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer fuieu_SUA_CHAVE',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'gpt-4',
messages: [{role:'user',content:'Olá!'}],
stream: true,
}),
});
const reader = res.body.getReader();
const decoder = new TextDecoder();
while (true) {
const {done, value} = await reader.read();
if (done) break;
console.log(decoder.decode(value));
}