Task 09 — Wire embeddings
Depends on: 06
Unblocks: 11
Goal
Embedding calls record usage_events rows with endpoint = 'embeddings'.
Scope
In src/services/copilot/create-embeddings.ts and the embeddings route
handler:
recordUsage with:
endpoint = 'embeddings'
upstreamFormat = 'openai'
isStreaming = false
usage = normalizeEmbeddings(response.usage)
- Output / reasoning / cached input columns are zero by definition.
Pricing for embedding models reuses model_pricing.input_per_mtok. No new
columns.
Definition of Done
Task 09 — Wire embeddings
Depends on: 06
Unblocks: 11
Goal
Embedding calls record
usage_eventsrows withendpoint = 'embeddings'.Scope
In
src/services/copilot/create-embeddings.tsand the embeddings routehandler:
recordUsagewith:endpoint = 'embeddings'upstreamFormat = 'openai'isStreaming = falseusage = normalizeEmbeddings(response.usage)Pricing for embedding models reuses
model_pricing.input_per_mtok. No newcolumns.
Definition of Done
/v1/embeddingsrequest produces a row withendpoint = 'embeddings',output_tokens = 0, andinput_tokens > 0.usage_dailyaggregates separately fromchat.completionsfor thesame model (different
endpointPK component).docs/tasks/09-wire-embeddings.mddocs/design/