Responses
curl --request POST \
--url https://api.example.com/responses \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"tools": [
{}
],
"temperature": 123,
"top_p": 123,
"provider": {}
}
'import requests
url = "https://api.example.com/responses"
payload = {
"model": "<string>",
"input": {},
"tools": [{}],
"temperature": 123,
"top_p": 123,
"provider": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
input: {},
tools: [{}],
temperature: 123,
top_p: 123,
provider: {}
})
};
fetch('https://api.example.com/responses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/responses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'input' => [
],
'tools' => [
[
]
],
'temperature' => 123,
'top_p' => 123,
'provider' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/responses"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {},\n \"tools\": [\n {}\n ],\n \"temperature\": 123,\n \"top_p\": 123,\n \"provider\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}HttpResponse<String> response = Unirest.post("https://api.example.com/responses")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {},\n \"tools\": [\n {}\n ],\n \"temperature\": 123,\n \"top_p\": 123,\n \"provider\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": {},\n \"tools\": [\n {}\n ],\n \"temperature\": 123,\n \"top_p\": 123,\n \"provider\": {}\n}"
response = http.request(request)
puts response.read_bodyAPI Reference
Responses
Create a model response using the Responses API format through the attested Confidential AI gateway.
POST
/
responses
Responses
curl --request POST \
--url https://api.example.com/responses \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"tools": [
{}
],
"temperature": 123,
"top_p": 123,
"provider": {}
}
'import requests
url = "https://api.example.com/responses"
payload = {
"model": "<string>",
"input": {},
"tools": [{}],
"temperature": 123,
"top_p": 123,
"provider": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
input: {},
tools: [{}],
temperature: 123,
top_p: 123,
provider: {}
})
};
fetch('https://api.example.com/responses', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/responses",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'input' => [
],
'tools' => [
[
]
],
'temperature' => 123,
'top_p' => 123,
'provider' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/responses"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {},\n \"tools\": [\n {}\n ],\n \"temperature\": 123,\n \"top_p\": 123,\n \"provider\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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))
}HttpResponse<String> response = Unirest.post("https://api.example.com/responses")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {},\n \"tools\": [\n {}\n ],\n \"temperature\": 123,\n \"top_p\": 123,\n \"provider\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/responses")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"input\": {},\n \"tools\": [\n {}\n ],\n \"temperature\": 123,\n \"top_p\": 123,\n \"provider\": {}\n}"
response = http.request(request)
puts response.read_bodyCreates a model response using the Responses API request and response format. Like other inference endpoints, requests are served through the attested gateway and return an
Read assistant text from
x-receipt-id header for verification.
Endpoint
POST https://inference.phala.com/v1/responses
Request Body
string
required
Model id, for example
z-ai/glm-5.2 or another id returned by List Models.string | array
required
Input prompt. This can be a string or an array of input items.
array
Tool definitions the model may call.
number
Sampling temperature.
number
Nucleus sampling.
object
Routing constraints for this request, applied together. If no provider satisfies the constraints the request fails before the prompt is sent, and failover retries stay inside the allowed set. Field reference: Chat Completions. See Attested Routing and Zero Data Retention.
zdr restricts routing to providers that do not retain content; aci_verified restricts it to an upstream verified inside the TEE; aci_session_ids pins it to specific attested channels.{"provider": {"aci_verified": true}}
Example
curl https://inference.phala.com/v1/responses \
-H "Authorization: Bearer $PHALA_AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "z-ai/glm-5.2",
"input": "Explain attestation in one sentence."
}'
Response
{
"id": "resp_023cda4f5e268c44006a30f3e0b6f4819b87536574ae6ecd14",
"object": "response",
"status": "completed",
"model": "z-ai/glm-5.2",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{ "type": "output_text", "text": "Attestation proves which trusted workload served a request.", "annotations": [] }
]
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 10,
"total_tokens": 22
}
}
output[].content[].text on message items. Reasoning models may also return reasoning items.
Verification
Capturex-receipt-id from the HTTP response and verify it with Get Receipt. The receipt proves the response bytes and records whether the upstream provider was verified.
Related
Chat Completions
Verify a Response
Was this page helpful?

