Style
All source texts are labeled with a medium: the kind of writing they are. There are 25, each with a description and the subcategories it covers, listed byGET /v1/media: email, essay, speech, journal entry, script and so on.
A style build reads a face’s own writing in one medium and installs a style for it, so
the face writes better in that medium. A face holds a separate style for each medium.
You may not need to call it at all. Once a face has enough of its own writing in a
medium, a build runs for that medium automatically. This is on by default on Connect
and Pro, and off on Free. See Automatic builds.
1. Give the face something to read
Two shapes, by what the material is.A single piece of writing
medium: what the file is: one of the namesGET /v1/medialists.perspective:first-personif the subject wrote it,third-personif it is about them. Third-person writing never contributes to a style. It defaults tothird-persononPOST /v1/faces/{alias}/uploadand tofirst-persononPOST /v1/compile/documents, so set it explicitly. A build whose sources are all third-person is refused (see below).
type=thread and face_speaker, so only the face’s turns are used. See
Uploading threads.
Many messages in one file
For a mailbox or transcript export, upload the whole thing:thread_ids and their number in thread_count, plus
skipped itemising any message that failed validation. Lenient by default: a malformed row
is skipped and the rest are kept. Pass ?strict=true to make it all-or-nothing, a 422 on
the first bad row.
Each reason, skipped or 422, names every problem with its row at once. An unknown
field is answered with the list of fields a row accepts. body and text are read
as plaintextBody.
A bulk upload takes no
medium: each message declares its own, and sending one returns
422. Correct a thread afterwards with the PATCH below.Correcting what a thread is read as
Uploaded material is grouped by the medium its messages declared. When that is wrong (a talk that arrived looking like a conversation, an SMS export), set it directly:{"label": …}, {"medium": …} or both. Sending
{"medium": null} clears the correction.
Each row from GET /v1/compile/threads carries two fields:
2. Build
202 and a job_id.
sources is required. Each source’s source_type is "thread" (the default) or
"document". Each source may declare its own medium; omit it and the source’s own
declaration is used: a document’s stored medium, or a thread’s. A source that has never
declared one is refused.
model is optional. It defaults to gpt-6-luna, and a model you name is used only on a
linked ChatGPT plan. See What a build costs. By default, sources with uncompiled
material are compiled first (compile: true), billed as ordinary compiles; send
"compile": false to skip that.
Each medium’s style is built separately, so an essay never contributes to how the face
writes email. One face can hold a style for several media at once.
Poll it
done or failed. On failure, error says what to do: top up, reconnect,
or fix the input. It never contains internal detail; if you see any, that is a bug
worth reporting with the job id.
The job also reports what it is building, from the very first poll: media is
the set of media it was started for, and medium is the single value when there is
exactly one, null when the job spans several.
Lost the job id
job_id.
One build at a time per medium
Starting a build for a face and medium that already has one running is refused with409 build_in_progress, and the refusal names the running job:
job_id instead of retrying. This is checked before anything is spent.
What the finished report tells you
Adone job’s report includes:
A manual build has no minimum size. It runs on whatever you name, and
thin_corpus is how it tells you the sample was small.
Automatic builds
A face’s style is built for a medium without anyone asking, once there is enough of the face’s own writing in that medium.- What counts. Only words the face itself wrote: its own messages in uploaded
message threads, and documents that are
first-personor have no perspective set. Writing about the face never counts. Email and text message count only from uploaded message threads (email_jsonl,jsonl,thread_json), not from documents. - When. The first build runs when the face’s writing in a medium passes the threshold. After that, a build runs again only at twice the threshold, then three times, and so on. A multiple is built once: deleting material and adding it back does not repeat it. A multiple whose build failed is tried again on a later check, no sooner than an hour after the failure.
- What triggers the check. A compile finishing, and a message-thread upload
(
email_jsonl,jsonl,thread_json) arriving. A transcript uploaded withtype=thread, and an interview thread, have no medium until you set one, and do not count until then. - It goes live at once. An automatic build installs immediately, exactly like a manual one. The previous version is kept, and one revert restores it.
- You can see it. It is an ordinary job in
GET /v1/style/builds. Itsreport.autosays why it ran:
The thresholds
Counted in the face’s own words, per medium:other is never built automatically. It still appears in auto_style_thresholds, but
its value is not used.
Turning it on or off, and changing the thresholds
Both are account preferences, so they cover every face the account owns:
The response, and
GET /v1/user/preferences, report the result as it applies to
this account:
auto_styleis the effective answer: is it running for this account right now. Drive a toggle from this.auto_style_settingis what was stored:"on","off", ornullfor “the plan’s default”. It is how you tell “on because you said so” apart from “on because of the plan”.auto_style_thresholdslists every medium, with defaults filled in.
3. Use it
There is nothing to send. On each chat request we read what is being asked for, from the request itself and the reply before it:- when it is one of the media (an email, an essay, a speech, and the rest), the face’s style for that medium is applied, if the face has one;
- when it is none of them (a question, code, a calculation, ordinary chat, or a form not listed), no style is applied, and the face answers in its own terms.
style, medium, kind and register on a request are each a 422: the medium is chosen for
each request, never by the caller. A face with no style for the medium a request is in answers
without one.
4. See what is installed, and undo
active per medium; that is what a face uses for that situation.
can_revert tells you whether an entry has a previous version to fall back to.
Each entry also names the build behind it (sources_printed, how many sources it
read, and job_id, the job itself), so a confirmation can say “back to the style
built on 12 August from 41 sources” rather than a bare “Revert”. Both are null
for older builds, and after a full delete, which removes the build history with it.
409 when there is no earlier version, which is a normal
condition rather than a fault.
A build after a revert keeps the version you reverted to as its previous
version, so reverting and then building again never loses the style you chose to
go back to.
5. Remove it
DELETE /v1/faces/{alias}/corpus (optionally
?medium=). It deletes the threads that came in as corpus uploads, and what each one
contributed to the face, as deleting each thread would. Threads uploaded for compiling are
not part of the corpus and are kept; delete those with DELETE /v1/compile/threads/{id}. It does not touch the style build.
It cannot be undone.
While the face is busy with another change, it answers 409; try again shortly. Threads
it deleted before stopping stay deleted, and a second call finishes the rest. Calling
this on a face that has never had a style built is a 200, not a 404.
Knowing which sources a style has been built from
Thread and document listings carry astyle stamp per source: when a style was last
built from it, and as what:
null when no style has been built from that source. Each build overwrites it, so it
records the latest build.
Knowing which faces have a style
Every face carriesstyles, the media it has a built style for:
What a build costs
On Connect or Pro with a linked ChatGPT account, a build runs on that account and is not billed. That holds for the default model and for any Codex-eligible model you name. Every other build runs ongpt-6-luna, whatever model names, and is charged to
credits at gpt-6-luna’s price in GET /v1/models plus
the published markup. This applies on every plan, to automatic builds as well as manual ones:
A build that loses the link partway (an expired sign-in, or the plan’s usage limit) carries
on with
gpt-6-luna, and only the part the link did not run is charged. A build typically
costs a few cents per medium. What it spent appears in
GET /v1/billing/usage under gpt-6-luna, with the build’s job_id.
A build that will be charged is refused up front when the balance cannot cover its
estimate. Nothing is started or charged:
estimated_usd is the most the build is expected to cost, from the size of its sources.
An automatic build that credit cannot cover is not started: it appears in
GET /v1/style/builds as a failed build with error_code: "insufficient_credit_for_style_build", and is tried again later. Top up to let it run.
The finished report’s served_by says where it ran:
Compiling uncompiled sources first (
compile: true) is billed separately, as an ordinary
compile.
oauth_only
oauth_only defaults to false. Send oauth_only: true to mean “the linked ChatGPT
account or nothing, never charge”:
- A build that cannot run on the link (no account linked, or a model that is not
Codex-eligible):
409 chatgpt_not_linked, before a job exists. - The link fails partway: the build stops instead of being charged. Reconnect, then build again.
- On Free:
422 oauth_only_unavailable, and nothing is charged.
codex_eligible in GET /v1/models.
Failures worth handling
All of these come back before a job exists: you get an error and nojob_id,
and nothing has started.
409 is the only one worth retrying automatically, and only after a delay.