---
title: "System One の TypeScript SDK。"
description: "System One の TypeScript SDK で、evaluate() 一回に構造化判断を追加。選択・スコアリング基準・はい/いいえ質問を定義し、型付き回答をアプリで使います。"
canonical: "https://system-one.dev/ja/sdk"
language: "ja"
---

# System One の TypeScript SDK。

System One の TypeScript SDK で、evaluate() 一回に構造化判断を追加。選択・スコアリング基準・はい/いいえ質問を定義し、型付き回答をアプリで使います。

オープンソース · TypeScript · Node.js

## SDK をインストール

```sh
npm install @system-one-ai/core@0.8.0 @system-one-ai/adapter-system-one@0.7.0 @system-one-ai/transport-fetch@0.8.0
```
## モデルサービスに接続

core・サービスアダプター・transport をインストール。System One API 向けに systemOneAdapter と createFetchTransport() を設定。認証情報はサーバー環境に置きます。

```ts
import { createSystemOne, choice } from '@system-one-ai/core';
import { systemOneAdapter } from '@system-one-ai/adapter-system-one';
import { createFetchTransport } from '@system-one-ai/transport-fetch';

const client = createSystemOne({
  adapter: systemOneAdapter,
  transport: createFetchTransport(),
  baseURL: process.env.SYSTEM_ONE_BASE_URL!,
  apiKey: process.env.SYSTEM_ONE_API_KEY!,
  maxRetries: 0,
});

const result = await client.evaluate({
  state: { message: 'I was charged twice.' },
  questions: {
    team: choice('Who should handle this?', {
      billing: 'Payments and refunds',
      support: 'Technical issues',
    }),
  },
});

result.answers.team.choice; // 'billing' | 'support'
```
## 構造化決定のための一つのインターフェース

### 質問から回答まで型付き

Choice の結果は選択肢名を TypeScript リテラル型として保持。Score と はい/いいえ確率は数値で返ります。

### プロバイダーに接続

System One API を直接利用。任意の Vercel AI SDK アダプターで他の対応モデルサービスにも接続できます。

### リクエスト挙動を制御

タイムアウトとリトライを設定し、AbortSignal でキャンセル、型付きエラーをアプリで処理します。

## System One API に接続

System One API キーでホスト型サービスを呼び出します。Playground で入力を試し、コンソールで利用状況を確認してください。

[SDK をホスト型 API に接続](https://docs.system-one.dev/ja/docs/getting-started)

## Start here

- [Developer documentation](https://docs.system-one.dev/ja)
- [Versioning and deprecation](https://docs.system-one.dev/ja/docs/api/versioning)
- [冪等性とリトライ](https://docs.system-one.dev/ja/docs/api/idempotency)
- [API エラー](https://docs.system-one.dev/ja/docs/api/errors)
- [TypeScript SDK](https://system-one.dev/ja/sdk)
- [API reference](https://system-one.dev/ja/api)
- [Models](https://system-one.dev/ja/models)
- [モデルカタログ](https://docs.system-one.dev/ja/docs/models)
- [Authentication](https://system-one.dev/ja/auth.md)
- [Pricing](https://system-one.dev/ja/pricing)
- [クレジット課金](https://docs.system-one.dev/ja/docs/billing)
- [OpenAPI specification](https://system-one.dev/openapi.json)
- [Agent integration guide](https://system-one.dev/ja/skill.md)
- [System One for Coding Agents: Cursor, Claude Code, Codex](https://docs.system-one.dev/ja/docs/coding-agents)
- [Installable coding-agent skill](https://system-one.dev/skills/system-one/SKILL.md)
- [About](https://system-one.dev/ja/about)
- [Contact](https://system-one.dev/ja/contact)
- [Playground samples](https://system-one.dev/ja/demo)
- [ブログ](https://system-one.dev/ja/blog)
- [SDK source](https://github.com/ziyu/system-one-sdk)
- [@system-one-ai/core (npm)](https://www.npmjs.com/package/@system-one-ai/core)
