Compile
Compilation turns uploaded source texts (documents and threads) into a face.A document is the face’s own writing. An exchange between speakers is a thread.
Upload interviews, transcripts and dialogues as a thread with
face_speaker set, so only the face’s turns are used. A labelled dialogue uploaded as a
document is read as entirely the face’s own words, other speakers included. Saving one
returns a looks_like_transcript warning.Document types
Documents
A document is the face’s own writing: an essay, letter, paper, book, journal entry or poem. A document has a single author by design, and every word in it is read as the face’s. Writing about the face by someone else, such as a biography, can also be uploaded as a document, withperspective=third-person.
Threads
A thread is an exchange between speakers: an interview, a transcript, a dialogue or a conversation. Upload it withface_speaker naming the face, and only the face’s turns are used. A thread has no medium until you set one, for example conversation; until then it does not count toward a style.
Compiling a document
Compile a document with a single call to/make. It returns 202 immediately and compiles in the background:
/make on a source already compiled at its current revision is a 409, and
nothing is charged:
POST …/reset it.
When a compile starts
A compile starts at once, or later, at a scheduled start. Both/make responses and every
compile status (the full GET, ?status_only=true, the status lists and the thread
responses) say which:
To start now rather than at the scheduled start, send
{"rush": true}:
rush: false. Threads take the same body at POST /v1/compile/threads/{id}/make.
A compile already queued can be rushed too: send {"rush": true} to its /make and it
starts now. The answer is 202, like any /make, and the rush is billed as if it had been
asked for up front. Without credit enough for it, the answer is 402
insufficient_credit_for_rush and the compile stays queued, unchanged. Asking again on a
rush answers the same and charges nothing more. Once the compile has started it is too late:
/make without rush on a queued compile is still a 409.
Declaring what a document is: required to save
medium tells us what sort of writing the document contains, and a document can’t be
saved without one:
POST /v1/compile/documents, POST /v1/faces/{alias}/upload
with type=document, and POST /v1/faces/{alias}/import with type=document all answer
422 without one, naming the accepted values:
PATCH with "medium": null on a
document that has one is a 422.
25 values, spelled exactly, listed with what each covers by
GET /v1/media:
keynote, transcript, sms and
article are each a 422 naming all 25. A subcategory is not a medium: a keynote is a
speech, an SMS a text message.
" ESSAY " is essay.
other: writing that is not one of the named forms
Every other value is a specific form. other is for the case none of them fit: a few paragraphs someone wrote that are not an email, an essay, a lecture or a
legal document. It is a declaration by the author, and it compiles.
What a source filed this way is read as: prose with no form-specific
conventions assumed. Its style is kept under other like any other medium.
other is never chosen for you. Chat chooses a medium for each request and never
chooses other, so an other style is not applied on chat.other is not a home for forms this product does not yet name. If you need one of those, ask for
it rather than working around it.
medium works on file uploads too:
type=document only. The structured types (thread, thread_json,
email_jsonl) carry a kind per message derived from the file itself; sending medium with those returns 422.
medium can be changed later with PATCH /v1/compile/documents/{id}, which applies
from the next compile.
Correcting what a thread is
A thread created from a bulk upload carries the medium its messages declared. When that is wrong (a talk that arrived looking like a conversation, an SMS export), set it on the thread:{"label": …}, {"medium": …} or both are each valid, and
{"medium": null} clears the correction. The thread list, the thread GET and a
messages PATCH each carry both values:
Polling for progress
PollGET /v1/compile/documents/DOC_ID every 2-3 seconds:
status
Treat a value you do not recognise as
compiling.
progress runs from 0 to 1. It is 1 only when status is compiled, and 0 while
queued or not_compiled.
A temporary failure does not end in failed: the compile goes back to queued and
resumes on its own, keeping what it has done. You do not need to call /make again.
finishing: the one field to branch on
Branch on
finishing first, and read status only when it is false.
finishing is reported on every source-state response: the document and thread GET
endpoints, the thread list, and both upload responses.
Progress fields
Your compile allowance or credits are charged when the compile completes.
Can this be compiled at all?
Two fields on every source row, detail, upload and import response say whetherPOST …/make would be accepted, and which rule refuses it if not. An upload or import reports
the same values a later ?status_only=true read does. Draw your compile control from these
rather than from a count of your own:
A reason is present exactly when
compilable is false, so compilable alone is
enough to decide whether to offer the action; the code is for the sentence you write.
While an audio or video upload is still transcribing, it reads as not yet compilable:
no_user_messages for a thread, empty for a document.
make enforces exactly these, and refuses with a 400 carrying the same code in
detail.error_code.
Every document response carries word_count and compile_min_words (currently 50;
null when no minimum applies), and a too_short refusal carries both next to
error_code, so a client can show “38 / 50 words”. More codes
may be added, so treat a code you do not recognise as “cannot be compiled”.
Warnings
Saving a document’s text returnswarnings, a list of {code, message} entries, empty
when there is nothing to report. It comes back from POST /v1/compile/documents,
PATCH /v1/compile/documents/{id} when content changes, and
POST /v1/faces/{alias}/upload with type=document. A warning never blocks the save.
message, and offer to upload the file again as a thread, then delete the
document. A URL import fetches its text after the
response, so it carries no warning: import an interview page with type=thread. New codes
may be added; show the message of any you do not recognise.
There is no minimum number of messages or replies. A thread with one user
message compiles. If your product wants a higher bar before offering the control,
that is yours to set.
compilable is not. It does not say a compile would change anything:
that is synced and the revision pair below, and a source whose text was rewritten is
compilable: true and out of date.
Nor does it cover transient refusals: a compile already running, a locked face, or an
empty credit balance are refused by other means (409, 409, 402) and are not
properties of the source. finishing already answers
the first.
Is what the face knows still current?
synced says a compile ran. It does not say what it ran on, so these four fields
answer “I edited this, does the face know?” with no state kept on your side.
Source-level:
synced_version < version means the text has moved since the
compile, and the gap says by how many revisions.
Message-level, threads only: a message whose timestamp is later than the
thread’s synced_at is one the compile never read:
version: editing a message, adding or removing one, and
reordering them.
What does not: renaming the thread, changing its medium, or sending the messages back
unchanged. An unchanged write is not a revision and moves no timestamp.
The list is written back with PATCH /v1/compile/threads/{id}/messages and
{"messages": [...]}. Each message takes role, content and an optional name,
the speaker label. A message carrying from is refused with 422:
`from` is no longer accepted; use `name` for the speaker label.
Controlling compilation
Pause and reset work on documents too (
/compile/documents/{id}/pause and /reset).
Pause is a request, not an immediate stop
A pause can take a few seconds. Poll untilstatus is paused:
/make carries on from where it stopped, so work already done is not paid for
twice. Reset stops a running compile the same way, and clears its progress.
Lightweight polling
?status_only=true returns the polling fields without the document’s content or the
thread’s messages:
synced, version, synced_version, synced_at, compilable,
compile_blocked_reason, starts_at, rush and rush_premium_usd, the same values as the full GET, so you
never need the full GET to learn what was compiled. Poll this; fetch the full GET for the body.
Every source on a face
To read the state of all of a face’s sources in one call, use the status lists. Each returns one status object, as above, per source:include_uploads as the thread list does. The full lists
(GET /v1/compile/documents, GET /v1/compile/threads) refuse status_only, include
and fields with a 422 naming the status route.
Is anything compiling on this account?
To check every face at once, for a page-load indicator or a badge, use the activity route instead of the two lists:progresscan benullfor a face, or for the account, when it cannot be measured;measurablesays so. Then show an indicator that claims no fraction.- Paused sources are in
paused, one entry each withalias,id,kind,label,status: "paused",progressandstall_reason. They are in no count and noprogress. Resume one withPOST …/make. faceslists only faces with work in progress, not the account’s faces.
faces exactly when its finishing
is true.
Each source also carries starts_at, rush and rush_premium_usd, as on its
status.
Listing documents
Deleting a document
basic_facts. Every compile adds to them, and you
can edit them, so a delete cannot tell what a source wrote from what you did, and leaves them
as they are. Keep them current yourself with PATCH /v1/faces/{alias}.
Read-only documents and threads
Some documents and threads are read-only. A read-only item is frozen: you can read it, but its contents can’t be changed. Every document and thread response includes aread_only field. It defaults to false; when it’s true, the item is locked:
Attempting to edit a locked item returns
409 with a message explaining why:
read_only field before offering edit actions in a UI; deletion stays available even when an item is locked.
Uploading threads
A thread is an exchange between speakers. Interviews, transcripts and dialogues are uploaded as threads, never as documents. Upload a text file withSpeaker Name: message format:
type=thread and face_speaker to specify which speaker is the face:
face_speaker parameter maps that speaker to role=user (the face’s voice). All other speakers become role=assistant, and only the face’s turns are used. If omitted, the first speaker is assumed to be the face, so always set it.
Once uploaded, compile the thread with /make (fire-and-forget, the same as a document):
status, progress and finishing.
Audio/video threads
Audio and video files uploaded withtype=thread are transcribed automatically with speaker diarization. The upload returns 202 immediately; transcription runs in the background.
Poll GET /v1/compile/threads/THREAD_ID until status changes from transcribing to not_compiled (ready to review). Speakers are labeled automatically (Speaker A, Speaker B, etc.). Use face_speaker=A to map the correct speaker.
.txt) are processed synchronously and return 200 with the full transcript immediately.
Interview threads
An interview thread is a live conversation where an AI interviewer asks questions, and the answers are compiled into the face. Threads are created and advanced via the compile threads API:/make is the only compile call, for interview threads too. Both POST calls return
the thread’s compile status and progress, as its GET does.
Slow calls are held open
Starting a thread, sending a message andPOST …/reset (documents and threads) can be
slow. Past about 40 seconds, the response is a 200 with the header X-Headwaters-Held: 1,
and whitespace before the JSON. Parse the body as usual. A failure after that point comes
back inside the 200 as an error body, with detail and an OpenAI-style error object
carrying the real status. When X-Headwaters-Held is set, check for error first. Set a
client timeout of at least 60 seconds.
Interviewer billing source
Interview threads use an LLM to generate interviewer questions. How this is paid for depends on your plan and can be controlled per-request:
Default behavior (auto):
oauth when the account has a linked OpenAI account, otherwise credits.
Explicit override: Pass interviewer_billing_source in the request body to force a specific source:
400. oauth without a linked account also returns 400.
The response includes interviewer_billing_source (which path was used) and tokens_charged (compile tokens consumed for this message).
If no payment source is available, the endpoint returns 402 with a structured error indicating whether the user needs to connect their OpenAI account, add credits, or both.
Compile allowance
Connect and Pro include a monthly compile allowance, counted in source tokens (see What a compile costs below). It is shared across all faces in your account. Read what is left from your subscription:allowances.compile_month carries limit, used, remaining and resets_at.
allowances is null on the Free plan, which has no allowance and pays per token. See
Allowances.
Compile, upload and thread responses carry the same allowance as tokens_used and
tokens_limit: tokens_used is the source tokens compiled in the current subscription
window, and tokens_limit is the plan’s monthly compile allowance
(allowances.compile_month.limit). tokens_limit is 0 on a plan with no allowance (Free
pays per token) and -1 when unlimited.
What a compile costs
A compile is counted by its source tokens, each time it runs (a recompile after an edit counts again):- Connect and Pro: covered by the monthly compile allowance (250k / 1M source tokens).
Past it,
api_fallbackon pays from credits at $25 per million source tokens;api_fallbackoff refuses the compile with429before it starts. The message names the reset date. - Free: $25 per million source tokens, from credits. With no credit,
402. - Rush: paid as you go (Free, or past the allowance with
api_fallbackon), a rush is billed at the rush rate instead of the standard one. Covered by the allowance, the allowance covers the standard rate and the rush adds the difference, paid from credit. Without credit enough for it,/makeanswers402before anything is queued, with the amount inrush_premium_usd. Compiling withoutrushis never refused for this.
compile.usd_per_million_source_tokens and
compile.rush_usd_per_million_source_tokens in GET /v1/rates,
and input_cost_per_million_tokens and rush_input_cost_per_million_tokens on
faces-compile-latest in GET /v1/models?kind=compile.
See Allowances.
Uploading large files
Text, PDF, and Word (.docx) files can be uploaded directly; their text is read out for you. Audio and video files are transcribed before compilation; the transcription counts against your credit balance, not your compile allowance.
For batch imports, consider using the import endpoint or the upload endpoint in a loop.