ApiKeyTrendsResponseSchema (apis/schemas.ts)

codex-lb · frontend/src/features/apis/schemas.ts · typescript · MIT
database, tag:embed-classified

Zod schemas for API key usage and trend responses.

// Source: https://github.com/Soju06/codex-lb | License: MIT | Copyright 2025 Soju06
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from "zod";

const ApiKeyTrendPointSchema = z.object({
  t: z.iso.datetime({ offset: true }),
  v: z.number(),
});

export const ApiKeyTrendsResponseSchema = z.object({
  keyId: z.string(),
  cost: z.array(ApiKeyTrendPointSchema),
  tokens: z.array(ApiKeyTrendPointSchema),
});

const ApiKeyAccountCostSchema = z.object({
  accountId: z.string().nullable().default(null),
  email: z.string().nullable().default(null),
  costUsd: z.number().default(0),
  isDeleted: z.boolean().default(false),
});

export const ApiKeyUsage7DayResponseSchema = z.object({
  keyId: z.string(),
  totalTokens: z.number().int(),
  totalCostUsd: z.number(),
 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key