Documentation Index
Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Summary
Goal: Generate direct UI links to specific model executions in Braintrust when using the AI Proxy without the SDK.
Features: Project Logs API, permalink URL construction, event ID retrieval.
Configuration Steps
Step 1: Fetch log events
Call the Project Logs API endpoint with your project ID to retrieve log events.
const projectId = "your-project-id";
const apiKey = "YOUR_API_KEY";
let events = [];
try {
const response = await fetch(
`https://api.braintrust.dev/v1/project_logs/${projectId}/fetch`,
{
method: "GET",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
}
);
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
const data = await response.json();
events = data.events ?? [];
} catch (error) {
console.error("Failed to fetch project logs:", error);
}
Each event in the response contains an id field needed for the permalink.
for (const { id: eventId, span_attributes } of events) {
const eventName = span_attributes?.name;
console.log(`${eventName}: ${eventId}`);
}
Step 3: Build permalink URL
Construct the UI link using the project ID and event ID.
function buildPermalink(projectId, eventId) {
const APP_URL = "https://www.braintrust.dev";
const ORG_NAME = "your-org-name";
return `${APP_URL}/app/${ORG_NAME}/object?object_type=project_logs&object_id=${projectId}&id=${eventId}`;
}
const permalink = buildPermalink(projectId, eventId);
console.log(permalink)