Create a batch
curl --request POST \
--url https://api.zerogpu.ai/v1/batches \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-project-id: <api-key>' \
--data '
{
"input_file_id": "file-abc123",
"endpoint": "/v1/chat/completions"
}
'import requests
url = "https://api.zerogpu.ai/v1/batches"
payload = {
"input_file_id": "file-abc123",
"endpoint": "/v1/chat/completions"
}
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({input_file_id: 'file-abc123', endpoint: '/v1/chat/completions'})
};
fetch('https://api.zerogpu.ai/v1/batches', 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/batches"
payload := strings.NewReader("{\n \"input_file_id\": \"file-abc123\",\n \"endpoint\": \"/v1/chat/completions\"\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/batches")
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 \"input_file_id\": \"file-abc123\",\n \"endpoint\": \"/v1/chat/completions\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "batch",
"endpoint": "<string>",
"status": "validating",
"input_file_id": "<string>",
"output_file_id": "<string>",
"error_file_id": "<string>",
"completion_window": "<string>",
"created_at": 123,
"expires_at": 123,
"request_counts": {
"total": 123,
"completed": 123,
"failed": 123
},
"metadata": {}
}Batch API
Create batch
Interactive playground for POST /v1/batches.
POST
/
v1
/
batches
Create a batch
curl --request POST \
--url https://api.zerogpu.ai/v1/batches \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-project-id: <api-key>' \
--data '
{
"input_file_id": "file-abc123",
"endpoint": "/v1/chat/completions"
}
'import requests
url = "https://api.zerogpu.ai/v1/batches"
payload = {
"input_file_id": "file-abc123",
"endpoint": "/v1/chat/completions"
}
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({input_file_id: 'file-abc123', endpoint: '/v1/chat/completions'})
};
fetch('https://api.zerogpu.ai/v1/batches', 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/batches"
payload := strings.NewReader("{\n \"input_file_id\": \"file-abc123\",\n \"endpoint\": \"/v1/chat/completions\"\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/batches")
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 \"input_file_id\": \"file-abc123\",\n \"endpoint\": \"/v1/chat/completions\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "batch",
"endpoint": "<string>",
"status": "validating",
"input_file_id": "<string>",
"output_file_id": "<string>",
"error_file_id": "<string>",
"completion_window": "<string>",
"created_at": 123,
"expires_at": 123,
"request_counts": {
"total": 123,
"completed": 123,
"failed": 123
},
"metadata": {}
}Create a batch job from a JSONL file you already uploaded.
- Upload input JSONL on Upload file or via Quickstart (
purpose=batch). - Paste the returned
file-…id intoinput_file_idbelow. - Set
endpointto/v1/chat/completions(must match every line in your JSONL).
Body
application/json
ID from POST /v1/files with purpose=batch.
Must match the url on every JSONL line.
Available options:
/v1/chat/completions Available options:
24h Optional tags echoed back on retrieve.
Response
Batch accepted
Available options:
batch Available options:
validating, in_progress, finalizing, completed, failed, expired, cancelling, cancelled 
