# @typia/utils

> Superfast runtime validators with only one line

Latest version **14.0.6** (published 2026-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @typia/utils
pnpm add @typia/utils
yarn add @typia/utils
bun add @typia/utils
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 14.0.6 |
| Published | 2026-09-09 |
| First published | 2026-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5912 |
| Author | Jeongho Nam |
| Maintainers | samchon |
| Keywords | fast, json, stringify, transform, ajv, io-ts, zod, schema, json-schema, generator, assert, clone, is, validate, equal, runtime, type, typebox, checker, validator, safe, parse, prune, random, protobuf, llm, llm-function-calling, structured-output, openai, chatgpt, claude, gemini, llama |

## Links

- npm: https://www.npmjs.com/package/@typia/utils
- Repository: https://github.com/samchon/typia
- Homepage: https://typia.io
- Issues: https://github.com/samchon/typia/issues
- npm.io page: https://npm.io/package/@typia/utils

## Dependencies (1)

- [@typia/interface](https://npm.io/package/@typia/interface.md) ^14.0.6

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 14.0.6 (latest) — 2026-09-09
- 12.2.1 (legacy) — 2026-09-17
- 13.0.0-rc.2 (rc) — 2026-07-07
- 13.0.0-dev.20260703.1 (next) — 2026-07-03
- 14.0.5 — 2026-09-03
- 14.0.4 — 2026-08-26
- 14.0.3 — 2026-08-25
- 14.0.2 — 2026-08-22
- 14.0.1 — 2026-08-21
- 14.0.0 — 2026-08-18
- 13.3.0 — 2026-08-13
- 12.2.0 — 2026-08-13
- 13.2.0 — 2026-07-22
- 13.1.19 — 2026-07-18
- 13.1.1 — 2026-07-15
- … 60 more at https://npm.io/package/@typia/utils/versions

## README

# `@typia/utils`

![Typia Logo](https://typia.io/logo.png)

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
[![NPM Version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
[![NPM Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
[![Build Status](https://github.com/samchon/typia/workflows/test/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Atest)
[![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://typia.io/docs/)
[![Gurubase](https://img.shields.io/badge/Gurubase-Document%20Chatbot-006BFF)](https://gurubase.io/g/typia)
[![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)

Utility functions and converters for the [`typia`](https://github.com/samchon/typia) ecosystem.

Automatically installed as a dependency of `typia`.

## Key Exports

| Module | Description |
|--------|-------------|
| `HttpLlm` | Create LLM controllers from OpenAPI documents and execute function calls |
| `HttpMigration` | HTTP migration utilities |
| `HttpError` | HTTP error type |
| `OpenApiConverter` | Convert between OpenAPI versions |
| `OpenApiTypeChecker` | Type checker for OpenAPI documents |
| `LlmSchemaConverter` | Convert JSON Schema to LLM schema |
| `LlmTypeChecker` | Type checker for LLM schemas |
| `LlmJson` | Parse lenient JSON and format validation errors for LLM-friendly feedback |

## `LlmJson`

Parse lenient JSON and format validation errors for LLM-friendly feedback:

```typescript
import { IValidation } from "@typia/interface";
import { LlmJson } from "@typia/utils";

const validation: IValidation<unknown> = func.validate(llmArguments);
if (validation.success === false) {
  console.log(LlmJson.stringify(validation));
}
```

Output:

```json
{
  "x": "not a number", // ❌ expected: number
  "y": 5
}
```

## `HttpLlm`

Create LLM controllers from OpenAPI documents:

```typescript
import { IHttpLlmController } from "@typia/interface";
import { HttpLlm } from "@typia/utils";

// any OpenAPI version (Swagger 2.0, OpenAPI 3.0/3.1) is accepted
const controller: IHttpLlmController = HttpLlm.controller({
  name: "shopping",
  document: await fetch("https://shopping.example.com/swagger.json").then(r => r.json()),
  connection: {
    host: "https://shopping.example.com",
    headers: { Authorization: "Bearer ..." },
  },
});

// use with @typia/langchain or @typia/vercel
toLangChainTools({ controllers: [controller] });
toVercelTools({ controllers: [controller] });
```

`OpenApiConverter` is used internally to normalize any OpenAPI version into a unified format. You can also use it directly:

```typescript
import { OpenApi, OpenApiV3 } from "@typia/interface";
import { OpenApiConverter } from "@typia/utils";

const emended: OpenApi.IDocument = OpenApiConverter.upgradeDocument(swagger2doc); // Swagger 2.0 → OpenApi
const downgraded: OpenApiV3.IDocument = OpenApiConverter.downgradeDocument(emended, "3.0"); // → OpenAPI 3.0
```

---
_Source: https://npm.io/package/@typia/utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
