SPB Git

spb/llmindex Public

The discriminative, contamination-resistant, fully transparent LLM ranking — updated live.

TypeScript 77.9% TeX 15.2% Python 3.7% SQL 1.4% JavaScript 1.1% Shell 0.5%
1.6 KB · 68 lines typescript
Raw Blame History
1/**2 * llmindex.io — OpenRouter API types3 * Author:  Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * License: Proprietary — © Simon-Pierre Boucher, all rights reserved6 */78export type ContentPart =9  | { type: 'text'; text: string }10  | { type: 'image_url'; image_url: { url: string } };1112export interface ChatMessage {13  role: 'system' | 'user' | 'assistant';14  content: string | ContentPart[];15}1617export interface ChatRequest {18  model: string;19  messages: ChatMessage[];20  temperature?: number;21  max_tokens?: number;22  seed?: number;23  top_p?: number;24}2526export interface Usage {27  prompt_tokens: number;28  completion_tokens: number;29  total_tokens: number;30}3132export interface ChatCompletionResponse {33  id: string;34  model: string;35  choices: Array<{36    index: number;37    message: { role: string; content: string | null };38    finish_reason: string | null;39  }>;40  usage?: Usage;41}4243/** USD per 1M tokens; used for cost tracking on each call. */44export interface Pricing {45  promptPerM: number;46  completionPerM: number;47}4849export interface ChatResult {50  /** Assistant text (first choice), '' if empty. */51  text: string;52  raw: ChatCompletionResponse;53  usage: Usage | null;54  latencyMs: number;55  /** Computed from usage × pricing when pricing is provided. */56  costUsd: number | null;57  /** Exact request params sent (audit trail). */58  requestParams: ChatRequest;59}6061export interface ORModel {62  id: string;63  name: string;64  context_length?: number | null;65  pricing?: { prompt: string; completion: string } | null;66  architecture?: { modality?: string | null; input_modalities?: string[] | null } | null;67}68