/api/ai/query
Query an AI model and return the response (requires authentication)
Headers:
Authorization: Bearer ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr...
Request Body:
{
"query": "How can a sinner have peace with God?",
"model": "gpt-4",
"maxTokens": 150,
"temperature": 0.7
}
Request Body Parameters:
query (required) - The query/prompt to send to the AI model (max 5000 characters)model (optional) - The AI model to use (default: "gpt-4")maxTokens (optional) - Maximum tokens for the response (default: 150)temperature (optional) - Temperature for response generation, between 0 and 1 (default: 0.7)Response (200 OK):
{
"query": "How can a sinner have peace with God?",
"answer": "According to the Bible, sinners can have peace with God through faith in Jesus Christ. Romans 5:1 states, 'Therefore, since we have been justified through faith, we have peace with God through our Lord Jesus Christ.'",
"model": "gpt-4",
"sources": [
{
"book": "Romans",
"chapter": "5",
"verse": "1",
"reference": "Romans 5:1",
"text": "Therefore, since we have been justified through faith, we have peace with God through our Lord Jesus Christ"
},
{
"book": "Ephesians",
"chapter": "2",
"verse": "8-9",
"reference": "Ephesians 2:8-9",
"text": "For it is by grace you have been saved, through faith—and this is not from yourselves, it is the gift of God—not by works, so that no one can boast"
}
]
}
Error Responses:
{
"message": "User not authenticated"
}
{
"message": "Missing required field: query"
}
{
"message": "Query is too long. Maximum length is 5000 characters."
}
Notes:
query - The original query that was submittedanswer - The AI-generated response to the querymodel - The AI model that was used to generate the responsesources - Array of biblical references that support the answer, each containing:
book - The book name (e.g., "Romans", "Ephesians")chapter - The chapter numberverse - The verse number or rangereference - Full reference string (e.g., "Romans 5:1")text - The actual text of the verse or passage