Inferencia LLM con recibo
curl --request POST \
--url https://api.truthlocks.com/v1/orchestrate/llm/inference \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"prompt_hash": "<string>",
"provider": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
model_id: '<string>',
prompt_hash: '<string>',
provider: '<string>'
})
};
fetch('https://api.truthlocks.com/v1/orchestrate/llm/inference', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/orchestrate/llm/inference"
payload = {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"prompt_hash": "<string>",
"provider": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/orchestrate/llm/inference"
payload := strings.NewReader("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"<string>\",\n \"prompt_hash\": \"<string>\",\n \"provider\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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))
}{
"response": "<string>",
"receipt_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tokens_used": 123,
"cost": 123
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Orquestaciones y flujos de trabajo
Registrar inferencia LLM
Registre una llamada de inferencia LLM dentro de una orquestación para el seguimiento de costos y la auditoría de procedencia.
POST
/
v1
/
orchestrate
/
llm
/
inference
Inferencia LLM con recibo
curl --request POST \
--url https://api.truthlocks.com/v1/orchestrate/llm/inference \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"prompt_hash": "<string>",
"provider": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
model_id: '<string>',
prompt_hash: '<string>',
provider: '<string>'
})
};
fetch('https://api.truthlocks.com/v1/orchestrate/llm/inference', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/orchestrate/llm/inference"
payload = {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"model_id": "<string>",
"prompt_hash": "<string>",
"provider": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/orchestrate/llm/inference"
payload := strings.NewReader("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"model_id\": \"<string>\",\n \"prompt_hash\": \"<string>\",\n \"provider\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<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))
}{
"response": "<string>",
"receipt_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tokens_used": 123,
"cost": 123
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Registra una llamada de inferencia LLM individual que ocurrió dentro de una orquestación en ejecución. Cada registro de inferencia captura el modelo, el proveedor, los recuentos de tokens, la latencia, el costo y los hashes de contenido, lo que permite una atribución de costos detallada y una auditoría de procedencia de cada decisión de IA.
Este punto final es llamado por los tiempos de ejecución del agente después de que cada llamada a la API de LLM se completa. El registro de inferencia está vinculado a la orquestación principal y se incluye en el recibo final del registro de transparencia.
Respuesta
Cuerpo
application/json

