Settle a reservation from externally verified token usage
POST
/
api
/
v1
/
admin
/
billing
/
reservations
/
{id}
/
settlement
Settle a reservation from externally verified token usage
curl --request POST \
--url http://127.0.0.1:18000/api/v1/admin/billing/reservations/{id}/settlement \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"input_tokens": 1,
"output_tokens": 1,
"tenant_id": "<string>"
}
'import requests
url = "http://127.0.0.1:18000/api/v1/admin/billing/reservations/{id}/settlement"
payload = {
"input_tokens": 1,
"output_tokens": 1,
"tenant_id": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({input_tokens: 1, output_tokens: 1, tenant_id: '<string>'})
};
fetch('http://127.0.0.1:18000/api/v1/admin/billing/reservations/{id}/settlement', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://127.0.0.1:18000/api/v1/admin/billing/reservations/{id}/settlement"
payload := strings.NewReader("{\n \"input_tokens\": 1,\n \"output_tokens\": 1,\n \"tenant_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"data": {
"actual_microusd": 1,
"binding_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"model": "<string>",
"reserved_microusd": 1,
"resolution": "<string>",
"state": "reserved",
"supplier": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"input_tokens": 1,
"output_tokens": 1
},
"content_recorded": true
}{
"error": {
"code": "<string>",
"message": "<string>",
"category": "<string>",
"remediation": "<string>",
"request_id": "<string>",
"retryable": true
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Stable key used to adopt the original durable operation after retries or disconnects.
Maximum string length:
128Path Parameters
Minimum string length:
1Body
application/json
⌘I
Settle a reservation from externally verified token usage
curl --request POST \
--url http://127.0.0.1:18000/api/v1/admin/billing/reservations/{id}/settlement \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"input_tokens": 1,
"output_tokens": 1,
"tenant_id": "<string>"
}
'import requests
url = "http://127.0.0.1:18000/api/v1/admin/billing/reservations/{id}/settlement"
payload = {
"input_tokens": 1,
"output_tokens": 1,
"tenant_id": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({input_tokens: 1, output_tokens: 1, tenant_id: '<string>'})
};
fetch('http://127.0.0.1:18000/api/v1/admin/billing/reservations/{id}/settlement', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://127.0.0.1:18000/api/v1/admin/billing/reservations/{id}/settlement"
payload := strings.NewReader("{\n \"input_tokens\": 1,\n \"output_tokens\": 1,\n \"tenant_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"data": {
"actual_microusd": 1,
"binding_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"model": "<string>",
"reserved_microusd": 1,
"resolution": "<string>",
"state": "reserved",
"supplier": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"input_tokens": 1,
"output_tokens": 1
},
"content_recorded": true
}{
"error": {
"code": "<string>",
"message": "<string>",
"category": "<string>",
"remediation": "<string>",
"request_id": "<string>",
"retryable": true
}
}