Developers Coming soon
Language models trained for studying Scripture.
The Carrell API will give developers access to biblical-1, a set of language models we’re training for Bible study. Our goal is for biblical-1 to be the best model available for Biblical studies.
# Coming soon
curl https://api.carrell.ai/v1/chat/completions \
-H "Authorization: Bearer $CARRELL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "biblical-1",
"messages": [{
"role": "user",
"content": "Explain Romans 8:28."
}]
}'
The gateway
How the gateway handles requests
Requests go to api.carrell.ai, which is a gateway that runs on Cloudflare. The gateway serves the current biblical-1 release, which is built on open-weight models, meaning models whose weights are published. Carrell’s Ask feature uses the same gateway.
- The gateway accepts chat completions, streaming, tool calling and JSON output in the same format as the OpenAI API.
- The gateway adds its own conduct instructions before your system message, and your system message can’t replace them.
- A separate moderation model checks every finished answer before the gateway returns it. If the moderation model blocks an answer, the gateway returns a short refusal instead of the text.
- Each response names the exact model release that wrote it, so you can reproduce results. The gateway logs request IDs, status codes and timing, and it doesn’t log prompts, answers or keys.
Training
How we train the models
General-purpose language models often make mistakes about the Bible. For example, they misquote verses and cite passages that don’t exist. They also present one tradition’s reading as the only one, and they answer confidently when the text doesn’t address the question. We design our training data and our tests to find and correct each kind of mistake.
-
Base model
Each release starts from an open-weight base model. We train an adapter, which is a small set of added weights, on top of the base model, so we can inspect and test the exact weights we serve.
-
Training questions
We write questions about passages in context, comparisons between books, and word studies. The questions also cover passages that traditions read differently, questions the text doesn’t answer, and pastoral questions.
-
Grading and review
We score each candidate answer against a written rubric that checks accuracy, citations, fairness to each tradition, honesty about uncertainty, and safety. A person reviews each answer that passes before we add it to the training data.
-
Separate test set
We keep our test questions, and rewordings of them, out of the training data. Before we release a model, we run it and leading general-purpose models on the same test questions, and people review the answers.
-
Reader feedback
When someone rates an answer down, they can pick a reason, e.g., wrong Scripture, wrong citation, or unfair to a tradition. We review rated answers when we build the next round of training data.
We’ll open the API when a trained release passes its tests. Until then, we won’t issue keys, and we won’t present an untrained model as a Biblical model.
API reference
How the API works
The reference below describes the gateway as it runs today. Some details may change before launch, and we’ll tell people on the waitlist first.
Quickstart
To make a request, point any OpenAI client at https://api.carrell.ai/v1 and set the model to biblical-1.
curl https://api.carrell.ai/v1/chat/completions \
-H "Authorization: Bearer $CARRELL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "biblical-1",
"messages": [
{ "role": "user", "content": "What is the context of Romans 8:28?" }
],
"max_completion_tokens": 512
}'
import OpenAI from "openai"
const carrell = new OpenAI({
baseURL: "https://api.carrell.ai/v1",
apiKey: process.env.CARRELL_API_KEY,
maxRetries: 0, // each attempt uses a credit
})
const answer = await carrell.chat.completions.create({
model: "biblical-1",
messages: [{ role: "user", content: "What is the context of Romans 8:28?" }],
max_completion_tokens: 512,
})
console.log(answer.choices[0].message.content)
import os
from openai import OpenAI
carrell = OpenAI(
base_url="https://api.carrell.ai/v1",
api_key=os.environ["CARRELL_API_KEY"],
max_retries=0, # each attempt uses a credit
)
answer = carrell.chat.completions.create(
model="biblical-1",
messages=[{"role": "user", "content": "What is the context of Romans 8:28?"}],
max_completion_tokens=512,
)
print(answer.choices[0].message.content)
Authentication
Send your API key as a Bearer token on every request except /health. Each key has a rate limit, a number of credits, and permissions that control whether it can list models, create completions and send feedback.
Authorization: Bearer $CARRELL_API_KEY
We aren’t issuing keys yet. Join the waitlist to get one when we are.
Endpoints
| Endpoint | Description |
|---|---|
GET /health | Returns the gateway’s version. It doesn’t need a key. |
GET /ready | Checks the gateway’s configuration and your key, without running a model. |
GET /v1/models | Lists biblical-1 and the release it points to, with the release’s base model and training details. |
POST /v1/chat/completions | Returns an answer, a tool call, or a stream of events. |
POST /v1/feedback | Records a rating for one answer. It stores the conversation only if the user chose to share it. |
Chat completions
POST /v1/chat/completions accepts the OpenAI request body. The gateway rejects fields it doesn’t recognize, so you’ll get an error if you misspell a field name.
| Field | Description |
|---|---|
model | Required. Set it to biblical-1. |
messages | Required. You can start with one system message. After that, user and assistant messages alternate, and tool messages answer each tool call in order. The last message must come from the user or a tool. |
max_completion_tokens | 1 to 4,096, with a default of 1,024. The gateway also accepts max_tokens. |
temperature | 0 to 2, with a default of 0.3. |
stream, stream_options | Returns server-sent events. See Streaming. |
tools, tool_choice | Up to 16 functions. tool_choice can be auto or none. |
response_format | Set it to { "type": "json_object" } for JSON output. The gateway doesn’t support JSON Schema. |
{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "biblical-1-…",
"choices": [{
"index": 0,
"finish_reason": "stop",
"message": {
"role": "assistant",
"content": "Paul writes Romans 8:28 at the end of a passage about suffering…"
}
}],
"usage": { "prompt_tokens": 1180, "completion_tokens": 214, "total_tokens": 1394 }
}
If the moderation model blocks an answer, the response has finish_reason: "content_filter" and a short refusal instead of the text.
Streaming
When you set "stream": true, the gateway returns standard OpenAI chunks and ends with data: [DONE]. The gateway waits for the whole answer and its moderation check before it sends the first chunk, so streaming doesn’t make the first words arrive sooner. The x-moderation-mode: buffered header tells clients about the wait.
Tool calling
You can give the model functions to call, e.g., one that fetches a passage, and your code runs them. When the model calls a tool, the response has finish_reason: "tool_calls", and you send each result back in a tool message. The gateway doesn’t check the arguments, so your code should validate them.
{
"model": "biblical-1",
"messages": [{ "role": "user", "content": "Compare John 1:1 with Genesis 1:1." }],
"tools": [{
"type": "function",
"function": {
"name": "get_passage",
"description": "Returns the text of a Bible reference.",
"parameters": {
"type": "object",
"properties": { "reference": { "type": "string" } },
"required": ["reference"]
}
}
}]
}
If the model writes a malformed call, or calls a tool you didn’t send, the gateway returns HTTP 503 with the code invalid_tool_call. You can retry the request, and each retry uses a credit.
Feedback
POST /v1/feedback rates one answer, which you identify by its x-request-id. Feedback requests are free. The gateway stores the conversation only when share_conversation is true, and it deletes stored feedback after 180 days.
{
"request_id": "chatcmpl-…",
"rating": "down",
"reasons": ["wrong_citation"],
"comment": "Quoted Psalm 23:4 as verse 5.",
"share_conversation": false
}
The reasons you can send are wrong_scripture, wrong_citation, unfair_to_a_tradition, unsupported_claim, unhelpful, unsafe, formatting and other. If you rate the same answer twice, the second rating replaces the first.
Response headers
x-request-id | The ID of the answer, which matches the id field in the body. You need it to send feedback. |
x-model-release | The exact release that wrote the answer. |
x-moderation-outcome | approved, blocked, or not_screened. Tool calls aren’t screened, because their arguments go to your code instead of a reader. |
x-moderation-mode | buffered, which means the gateway sends nothing until the answer has been checked. |
Limits and credits
- Each completion attempt uses one credit, including attempts that fail or are blocked after they start. Reads and feedback are free. You should turn off automatic retries in your SDK unless you want to spend credits on them.
- A request can be up to 262,144 bytes, with up to 200 messages and 16 tools.
- The prompt must leave room for the output limit you set. If it doesn’t, the gateway returns
context_length_exceededand doesn’t use a credit. - Each key has its own rate limit. When you go over it, the gateway returns HTTP 429.
Errors
Errors use the same format as OpenAI errors, so the OpenAI SDKs raise their usual exceptions.
{ "error": { "type": "invalid_request_error", "code": "invalid_request", "param": "temperature", "message": "…" } }
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A field is missing, unknown or out of range. The param field names it. |
| 400 | context_length_exceeded | The conversation is too long for the output limit you set. |
| 401 | invalid_api_key | The key is missing, invalid, disabled or expired. |
| 403 | permission_denied | The key doesn’t have the permission the endpoint needs. |
| 404 | model_not_found | The model doesn’t exist. |
| 413 | request_too_large | The request body is over the size limit. |
| 429 | rate_limit_exceeded | The key has reached its rate limit. |
| 429 | insufficient_quota | The key has no credits left. |
| 503 | model_not_ready | No trained release is available yet. The gateway returns this error today. |
| 503 | invalid_tool_call | The model wrote a tool call that can’t be used. |
Questions
Common questions
When can I get a key?
We’ll issue keys when the first trained release passes its tests. We don’t have a date yet, and we’ll email the waitlist first.
What will it cost?
Each key will come with credits, and each completion attempt will use one credit. We’ll publish prices before we issue keys.
Will you train on what I send?
No. The gateway doesn’t store requests, and its logs don’t contain prompts or answers. We only keep conversations that are sent with feedback when share_conversation is true, and we review each one before we use it.
Does it replace a pastor or a commentary?
No. The model cites its sources so you can check them, and you should check its answers against Scripture.
Can I try it now?
Carrell’s Ask feature uses the same gateway, so you can download Carrell and use Ask today.
Join the API waitlist
The Carrell API isn’t available yet. Join the waitlist, and we’ll send you a key when it opens.