1. Grab your credentials
Log into the ZeroGPU dashboard and copy these three values:| Credential | Where to find it |
|---|---|
| API Key | Dashboard → API Keys |
| Project ID (optional) | Dashboard → Project Settings - scopes requests to a project |
| Model | Dashboard → Model selector, or pick one from the Model Catalog |
2. Send a request
curl https://api.zerogpu.ai/v1/responses \
-H "content-type: application/json" \
-H "x-api-key: $ZEROGPU_API_KEY" \
-H "x-project-id: $ZEROGPU_PROJECT_ID" \
-d '{
"model": "YOUR_MODEL",
"input": "Your input text here..."
}'
# pip install zerogpu-api
import os
from zerogpu import ZerogpuApi
client = ZerogpuApi(
api_key=os.environ["ZEROGPU_API_KEY"],
project_id=os.environ["ZEROGPU_PROJECT_ID"],
)
response = client.responses.create_response(
model="YOUR_MODEL",
input="Your input text here...",
)
print(response)
// npm install zerogpu-api
import { ZerogpuApiClient } from 'zerogpu-api';
const client = new ZerogpuApiClient({
apiKey: process.env.ZEROGPU_API_KEY,
projectId: process.env.ZEROGPU_PROJECT_ID,
});
const response = await client.responses.createResponse({
model: 'YOUR_MODEL',
input: 'Your input text here...',
});
console.log(response.output);
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let payload = json!({
"model": "YOUR_MODEL",
"input": "Your input text here..."
});
let response = client
.post("https://api.zerogpu.ai/v1/responses")
.header("content-type", "application/json")
.header("x-api-key", "YOUR_API_KEY")
.header("x-project-id", "YOUR_PROJECT_ID")
.json(&payload)
.send()
.await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.zerogpu.ai/v1/responses"
payload := map[string]any{
"model": "YOUR_MODEL",
"input": "Your input text here...",
}
payloadBytes, err := json.Marshal(payload)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(payloadBytes))
if err != nil {
panic(err)
}
req.Header.Set("content-type", "application/json")
req.Header.Set("x-api-key", "YOUR_API_KEY")
req.Header.Set("x-project-id", "YOUR_PROJECT_ID")
client := &http.Client{}
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse('https://api.zerogpu.ai/v1/responses')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
request = Net::HTTP::Post.new(uri.request_uri)
request['content-type'] = 'application/json'
request['x-api-key'] = 'YOUR_API_KEY'
request['x-project-id'] = 'YOUR_PROJECT_ID'
request.body = {
model: 'YOUR_MODEL',
input: 'Your input text here...'
}.to_json
response = http.request(request)
puts response.body
Store your API key in environment variables. Never commit it to version control or expose it in client-side code.
3. See a complete example
A full request - here thellama-3.1-8b-instruct-fast model summarizing a passage:
curl https://api.zerogpu.ai/v1/responses \
-H "content-type: application/json" \
-H "x-api-key: $ZEROGPU_API_KEY" \
-H "x-project-id: $ZEROGPU_PROJECT_ID" \
-d '{
"model": "llama-3.1-8b-instruct-fast",
"input": "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."
}'
# pip install zerogpu-api
import os
from zerogpu import ZerogpuApi
client = ZerogpuApi(
api_key=os.environ["ZEROGPU_API_KEY"],
project_id=os.environ["ZEROGPU_PROJECT_ID"],
)
response = client.responses.create_response(
model="llama-3.1-8b-instruct-fast",
input="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.",
)
print(response)
// npm install zerogpu-api
import { ZerogpuApiClient } from 'zerogpu-api';
const client = new ZerogpuApiClient({
apiKey: process.env.ZEROGPU_API_KEY,
projectId: process.env.ZEROGPU_PROJECT_ID,
});
const response = await client.responses.createResponse({
model: 'llama-3.1-8b-instruct-fast',
input: '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.',
});
console.log(response.output);
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let payload = json!({
"model": "llama-3.1-8b-instruct-fast",
"input": "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."
});
let response = client
.post("https://api.zerogpu.ai/v1/responses")
.header("content-type", "application/json")
.header("x-api-key", "YOUR_API_KEY")
.header("x-project-id", "YOUR_PROJECT_ID")
.json(&payload)
.send()
.await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.zerogpu.ai/v1/responses"
payload := map[string]any{
"model": "llama-3.1-8b-instruct-fast",
"input": "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.",
}
payloadBytes, err := json.Marshal(payload)
if err != nil {
panic(err)
}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(payloadBytes))
if err != nil {
panic(err)
}
req.Header.Set("content-type", "application/json")
req.Header.Set("x-api-key", "YOUR_API_KEY")
req.Header.Set("x-project-id", "YOUR_PROJECT_ID")
client := &http.Client{}
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse('https://api.zerogpu.ai/v1/responses')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = (uri.scheme == 'https')
request = Net::HTTP::Post.new(uri.request_uri)
request['content-type'] = 'application/json'
request['x-api-key'] = 'YOUR_API_KEY'
request['x-project-id'] = 'YOUR_PROJECT_ID'
request.body = {
model: 'llama-3.1-8b-instruct-fast',
input: '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.'
}.to_json
response = http.request(request)
puts response.body
NASA's Artemis III mission is now scheduled for late 2026, marking the first lunar landing since Apollo 17 in 1972, with a crew of four astronauts aboard the Orion spacecraft, including two descending to the Moon's south pole using SpaceX Starship as a lunar lander to explore permanently shadowed craters potentially containing water ice crucial for sustaining a long-term human presence on the Moon.
4. Verify it worked
Check the dashboard:- Logs: your request appears with model, status, and latency.
- Usage: token counts update in real time.
401, your API key is wrong. A 403 means a bad project ID - see Authentication.

