> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polymarket.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 客户端与 SDK

> 与 Polymarket 交互的官方开源库

Polymarket 提供 TypeScript、Python 和 Rust 的官方开源客户端。三者都支持完整的 CLOB API，包括市场数据、订单管理和身份验证。

## 安装

<CodeGroup>
  ```bash TypeScript theme={null}
  npm install @polymarket/clob-client-v2 viem
  ```

  ```bash Python theme={null}
  pip install py-clob-client-v2
  ```

  ```bash Rust theme={null}
  cargo add polymarket_client_sdk_v2 --features clob
  ```
</CodeGroup>

## 快速示例

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { ClobClient } from "@polymarket/clob-client-v2";

  const client = new ClobClient({
    host: "https://clob.polymarket.com",
    chain: 137,
    signer,
    creds: apiCreds,
  });

  const markets = await client.getMarkets();
  ```

  ```python Python theme={null}
  from py_clob_client_v2 import ClobClient

  client = ClobClient(
      "https://clob.polymarket.com",
      key=private_key,
      chain_id=137,
      creds=api_creds,
  )

  markets = client.get_markets()
  ```
</CodeGroup>

## 源代码

| 语言         | 包                            | 仓库                                                                                         |
| ---------- | ---------------------------- | ------------------------------------------------------------------------------------------ |
| TypeScript | `@polymarket/clob-client-v2` | [github.com/Polymarket/clob-client-v2](https://github.com/Polymarket/clob-client-v2)       |
| Python     | `py-clob-client-v2`          | [github.com/Polymarket/py-clob-client-v2](https://github.com/Polymarket/py-clob-client-v2) |
| Rust       | `polymarket_client_sdk_v2`   | [github.com/Polymarket/rs-clob-client-v2](https://github.com/Polymarket/rs-clob-client-v2) |

每个仓库的 `/examples` 目录中包含可运行的示例。

## Relayer SDK

对于使用代理钱包的[免 Gas 交易](/trading/gasless)，Relayer 客户端负责通过 Polymarket 的 relayer 提交交易：

| 语言         | 包                                    | 仓库                                                                                                         |
| ---------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
| TypeScript | `@polymarket/builder-relayer-client` | [github.com/Polymarket/builder-relayer-client](https://github.com/Polymarket/builder-relayer-client)       |
| Python     | `py-builder-relayer-client`          | [github.com/Polymarket/py-builder-relayer-client](https://github.com/Polymarket/py-builder-relayer-client) |

## 下一步

<CardGroup cols={2}>
  <Card title="快速开始" icon="rocket" href="/quickstart">
    设置客户端并下你的第一笔订单。
  </Card>

  <Card title="身份验证" icon="lock" href="/api-reference/authentication">
    了解 L1/L2 身份验证和 API 凭证。
  </Card>
</CardGroup>
