Observations and derivations API
Kheish exposes a dedicated observation plane for durable captured media and a derivation plane for deterministic secondary artifacts such as canonical text or visual previews.Endpoint inventory
Observation source management:GET /v1/observation-sourcesPOST /v1/observation-sourcesGET /v1/observation-sources/{source_id}
POST /v1/observation-sources/{source_id}/observationsGET /v1/observationsGET /v1/observations/{observation_id}
POST /v1/observation-materializations
GET /v1/derivationsPOST /v1/derivationsGET /v1/derivations/{derivation_id}
Observation sources
POST /v1/observation-sources accepts:
source_iddisplay_namekindupload_tokensensitivityretention_secondsmax_active_observationsmax_active_bytesallow_materializationallow_output_delivery
sensitivity:sensitiveretention_seconds: 7 daysmax_active_observations: 512max_active_bytes: 512 MiBallow_materialization:trueallow_output_delivery:false
source_id is optional:
- when you provide it, the daemon uses it as the stable source identifier
- when you omit it, the daemon generates one server-side
- the returned
ObservationSourceViewdoes not expose the upload token - callers must keep the token client-side after source creation or rotation
screen_snapshotimage/pngimage/jpeg
webcam_snapshotimage/pngimage/jpeg
microphone_segmentaudio/wavaudio/webm
GET /v1/observation-sources supports:
query: substring filter over source id or display name
Upload an observation
The upload route is intentionally outside normal admin auth:POST /v1/observation-sources/{source_id}/observations
- send
Authorization: Bearer <upload_token> - the token is validated against the source-scoped upload secret
upload.file_nameupload.media_typeupload.content_base64idempotency_keycaptured_at_msstream_idseq_nocanonical_textmetadata
- the stable key is
(source_id, idempotency_key) - if the same request fingerprint is replayed, the daemon returns the existing observation
- if the same key is reused with different payload content, the request is rejected
Observation listing
GET /v1/observations supports:
source_idstream_idafter_msbefore_msinclude_purged
stream_idrequiressource_id- combining
source_idandstream_idnarrows the result set to one source stream
ObservationView includes:
observation_idsource_idkindsensitivityretention_stateasset_idcanonical_text_asset_idmedia_typesha256byte_lengthcaptured_at_msreceived_at_msstream_idseq_noidempotency_keyrequest_fingerprintmetadata
Materialize observations into a run
POST /v1/observation-materializations submits a normal daemon run after augmenting an input request with one observation selection.
Request fields:
target_session_idselectionrequestinclude_raw_assetsraw_asset_policyfail_when_empty
requestis a fullSubmitInputRequest- when that nested request uses only
input_items, include"content": ""to match the current request shape
include_raw_assetsdefaults totruefail_when_emptydefaults totruelatest_from_sourceandlatest_from_streamdefaultmax_observationsto3observation_idsmust contain at least one identifiermax_observationsmust be greater than zero
Selection variants
By ids:include_raw_assetsis a legacy boolean fallbackraw_asset_policyis the preferred explicit control:autoneveralways
Derivations
Derivations are deterministic daemon-owned transforms over assets, observations, or persisted session input.GET /v1/derivations supports:
query: substring match over derivation id, profile, subject, or result asset id
Create a derivation
POST /v1/derivations accepts:
profilesubject
canonical_textvisual_preview
canonical_texton microphone observations reuses uploader-supplied canonical text when it already exists- otherwise, when the daemon was started with a transcription backend,
canonical_textperforms daemon-owned speech-to-text and stores the result as one daemon-ownedtext/plainasset - built-in transcription backends currently include OpenAI and OpenRouter
- canonical-text derivation depends on the configured transcription backend, not only on the selected run route
- observation-source uploads remain limited to
audio/wavandaudio/webm, but imported daemon assets and normal session attachments can also derive text from supported formats such asaudio/mpeg,audio/mp4, andaudio/m4a
- asset:
- observation:
- session input:
DerivationView contains:
derivation_idprofilesubjectresult_asset_idreused_subject_assetcreated_at_ms
