velho

Helix client

A lightweight REST wrapper for Twitch Helix endpoints with typed methods, Zod validation, and rate-limit awareness.

Typed methods, Zod schema validation, automatic 401 retries, and rate-limit awareness ship out of the box.

import { HelixClient, HelixRequestError } from "velho";
import { z } from "zod";

const helix = new HelixClient({ clientId: "...", auth });

const channelsSchema = z.object({
  data: z.array(
    z.object({
      broadcaster_id: z.string(),
      broadcaster_name: z.string(),
      broadcaster_language: z.string(),
    })
  ),
});

try {
  const response = await helix.get("/channels", {
    query: { broadcaster_id: ["123456"] },
    schema: channelsSchema,
  });

  console.log(response.data);
} catch (error) {
  if (error instanceof HelixRequestError) {
    console.error(error.status, error.message);
  }
}
  • Methods mirror HTTP verbs: get, post, patch, put, delete.
  • Zod schemas enforce response shapes and surface parsing errors early.
  • Rate-limit headers parse into HelixRateLimit for observability tooling.