Skip to content

AI Assistant API

The AI Assistant API provides a chat endpoint for AI-powered analysis of workbook data.


Overview

CalcBridge's AI assistant provides:

  • Natural Language Chat: Ask questions about your data in plain English
  • Context-Aware: Understands workbook structure and financial terminology
  • PII Scrubbing: Sensitive data is sanitized before AI processing

Endpoints

Chat with AI Assistant

Send a message to the AI assistant and receive a response.

POST /api/v1/ai/chat

Request Body

Field Type Required Description
query string Yes User message (min 1 character)
context object No Additional context for the query

Example Request

curl -X POST "https://api.calcbridge.io/api/v1/ai/chat" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What is the total par value of CCC-rated loans in my portfolio?",
    "context": {
      "workbook_id": "550e8400-e29b-41d4-a716-446655440000"
    }
  }'
response = requests.post(
    "https://api.calcbridge.io/api/v1/ai/chat",
    headers={"Authorization": f"Bearer {token}"},
    json={
        "query": "What is the total par value of CCC-rated loans?",
        "context": {"workbook_id": workbook_id}
    }
)
answer = response.json()
print(answer["content"])

Response

{
  "id": "msg_abc123",
  "role": "assistant",
  "content": "Based on the holdings in your CLO Portfolio Q1 2026 workbook, the total par value of CCC-rated loans is $12,500,000, representing 2.8% of total portfolio par.",
  "timestamp": "2026-01-25T10:30:00Z",
  "metadata": {
    "workbook_id": "550e8400-e29b-41d4-a716-446655440000",
    "data_points_referenced": 3
  }
}

Security

  • All user data is scrubbed of PII before being sent to the AI model
  • Responses are sanitized to prevent information leakage
  • Chat history is stored per-session and not shared across tenants

Limitations

  • Maximum query length: 1000 characters
  • Responses are informational and should not be used as sole decision-making input
  • Complex multi-step analyses may require multiple queries