Loading account...
Using the API
curl -X POST <endpoint> \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"MODEL_ID","messages":[{"role":"user","content":"hi"}]}'
import requests
response = requests.post(
"<endpoint>",
headers={
"Authorization": "Bearer YOUR_KEY",
"Content-Type": "application/json"
},
json={
"model": "MODEL_ID",
"messages": [{"role": "user", "content": "hi"}]
}
)
print(response.json())
const response = await fetch("<endpoint>", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "MODEL_ID",
messages: [{ role: "user", content: "hi" }]
})
});
const data = await response.json();
console.log(data);
const fetch = require("node-fetch"); // or global fetch on Node 18+
const response = await fetch("<endpoint>", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "MODEL_ID",
messages: [{ role: "user", content: "hi" }]
})
});
const data = await response.json();
console.log(data);
Replace MODEL_ID with any model listed above, and YOUR_KEY with a key created below.