/** * Helicone's request export, read as a usage log. * * The third converter in the pattern `from-claude-code` started: a pure * function turns one tool's export into Trazum's usage-log records, and every * door prices it from there. Helicone sits as a proxy in front of the provider * and keeps every request it saw, so a team using it already has the export. * * **The format is derived, not guessed.** The columns below are the SELECT * that builds Helicone's own request table — `web/lib/api/request/request.ts` * in Helicone/helicone — and the response shape its `POST /v1/request/query` * endpoint documents. A converter written from memory of an API is a converter * that silently mis-reads somebody's bill. * * ## The model, and why it takes three columns to answer * * Helicone carries `request_model`, `model_override` and `response_model`, and * they can disagree: the override exists precisely because a proxy can send a * different model than the caller asked for, and the response says what * actually answered. **The response wins**, then the override, then the * request — the bill is about what was billed, not what was intended — and * `modelDisagreements` counts the rows where they differed so a reader can see * the substitution happened rather than discover it in a total. * * ## What deliberately does not cross * * A Helicone row carries the request body and the response body — the prompt * and the completion — and `request_user_id`, which is an email address in * Helicone's own documented example. **None of it is read.** The converter * names the fields it takes and takes nothing else, and a fixture plants a * marker in each and greps the whole output. * * ## What it refuses to invent * * There is no cache-token split anywhere on the row: `cache_enabled` is a flag * on the analytics table. A converted record therefore carries no cache fields * and the caching questions come back `cannot-tell` rather than answered from * a guess — the same refusal `from-otel` and `from-litellm` make. * * There is no conversation identity either. `request_id` is one call, so the * records carry no `session` and the conversation-shaped findings stay * unavailable. A custom property can carry one, and then it is there because * the operator put it there — never because this file inferred it. */ /** One converted record, shaped exactly as `parseUsageLine` reads it. */ export interface HeliconeRecord { model: string; ts?: string; label?: string; usage: { input_tokens: number; output_tokens: number; }; } export interface HeliconeConversion { records: HeliconeRecord[]; /** Rows that were requests and converted. */ rows: number; /** Rows naming no model in any of the three columns: counted, never guessed. */ unnamedModel: number; /** * Rows where the model that answered was not the model that was asked for. * * The response's model is what the bill rests on, and a proxy substituting * one model for another is a fact worth seeing rather than a difference * that only shows up as an unexplained total. */ modelDisagreements: number; /** Rows carrying no token counts at all — a logged request nobody can price. */ noTokens: number; /** Rows Helicone served from its cache, with no token split behind the flag. */ cacheFlagged: number; /** Lines or documents that did not parse as JSON at all. */ unparseable: number; } /** * Convert a Helicone request export. * * Accepts a JSON array of rows, a single row, `{ data: [...] }` as the query * endpoint returns it, or newline-delimited rows. Pure over its input. */ export declare function heliconeRecords(text: string): HeliconeConversion; /** * Whether a file looks like a Helicone request export, by shape. * * Deliberately narrow: a token column beside one of the names only Helicone's * own SELECT produces. A looser test would claim an OpenAI usage response or a * LiteLLM spend log — both of which also carry `prompt_tokens` — and refuse it * in this file's words instead of letting the code that can read it try. */ export declare function looksLikeHelicone(text: string, prefixBytes?: number): boolean; //# sourceMappingURL=helicone.d.ts.map