Quickstart
Send your first chat completion request in minutes.
Prerequisites
- A Pura LLM account with an active API key
- Your API key (starts with sk-)
- A model ID from the Models catalog (e.g. gpt-4o)
cURL
The simplest way to test the gateway:
bash
curl https://llm.puradigital.it/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Hello from Pura LLM!"}
]
}'Python (requests)
Using the requests library without the OpenAI SDK:
python
import requests
response = requests.post(
"https://llm.puradigital.it/v1/chat/completions",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Hello from Pura LLM!"}
],
},
)
print(response.json()["choices"][0]["message"]["content"])Node.js (fetch)
Using the native fetch API:
javascript
const response = await fetch("https://llm.puradigital.it/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello from Pura LLM!" }],
}),
});
const data = await response.json();
console.log(data.choices[0].message.content);Response format
Responses follow the standard OpenAI chat completion schema:
json
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "gpt-4o",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 9,
"total_tokens": 21
}
}