curl --request POST \
--url https://api.zerogpu.ai/v1/chat/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-project-id: <api-key>' \
--data '
{
"model": "llama-3.1-8b-instruct-fast",
"messages": [
{
"role": "user",
"content": "NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon."
}
]
}
'import requests
url = "https://api.zerogpu.ai/v1/chat/completions"
payload = {
"model": "llama-3.1-8b-instruct-fast",
"messages": [
{
"role": "user",
"content": "NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon."
}
]
}
headers = {
"x-api-key": "<api-key>",
"x-project-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
'x-project-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'llama-3.1-8b-instruct-fast',
messages: [
{
role: 'user',
content: 'NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon.'
}
]
})
};
fetch('https://api.zerogpu.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));falsepackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zerogpu.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"llama-3.1-8b-instruct-fast\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon.\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-project-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.zerogpu.ai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-project-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"llama-3.1-8b-instruct-fast\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl_abc123",
"object": "chat.completion",
"created": 1710000000,
"model": "llama-3.1-8b-instruct-fast",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Artemis III, slated for late 2026, will return astronauts to the Moon for the first time since 1972, landing two crew at the south pole to study shadowed craters that may hold water ice."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 112,
"completion_tokens": 44,
"total_tokens": 156
}
}{
"error": {
"code": "insufficient_quota",
"message": "You have insufficient quota to complete this request."
}
}Chat completions
OpenAI-style chat inference for models that use this route.
curl --request POST \
--url https://api.zerogpu.ai/v1/chat/completions \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-project-id: <api-key>' \
--data '
{
"model": "llama-3.1-8b-instruct-fast",
"messages": [
{
"role": "user",
"content": "NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon."
}
]
}
'import requests
url = "https://api.zerogpu.ai/v1/chat/completions"
payload = {
"model": "llama-3.1-8b-instruct-fast",
"messages": [
{
"role": "user",
"content": "NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon."
}
]
}
headers = {
"x-api-key": "<api-key>",
"x-project-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
'x-project-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'llama-3.1-8b-instruct-fast',
messages: [
{
role: 'user',
content: 'NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon.'
}
]
})
};
fetch('https://api.zerogpu.ai/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));falsepackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zerogpu.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"llama-3.1-8b-instruct-fast\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon.\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-project-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.zerogpu.ai/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-project-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"llama-3.1-8b-instruct-fast\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"NASA announced that its Artemis III mission is now scheduled for late 2026, marking the first time astronauts will land on the lunar surface since Apollo 17 in 1972. The mission will send a crew of four to the Moon aboard the Orion spacecraft, with two astronauts descending to the south pole using SpaceX Starship as a lunar lander. Scientists are particularly excited about exploring permanently shadowed craters that may contain water ice, which could be critical for sustaining long-term human presence on the Moon.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl_abc123",
"object": "chat.completion",
"created": 1710000000,
"model": "llama-3.1-8b-instruct-fast",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Artemis III, slated for late 2026, will return astronauts to the Moon for the first time since 1972, landing two crew at the south pole to study shadowed craters that may hold water ice."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 112,
"completion_tokens": 44,
"total_tokens": 156
}
}{
"error": {
"code": "insufficient_quota",
"message": "You have insufficient quota to complete this request."
}
}messages array) instead of the Responses input field. The dashboard and model catalog indicate which route applies. Each model page has its own playground with the right examples for that model.
Install the official SDK from npm or PyPI (pip install zerogpu-api). Source: zerogpu/SDK.
Response JSON shape depends on the model; handle errors the same way as API error codes.Authorizations
Your ZeroGPU API key. Create one in the dashboard under API keys. Send it on every request.
The UUID of the project the request is billed to. Find it in the dashboard project settings.
Body
Model identifier. Open a model page for a dedicated playground with the correct body for that model.
llama-3.1-8b-instruct-fast, LFM2.5-1.2B-Instruct, LFM2.5-1.2B-Thinking, deberta-v3-small, gliner2-base-v1, gliner-multi-pii-v1, zlm-v1-followup-questions-edge, zlm-v1-iab-classify-edge, zlm-v1-iab-classify-edge-enriched "llama-3.1-8b-instruct-fast"
Optional model-specific parameters, passed through to the model. For example, PII models accept mask and usecase. See the relevant model page for supported keys.
Response
Success
An OpenAI-compatible chat completion.
Unique identifier for the completion.
"chatcmpl_abc123"
Object type. Always chat.completion.
"chat.completion"
Unix timestamp (seconds) when the completion was created.
1710000000
The model used for inference.
"llama-3.1-8b-instruct-fast"
List of completion choices.
Hide child attributes
Hide child attributes
Position of this choice in the list.
0
Why the model stopped generating, for example stop or length.
"stop"

