@21st-sdk/nextjs 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 AN Dev (an.dev)
3
+ Copyright (c) 2026 21st.dev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # @an-sdk/nextjs
1
+ # @21st-sdk/nextjs
2
2
 
3
- Next.js integration for [AN](https://an.dev) AI agent chat. Provides a server-side token handler so your API key never reaches the client.
3
+ Next.js integration for [21st Agents](https://21st.dev/agents) AI agent chat. Provides a server-side token handler so your API key never reaches the client.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @an-sdk/nextjs @an-sdk/react ai @ai-sdk/react
8
+ npm install @21st-sdk/nextjs @21st-sdk/react ai @ai-sdk/react
9
9
  ```
10
10
 
11
11
  ## Quick Start
@@ -14,19 +14,19 @@ npm install @an-sdk/nextjs @an-sdk/react ai @ai-sdk/react
14
14
 
15
15
  ```env
16
16
  # .env.local
17
- AN_API_KEY=an_sk_your_key_here
17
+ API_KEY_21ST=an_sk_your_key_here
18
18
  ```
19
19
 
20
- Get your API key from [an.dev/agents/dashboard/api](https://an.dev/agents/dashboard/api).
20
+ Get your API key from [the API keys page](https://21st.dev/agents/api-keys).
21
21
 
22
22
  ### 2. Create the token route (one line)
23
23
 
24
24
  ```ts
25
- // app/api/an/token/route.ts
26
- import { createAnTokenHandler } from "@an-sdk/nextjs/server"
25
+ // app/api/agent/token/route.ts
26
+ import { createTokenHandler } from "@21st-sdk/nextjs/server"
27
27
 
28
- export const POST = createAnTokenHandler({
29
- apiKey: process.env.AN_API_KEY!,
28
+ export const POST = createTokenHandler({
29
+ apiKey: process.env.API_KEY_21ST!,
30
30
  })
31
31
  ```
32
32
 
@@ -37,15 +37,15 @@ export const POST = createAnTokenHandler({
37
37
  "use client"
38
38
 
39
39
  import { useChat } from "@ai-sdk/react"
40
- import { AnAgentChat, createAnChat } from "@an-sdk/nextjs"
41
- import "@an-sdk/react/styles.css"
40
+ import { AgentChat, createAgentChat } from "@21st-sdk/nextjs"
41
+ import "@21st-sdk/react/styles.css"
42
42
  import { useMemo } from "react"
43
43
 
44
44
  export default function Chat() {
45
45
  const chat = useMemo(
46
- () => createAnChat({
46
+ () => createAgentChat({
47
47
  agent: "your-agent-slug",
48
- tokenUrl: "/api/an/token",
48
+ tokenUrl: "/api/agent/token",
49
49
  }),
50
50
  [],
51
51
  )
@@ -53,7 +53,7 @@ export default function Chat() {
53
53
  const { messages, sendMessage, status, stop, error } = useChat({ chat })
54
54
 
55
55
  return (
56
- <AnAgentChat
56
+ <AgentChat
57
57
  messages={messages}
58
58
  onSend={(msg) =>
59
59
  sendMessage({ parts: [{ type: "text", text: msg.content }] })
@@ -71,9 +71,9 @@ That's it. Your `an_sk_` API key stays on the server. The client only receives s
71
71
  ## How It Works
72
72
 
73
73
  ```
74
- Browser Your Next.js Server AN Relay
74
+ Browser Your Next.js Server Relay
75
75
  | | |
76
- |-- POST /api/an/token --------->| |
76
+ |-- POST /api/agent/token ------>| |
77
77
  | |-- POST /v1/tokens -------->|
78
78
  | | (with an_sk_ key) |
79
79
  | |<-- { token, expiresAt } ---|
package/dist/server.cjs CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var server_exports = {};
22
22
  __export(server_exports, {
23
23
  createAnTokenHandler: () => createAnTokenHandler,
24
+ createTokenHandler: () => createTokenHandler,
24
25
  exchangeToken: () => exchangeToken
25
26
  });
26
27
  module.exports = __toCommonJS(server_exports);
@@ -50,7 +51,7 @@ async function exchangeToken(options) {
50
51
  }
51
52
  return res.json();
52
53
  }
53
- function createAnTokenHandler(options) {
54
+ function createTokenHandler(options) {
54
55
  return async function POST(req) {
55
56
  try {
56
57
  const body = await req.json().catch(() => ({}));
@@ -63,9 +64,11 @@ function createAnTokenHandler(options) {
63
64
  }
64
65
  };
65
66
  }
67
+ var createAnTokenHandler = createTokenHandler;
66
68
  // Annotate the CommonJS export names for ESM import in node:
67
69
  0 && (module.exports = {
68
70
  createAnTokenHandler,
71
+ createTokenHandler,
69
72
  exchangeToken
70
73
  });
71
74
  //# sourceMappingURL=server.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server.ts"],"sourcesContent":["export interface TokenHandlerOptions {\n /** Your an_sk_ API key — keep in process.env, never expose to client */\n apiKey: string\n /** Relay URL. Default: \"https://relay.an.dev\" */\n relayUrl?: string\n /** Token expiry. Default: \"1h\" */\n expiresIn?: string\n}\n\nexport interface ExchangeTokenOptions extends TokenHandlerOptions {\n /** Agent slug to scope the token to */\n agent?: string\n /** User identifier for the token */\n userId?: string\n}\n\n/** Exchange an an_sk_ API key for a short-lived JWT via the relay */\nexport async function exchangeToken(options: ExchangeTokenOptions) {\n const {\n apiKey,\n relayUrl = \"https://relay.an.dev\",\n expiresIn = \"1h\",\n agent,\n userId,\n } = options\n\n const res = await fetch(`${relayUrl}/v1/tokens`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${apiKey}`,\n },\n body: JSON.stringify({\n userId,\n agents: agent ? [agent] : undefined,\n expiresIn,\n }),\n })\n\n if (!res.ok) {\n const err = await res.json().catch(() => ({ error: \"Failed to exchange token\" }))\n throw new Error(err.error || `Token exchange failed: ${res.status}`)\n }\n\n return res.json() as Promise<{ token: string; expiresAt: string }>\n}\n\n/** Create a Next.js API route handler that exchanges an_sk_ keys for JWTs */\nexport function createAnTokenHandler(options: TokenHandlerOptions) {\n return async function POST(req: Request) {\n try {\n const body = await req.json().catch(() => ({}))\n const { agent, userId } = body as { agent?: string; userId?: string }\n\n const data = await exchangeToken({ ...options, agent, userId })\n return Response.json(data)\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Internal error\"\n return Response.json({ error: message }, { status: 500 })\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,eAAsB,cAAc,SAA+B;AACjE,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,MAAM,MAAM,MAAM,GAAG,QAAQ,cAAc;AAAA,IAC/C,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,eAAe,UAAU,MAAM;AAAA,IACjC;AAAA,IACA,MAAM,KAAK,UAAU;AAAA,MACnB;AAAA,MACA,QAAQ,QAAQ,CAAC,KAAK,IAAI;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,MAAI,CAAC,IAAI,IAAI;AACX,UAAM,MAAM,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,EAAE,OAAO,2BAA2B,EAAE;AAChF,UAAM,IAAI,MAAM,IAAI,SAAS,0BAA0B,IAAI,MAAM,EAAE;AAAA,EACrE;AAEA,SAAO,IAAI,KAAK;AAClB;AAGO,SAAS,qBAAqB,SAA8B;AACjE,SAAO,eAAe,KAAK,KAAc;AACvC,QAAI;AACF,YAAM,OAAO,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE;AAC9C,YAAM,EAAE,OAAO,OAAO,IAAI;AAE1B,YAAM,OAAO,MAAM,cAAc,EAAE,GAAG,SAAS,OAAO,OAAO,CAAC;AAC9D,aAAO,SAAS,KAAK,IAAI;AAAA,IAC3B,SAAS,KAAK;AACZ,YAAM,UAAU,eAAe,QAAQ,IAAI,UAAU;AACrD,aAAO,SAAS,KAAK,EAAE,OAAO,QAAQ,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,IAC1D;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/server.ts"],"sourcesContent":["export interface TokenHandlerOptions {\n /** Your an_sk_ API key — keep in process.env, never expose to client */\n apiKey: string\n /** Relay URL. Default: \"https://relay.an.dev\" */\n relayUrl?: string\n /** Token expiry. Default: \"1h\" */\n expiresIn?: string\n}\n\nexport interface ExchangeTokenOptions extends TokenHandlerOptions {\n /** Agent slug to scope the token to */\n agent?: string\n /** User identifier for the token */\n userId?: string\n}\n\n/** Exchange an an_sk_ API key for a short-lived JWT via the relay */\nexport async function exchangeToken(options: ExchangeTokenOptions) {\n const {\n apiKey,\n relayUrl = \"https://relay.an.dev\",\n expiresIn = \"1h\",\n agent,\n userId,\n } = options\n\n const res = await fetch(`${relayUrl}/v1/tokens`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${apiKey}`,\n },\n body: JSON.stringify({\n userId,\n agents: agent ? [agent] : undefined,\n expiresIn,\n }),\n })\n\n if (!res.ok) {\n const err = await res.json().catch(() => ({ error: \"Failed to exchange token\" }))\n throw new Error(err.error || `Token exchange failed: ${res.status}`)\n }\n\n return res.json() as Promise<{ token: string; expiresAt: string }>\n}\n\n/** Create a Next.js API route handler that exchanges an_sk_ keys for JWTs */\nexport function createTokenHandler(options: TokenHandlerOptions) {\n return async function POST(req: Request) {\n try {\n const body = await req.json().catch(() => ({}))\n const { agent, userId } = body as { agent?: string; userId?: string }\n\n const data = await exchangeToken({ ...options, agent, userId })\n return Response.json(data)\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Internal error\"\n return Response.json({ error: message }, { status: 500 })\n }\n }\n}\n\n// Legacy handler alias kept for compatibility.\nexport const createAnTokenHandler = createTokenHandler\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,eAAsB,cAAc,SAA+B;AACjE,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,MAAM,MAAM,MAAM,GAAG,QAAQ,cAAc;AAAA,IAC/C,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,eAAe,UAAU,MAAM;AAAA,IACjC;AAAA,IACA,MAAM,KAAK,UAAU;AAAA,MACnB;AAAA,MACA,QAAQ,QAAQ,CAAC,KAAK,IAAI;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,MAAI,CAAC,IAAI,IAAI;AACX,UAAM,MAAM,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,EAAE,OAAO,2BAA2B,EAAE;AAChF,UAAM,IAAI,MAAM,IAAI,SAAS,0BAA0B,IAAI,MAAM,EAAE;AAAA,EACrE;AAEA,SAAO,IAAI,KAAK;AAClB;AAGO,SAAS,mBAAmB,SAA8B;AAC/D,SAAO,eAAe,KAAK,KAAc;AACvC,QAAI;AACF,YAAM,OAAO,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE;AAC9C,YAAM,EAAE,OAAO,OAAO,IAAI;AAE1B,YAAM,OAAO,MAAM,cAAc,EAAE,GAAG,SAAS,OAAO,OAAO,CAAC;AAC9D,aAAO,SAAS,KAAK,IAAI;AAAA,IAC3B,SAAS,KAAK;AACZ,YAAM,UAAU,eAAe,QAAQ,IAAI,UAAU;AACrD,aAAO,SAAS,KAAK,EAAE,OAAO,QAAQ,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,IAC1D;AAAA,EACF;AACF;AAGO,IAAM,uBAAuB;","names":[]}
package/dist/server.d.cts CHANGED
@@ -18,6 +18,7 @@ declare function exchangeToken(options: ExchangeTokenOptions): Promise<{
18
18
  expiresAt: string;
19
19
  }>;
20
20
  /** Create a Next.js API route handler that exchanges an_sk_ keys for JWTs */
21
- declare function createAnTokenHandler(options: TokenHandlerOptions): (req: Request) => Promise<Response>;
21
+ declare function createTokenHandler(options: TokenHandlerOptions): (req: Request) => Promise<Response>;
22
+ declare const createAnTokenHandler: typeof createTokenHandler;
22
23
 
23
- export { type ExchangeTokenOptions, type TokenHandlerOptions, createAnTokenHandler, exchangeToken };
24
+ export { type ExchangeTokenOptions, type TokenHandlerOptions, createAnTokenHandler, createTokenHandler, exchangeToken };
package/dist/server.d.ts CHANGED
@@ -18,6 +18,7 @@ declare function exchangeToken(options: ExchangeTokenOptions): Promise<{
18
18
  expiresAt: string;
19
19
  }>;
20
20
  /** Create a Next.js API route handler that exchanges an_sk_ keys for JWTs */
21
- declare function createAnTokenHandler(options: TokenHandlerOptions): (req: Request) => Promise<Response>;
21
+ declare function createTokenHandler(options: TokenHandlerOptions): (req: Request) => Promise<Response>;
22
+ declare const createAnTokenHandler: typeof createTokenHandler;
22
23
 
23
- export { type ExchangeTokenOptions, type TokenHandlerOptions, createAnTokenHandler, exchangeToken };
24
+ export { type ExchangeTokenOptions, type TokenHandlerOptions, createAnTokenHandler, createTokenHandler, exchangeToken };
package/dist/server.js CHANGED
@@ -25,7 +25,7 @@ async function exchangeToken(options) {
25
25
  }
26
26
  return res.json();
27
27
  }
28
- function createAnTokenHandler(options) {
28
+ function createTokenHandler(options) {
29
29
  return async function POST(req) {
30
30
  try {
31
31
  const body = await req.json().catch(() => ({}));
@@ -38,8 +38,10 @@ function createAnTokenHandler(options) {
38
38
  }
39
39
  };
40
40
  }
41
+ var createAnTokenHandler = createTokenHandler;
41
42
  export {
42
43
  createAnTokenHandler,
44
+ createTokenHandler,
43
45
  exchangeToken
44
46
  };
45
47
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server.ts"],"sourcesContent":["export interface TokenHandlerOptions {\n /** Your an_sk_ API key — keep in process.env, never expose to client */\n apiKey: string\n /** Relay URL. Default: \"https://relay.an.dev\" */\n relayUrl?: string\n /** Token expiry. Default: \"1h\" */\n expiresIn?: string\n}\n\nexport interface ExchangeTokenOptions extends TokenHandlerOptions {\n /** Agent slug to scope the token to */\n agent?: string\n /** User identifier for the token */\n userId?: string\n}\n\n/** Exchange an an_sk_ API key for a short-lived JWT via the relay */\nexport async function exchangeToken(options: ExchangeTokenOptions) {\n const {\n apiKey,\n relayUrl = \"https://relay.an.dev\",\n expiresIn = \"1h\",\n agent,\n userId,\n } = options\n\n const res = await fetch(`${relayUrl}/v1/tokens`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${apiKey}`,\n },\n body: JSON.stringify({\n userId,\n agents: agent ? [agent] : undefined,\n expiresIn,\n }),\n })\n\n if (!res.ok) {\n const err = await res.json().catch(() => ({ error: \"Failed to exchange token\" }))\n throw new Error(err.error || `Token exchange failed: ${res.status}`)\n }\n\n return res.json() as Promise<{ token: string; expiresAt: string }>\n}\n\n/** Create a Next.js API route handler that exchanges an_sk_ keys for JWTs */\nexport function createAnTokenHandler(options: TokenHandlerOptions) {\n return async function POST(req: Request) {\n try {\n const body = await req.json().catch(() => ({}))\n const { agent, userId } = body as { agent?: string; userId?: string }\n\n const data = await exchangeToken({ ...options, agent, userId })\n return Response.json(data)\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Internal error\"\n return Response.json({ error: message }, { status: 500 })\n }\n }\n}\n"],"mappings":";AAiBA,eAAsB,cAAc,SAA+B;AACjE,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,MAAM,MAAM,MAAM,GAAG,QAAQ,cAAc;AAAA,IAC/C,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,eAAe,UAAU,MAAM;AAAA,IACjC;AAAA,IACA,MAAM,KAAK,UAAU;AAAA,MACnB;AAAA,MACA,QAAQ,QAAQ,CAAC,KAAK,IAAI;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,MAAI,CAAC,IAAI,IAAI;AACX,UAAM,MAAM,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,EAAE,OAAO,2BAA2B,EAAE;AAChF,UAAM,IAAI,MAAM,IAAI,SAAS,0BAA0B,IAAI,MAAM,EAAE;AAAA,EACrE;AAEA,SAAO,IAAI,KAAK;AAClB;AAGO,SAAS,qBAAqB,SAA8B;AACjE,SAAO,eAAe,KAAK,KAAc;AACvC,QAAI;AACF,YAAM,OAAO,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE;AAC9C,YAAM,EAAE,OAAO,OAAO,IAAI;AAE1B,YAAM,OAAO,MAAM,cAAc,EAAE,GAAG,SAAS,OAAO,OAAO,CAAC;AAC9D,aAAO,SAAS,KAAK,IAAI;AAAA,IAC3B,SAAS,KAAK;AACZ,YAAM,UAAU,eAAe,QAAQ,IAAI,UAAU;AACrD,aAAO,SAAS,KAAK,EAAE,OAAO,QAAQ,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,IAC1D;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/server.ts"],"sourcesContent":["export interface TokenHandlerOptions {\n /** Your an_sk_ API key — keep in process.env, never expose to client */\n apiKey: string\n /** Relay URL. Default: \"https://relay.an.dev\" */\n relayUrl?: string\n /** Token expiry. Default: \"1h\" */\n expiresIn?: string\n}\n\nexport interface ExchangeTokenOptions extends TokenHandlerOptions {\n /** Agent slug to scope the token to */\n agent?: string\n /** User identifier for the token */\n userId?: string\n}\n\n/** Exchange an an_sk_ API key for a short-lived JWT via the relay */\nexport async function exchangeToken(options: ExchangeTokenOptions) {\n const {\n apiKey,\n relayUrl = \"https://relay.an.dev\",\n expiresIn = \"1h\",\n agent,\n userId,\n } = options\n\n const res = await fetch(`${relayUrl}/v1/tokens`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${apiKey}`,\n },\n body: JSON.stringify({\n userId,\n agents: agent ? [agent] : undefined,\n expiresIn,\n }),\n })\n\n if (!res.ok) {\n const err = await res.json().catch(() => ({ error: \"Failed to exchange token\" }))\n throw new Error(err.error || `Token exchange failed: ${res.status}`)\n }\n\n return res.json() as Promise<{ token: string; expiresAt: string }>\n}\n\n/** Create a Next.js API route handler that exchanges an_sk_ keys for JWTs */\nexport function createTokenHandler(options: TokenHandlerOptions) {\n return async function POST(req: Request) {\n try {\n const body = await req.json().catch(() => ({}))\n const { agent, userId } = body as { agent?: string; userId?: string }\n\n const data = await exchangeToken({ ...options, agent, userId })\n return Response.json(data)\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Internal error\"\n return Response.json({ error: message }, { status: 500 })\n }\n }\n}\n\n// Legacy handler alias kept for compatibility.\nexport const createAnTokenHandler = createTokenHandler\n"],"mappings":";AAiBA,eAAsB,cAAc,SAA+B;AACjE,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,MAAM,MAAM,MAAM,GAAG,QAAQ,cAAc;AAAA,IAC/C,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,eAAe,UAAU,MAAM;AAAA,IACjC;AAAA,IACA,MAAM,KAAK,UAAU;AAAA,MACnB;AAAA,MACA,QAAQ,QAAQ,CAAC,KAAK,IAAI;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAED,MAAI,CAAC,IAAI,IAAI;AACX,UAAM,MAAM,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,EAAE,OAAO,2BAA2B,EAAE;AAChF,UAAM,IAAI,MAAM,IAAI,SAAS,0BAA0B,IAAI,MAAM,EAAE;AAAA,EACrE;AAEA,SAAO,IAAI,KAAK;AAClB;AAGO,SAAS,mBAAmB,SAA8B;AAC/D,SAAO,eAAe,KAAK,KAAc;AACvC,QAAI;AACF,YAAM,OAAO,MAAM,IAAI,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE;AAC9C,YAAM,EAAE,OAAO,OAAO,IAAI;AAE1B,YAAM,OAAO,MAAM,cAAc,EAAE,GAAG,SAAS,OAAO,OAAO,CAAC;AAC9D,aAAO,SAAS,KAAK,IAAI;AAAA,IAC3B,SAAS,KAAK;AACZ,YAAM,UAAU,eAAe,QAAQ,IAAI,UAAU;AACrD,aAAO,SAAS,KAAK,EAAE,OAAO,QAAQ,GAAG,EAAE,QAAQ,IAAI,CAAC;AAAA,IAC1D;AAAA,EACF;AACF;AAGO,IAAM,uBAAuB;","names":[]}
@@ -8,7 +8,7 @@ AN is a platform for building, deploying, and embedding AI agents. You define an
8
8
  Your Code (agent.ts)
9
9
  |
10
10
  v
11
- @an-sdk/cli deploy (CLI)
11
+ @21st-sdk/cli deploy (CLI)
12
12
  |
13
13
  v
14
14
  AN Platform
@@ -30,11 +30,11 @@ AN Platform
30
30
 
31
31
  | Package | Purpose |
32
32
  |---------|---------|
33
- | `@an-sdk/agent` | Define agents and tools with type inference |
34
- | `@an-sdk/cli` | Deploy agents from your terminal |
35
- | `@an-sdk/react` | Chat UI components (theming, tool renderers) |
36
- | `@an-sdk/nextjs` | Next.js server-side token handler |
37
- | `@an-sdk/node` | Server-side SDK (sandboxes, threads, tokens) |
33
+ | `@21st-sdk/agent` | Define agents and tools with type inference |
34
+ | `@21st-sdk/cli` | Deploy agents from your terminal |
35
+ | `@21st-sdk/react` | Chat UI components (theming, tool renderers) |
36
+ | `@21st-sdk/nextjs` | Next.js server-side token handler |
37
+ | `@21st-sdk/node` | Server-side SDK (sandboxes, threads, tokens) |
38
38
 
39
39
  ## Key Concepts
40
40
 
@@ -58,4 +58,4 @@ Two layers of authentication:
58
58
  1. **Client -> Relay**: API key (`an_sk_...`) or short-lived JWT (via token exchange)
59
59
  2. **Sandbox -> AI Provider**: Handled internally by the platform (Claude Proxy)
60
60
 
61
- For web apps, use `@an-sdk/nextjs` to exchange your API key for a short-lived JWT on the server, so the key never reaches the browser.
61
+ For web apps, use `@21st-sdk/nextjs` to exchange your API key for a short-lived JWT on the server, so the key never reaches the browser.
@@ -2,12 +2,12 @@
2
2
 
3
3
  ## 1. Get an API Key
4
4
 
5
- Sign up at [an.dev](https://an.dev) and get your API key from [an.dev/agents/dashboard/api](https://an.dev/agents/dashboard/api).
5
+ Sign up at [21st.dev/agents](https://21st.dev/agents) and get your API key from [the dashboard](https://21st.dev/agents/dashboard/api).
6
6
 
7
7
  ## 2. Install
8
8
 
9
9
  ```bash
10
- npm install @an-sdk/agent zod
10
+ npm install @21st-sdk/agent zod
11
11
  ```
12
12
 
13
13
  ## 3. Define Your Agent
@@ -15,7 +15,7 @@ npm install @an-sdk/agent zod
15
15
  Create `src/agent.ts`:
16
16
 
17
17
  ```ts
18
- import { agent, tool } from "@an-sdk/agent"
18
+ import { agent, tool } from "@21st-sdk/agent"
19
19
  import { z } from "zod"
20
20
 
21
21
  export default agent({
@@ -36,10 +36,10 @@ export default agent({
36
36
  ## 4. Login & Deploy
37
37
 
38
38
  ```bash
39
- npx @an-sdk/cli login
39
+ npx @21st-sdk/cli login
40
40
  # Enter your API key: an_sk_...
41
41
 
42
- npx @an-sdk/cli deploy
42
+ npx @21st-sdk/cli deploy
43
43
  # Bundling src/agent.ts...
44
44
  # Deploying my-agent...
45
45
  # https://api.an.dev/v1/chat/my-agent
@@ -50,17 +50,17 @@ Your agent is live.
50
50
  ## 5. Embed in a React App
51
51
 
52
52
  ```bash
53
- npm install @an-sdk/nextjs @an-sdk/react ai @ai-sdk/react
53
+ npm install @21st-sdk/nextjs @21st-sdk/react ai @ai-sdk/react
54
54
  ```
55
55
 
56
56
  Create a token route (keeps your API key on the server):
57
57
 
58
58
  ```ts
59
- // app/api/an/token/route.ts
60
- import { createAnTokenHandler } from "@an-sdk/nextjs/server"
59
+ // app/api/agent/token/route.ts
60
+ import { createTokenHandler } from "@21st-sdk/nextjs/server"
61
61
 
62
- export const POST = createAnTokenHandler({
63
- apiKey: process.env.AN_API_KEY!,
62
+ export const POST = createTokenHandler({
63
+ apiKey: process.env.API_KEY_21ST!,
64
64
  })
65
65
  ```
66
66
 
@@ -71,15 +71,15 @@ Add the chat UI:
71
71
  "use client"
72
72
 
73
73
  import { useChat } from "@ai-sdk/react"
74
- import { AnAgentChat, createAnChat } from "@an-sdk/nextjs"
75
- import "@an-sdk/react/styles.css"
74
+ import { AgentChat, createAgentChat } from "@21st-sdk/nextjs"
75
+ import "@21st-sdk/react/styles.css"
76
76
  import { useMemo } from "react"
77
77
 
78
78
  export default function Chat() {
79
79
  const chat = useMemo(
80
- () => createAnChat({
80
+ () => createAgentChat({
81
81
  agent: "your-agent-slug",
82
- tokenUrl: "/api/an/token",
82
+ tokenUrl: "/api/agent/token",
83
83
  }),
84
84
  [],
85
85
  )
@@ -87,7 +87,7 @@ export default function Chat() {
87
87
  const { messages, sendMessage, status, stop, error } = useChat({ chat })
88
88
 
89
89
  return (
90
- <AnAgentChat
90
+ <AgentChat
91
91
  messages={messages}
92
92
  onSend={(msg) =>
93
93
  sendMessage({ parts: [{ type: "text", text: msg.content }] })
@@ -1,11 +1,11 @@
1
1
  # Defining Agents
2
2
 
3
- Agents are defined with the `agent()` and `tool()` functions from `@an-sdk/agent`. These are config-only — they return exactly what you pass in, with type inference added. The actual execution happens in the AN runtime (E2B sandbox).
3
+ Agents are defined with the `agent()` and `tool()` functions from `@21st-sdk/agent`. These are config-only — they return exactly what you pass in, with type inference added. The actual execution happens in the AN runtime (E2B sandbox).
4
4
 
5
5
  ## `agent(config)`
6
6
 
7
7
  ```ts
8
- import { agent } from "@an-sdk/agent"
8
+ import { agent } from "@21st-sdk/agent"
9
9
 
10
10
  export default agent({
11
11
  // Model (default: "claude-sonnet-4-6")
@@ -52,7 +52,7 @@ export default agent({
52
52
  ## `tool(definition)`
53
53
 
54
54
  ```ts
55
- import { tool } from "@an-sdk/agent"
55
+ import { tool } from "@21st-sdk/agent"
56
56
  import { z } from "zod"
57
57
 
58
58
  const myTool = tool({
@@ -1,11 +1,11 @@
1
1
  # React UI
2
2
 
3
- `@an-sdk/react` provides a full chat UI for AN agents. Built on [Vercel AI SDK v5](https://sdk.vercel.ai) — uses standard `useChat()` from `@ai-sdk/react`.
3
+ `@21st-sdk/react` provides a full chat UI for AN agents. Built on [Vercel AI SDK v5](https://sdk.vercel.ai) — uses standard `useChat()` from `@ai-sdk/react`.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @an-sdk/react ai @ai-sdk/react
8
+ npm install @21st-sdk/react ai @ai-sdk/react
9
9
  ```
10
10
 
11
11
  ## Basic Usage
@@ -14,13 +14,13 @@ npm install @an-sdk/react ai @ai-sdk/react
14
14
  "use client"
15
15
 
16
16
  import { useChat } from "@ai-sdk/react"
17
- import { AnAgentChat, createAnChat } from "@an-sdk/react"
18
- import "@an-sdk/react/styles.css"
17
+ import { AgentChat, createAgentChat } from "@21st-sdk/react"
18
+ import "@21st-sdk/react/styles.css"
19
19
  import { useMemo } from "react"
20
20
 
21
21
  export default function Chat() {
22
22
  const chat = useMemo(
23
- () => createAnChat({
23
+ () => createAgentChat({
24
24
  agent: "your-agent-slug",
25
25
  getToken: async () => "your_an_sk_token",
26
26
  }),
@@ -30,7 +30,7 @@ export default function Chat() {
30
30
  const { messages, sendMessage, status, stop, error } = useChat({ chat })
31
31
 
32
32
  return (
33
- <AnAgentChat
33
+ <AgentChat
34
34
  messages={messages}
35
35
  onSend={(msg) =>
36
36
  sendMessage({ parts: [{ type: "text", text: msg.content }] })
@@ -43,12 +43,12 @@ export default function Chat() {
43
43
  }
44
44
  ```
45
45
 
46
- ## `createAnChat(options)`
46
+ ## `createAgentChat(options)`
47
47
 
48
48
  Creates an AI SDK `Chat` instance pointed at the AN Relay.
49
49
 
50
50
  ```ts
51
- createAnChat({
51
+ createAgentChat({
52
52
  agent: string // Agent slug from dashboard
53
53
  getToken: () => Promise<string> // Returns an_sk_ key or JWT
54
54
  apiUrl?: string // Default: "https://relay.an.dev"
@@ -60,7 +60,7 @@ createAnChat({
60
60
 
61
61
  For Next.js apps, use `tokenUrl` instead of `getToken` — see [Next.js Integration](./05-nextjs.md).
62
62
 
63
- ## `<AnAgentChat />` Props
63
+ ## `<AgentChat />` Props
64
64
 
65
65
  | Prop | Type | Description |
66
66
  |------|------|-------------|
@@ -69,10 +69,10 @@ For Next.js apps, use `tokenUrl` instead of `getToken` — see [Next.js Integrat
69
69
  | `status` | `ChatStatus` | `"ready" \| "submitted" \| "streaming" \| "error"` |
70
70
  | `onStop` | `() => void` | Stop generation |
71
71
  | `error` | `Error` | Error to display |
72
- | `theme` | `AnTheme` | Theme from playground |
72
+ | `theme` | `ChatTheme` | Theme from playground |
73
73
  | `colorMode` | `"light" \| "dark" \| "auto"` | Color mode |
74
- | `classNames` | `Partial<AnClassNames>` | Per-element CSS overrides |
75
- | `slots` | `Partial<AnSlots>` | Component swapping |
74
+ | `classNames` | `Partial<ChatClassNames>` | Per-element CSS overrides |
75
+ | `slots` | `Partial<ChatSlots>` | Component swapping |
76
76
  | `className` | `string` | Root element class |
77
77
  | `style` | `CSSProperties` | Root element style |
78
78
 
@@ -82,16 +82,16 @@ Four levels, from simple to full control:
82
82
 
83
83
  ### 1. Theme tokens
84
84
 
85
- Apply a theme JSON from the [AN Playground](https://an.dev/an/playground):
85
+ Apply a theme JSON from the [AN Playground](https://21st.dev/agents/playground):
86
86
 
87
87
  ```tsx
88
- <AnAgentChat theme={playgroundTheme} colorMode="dark" />
88
+ <AgentChat theme={playgroundTheme} colorMode="dark" />
89
89
  ```
90
90
 
91
91
  ### 2. Class overrides
92
92
 
93
93
  ```tsx
94
- <AnAgentChat
94
+ <AgentChat
95
95
  classNames={{
96
96
  root: "rounded-2xl border",
97
97
  messageList: "px-8",
@@ -106,7 +106,7 @@ Apply a theme JSON from the [AN Playground](https://an.dev/an/playground):
106
106
  Swap sub-components:
107
107
 
108
108
  ```tsx
109
- <AnAgentChat
109
+ <AgentChat
110
110
  slots={{
111
111
  InputBar: MyCustomInput,
112
112
  UserMessage: MyUserBubble,
@@ -118,7 +118,7 @@ Swap sub-components:
118
118
  ### 4. Individual component imports
119
119
 
120
120
  ```tsx
121
- import { MessageList, InputBar, ToolRenderer } from "@an-sdk/react"
121
+ import { MessageList, InputBar, ToolRenderer } from "@21st-sdk/react"
122
122
  ```
123
123
 
124
124
  ## CSS
@@ -126,7 +126,7 @@ import { MessageList, InputBar, ToolRenderer } from "@an-sdk/react"
126
126
  Import once in your app:
127
127
 
128
128
  ```tsx
129
- import "@an-sdk/react/styles.css"
129
+ import "@21st-sdk/react/styles.css"
130
130
  ```
131
131
 
132
132
  No Tailwind peer dependency — CSS is pre-compiled. All elements have stable `an-*` class names:
@@ -145,7 +145,7 @@ No Tailwind peer dependency — CSS is pre-compiled. All elements have stable `a
145
145
  ## Theme Type
146
146
 
147
147
  ```ts
148
- interface AnTheme {
148
+ interface ChatTheme {
149
149
  theme: Record<string, string> // Shared: font, spacing, accent
150
150
  light: Record<string, string> // Light mode CSS vars
151
151
  dark: Record<string, string> // Dark mode CSS vars
package/docs/05-nextjs.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # Next.js Integration
2
2
 
3
- `@an-sdk/nextjs` provides a server-side token handler so your `an_sk_` API key never reaches the browser. It also re-exports everything from `@an-sdk/react` for convenience.
3
+ `@21st-sdk/nextjs` provides a server-side token handler so your `an_sk_` API key never reaches the browser. It also re-exports everything from `@21st-sdk/react` for convenience.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @an-sdk/nextjs @an-sdk/react ai @ai-sdk/react
8
+ npm install @21st-sdk/nextjs @21st-sdk/react ai @ai-sdk/react
9
9
  ```
10
10
 
11
11
  ## Setup
@@ -14,19 +14,19 @@ npm install @an-sdk/nextjs @an-sdk/react ai @ai-sdk/react
14
14
 
15
15
  ```env
16
16
  # .env.local
17
- AN_API_KEY=an_sk_your_key_here
17
+ API_KEY_21ST=an_sk_your_key_here
18
18
  ```
19
19
 
20
- Get your API key from [an.dev/agents/dashboard/api](https://an.dev/agents/dashboard/api).
20
+ Get your API key from [the dashboard](https://21st.dev/agents/dashboard/api).
21
21
 
22
22
  ### 2. Create the token route
23
23
 
24
24
  ```ts
25
- // app/api/an/token/route.ts
26
- import { createAnTokenHandler } from "@an-sdk/nextjs/server"
25
+ // app/api/agent/token/route.ts
26
+ import { createTokenHandler } from "@21st-sdk/nextjs/server"
27
27
 
28
- export const POST = createAnTokenHandler({
29
- apiKey: process.env.AN_API_KEY!,
28
+ export const POST = createTokenHandler({
29
+ apiKey: process.env.API_KEY_21ST!,
30
30
  })
31
31
  ```
32
32
 
@@ -37,15 +37,15 @@ export const POST = createAnTokenHandler({
37
37
  "use client"
38
38
 
39
39
  import { useChat } from "@ai-sdk/react"
40
- import { AnAgentChat, createAnChat } from "@an-sdk/nextjs"
41
- import "@an-sdk/react/styles.css"
40
+ import { AgentChat, createAgentChat } from "@21st-sdk/nextjs"
41
+ import "@21st-sdk/react/styles.css"
42
42
  import { useMemo } from "react"
43
43
 
44
44
  export default function Chat() {
45
45
  const chat = useMemo(
46
- () => createAnChat({
46
+ () => createAgentChat({
47
47
  agent: "your-agent-slug",
48
- tokenUrl: "/api/an/token",
48
+ tokenUrl: "/api/agent/token",
49
49
  }),
50
50
  [],
51
51
  )
@@ -53,7 +53,7 @@ export default function Chat() {
53
53
  const { messages, sendMessage, status, stop, error } = useChat({ chat })
54
54
 
55
55
  return (
56
- <AnAgentChat
56
+ <AgentChat
57
57
  messages={messages}
58
58
  onSend={(msg) =>
59
59
  sendMessage({ parts: [{ type: "text", text: msg.content }] })
@@ -71,7 +71,7 @@ export default function Chat() {
71
71
  ```
72
72
  Browser Your Next.js Server AN Relay
73
73
  | | |
74
- |-- POST /api/an/token --------->| |
74
+ |-- POST /api/agent/token ------>| |
75
75
  | |-- POST /v1/tokens -------->|
76
76
  | | (with an_sk_ key) |
77
77
  | |<-- { token, expiresAt } ---|
@@ -85,12 +85,12 @@ The client only receives short-lived JWTs. Your API key stays on the server.
85
85
 
86
86
  ## API
87
87
 
88
- ### `createAnTokenHandler(options)`
88
+ ### `createTokenHandler(options)`
89
89
 
90
90
  Returns a Next.js `POST` route handler.
91
91
 
92
92
  ```ts
93
- createAnTokenHandler({
93
+ createTokenHandler({
94
94
  apiKey: string // Your an_sk_ API key
95
95
  relayUrl?: string // Default: "https://relay.an.dev"
96
96
  expiresIn?: string // Default: "1h"
@@ -102,10 +102,10 @@ createAnTokenHandler({
102
102
  Lower-level function for custom token exchange logic.
103
103
 
104
104
  ```ts
105
- import { exchangeToken } from "@an-sdk/nextjs/server"
105
+ import { exchangeToken } from "@21st-sdk/nextjs/server"
106
106
 
107
107
  const { token, expiresAt } = await exchangeToken({
108
- apiKey: process.env.AN_API_KEY!,
108
+ apiKey: process.env.API_KEY_21ST!,
109
109
  relayUrl: "https://relay.an.dev",
110
110
  expiresIn: "1h",
111
111
  })
@@ -113,5 +113,5 @@ const { token, expiresAt } = await exchangeToken({
113
113
 
114
114
  ## Entry Points
115
115
 
116
- - `@an-sdk/nextjs` — Re-exports everything from `@an-sdk/react` (components, types, `createAnChat`)
117
- - `@an-sdk/nextjs/server` — Server-only: `createAnTokenHandler`, `exchangeToken`
116
+ - `@21st-sdk/nextjs` — Re-exports everything from `@21st-sdk/react` (components, types, `createAgentChat`)
117
+ - `@21st-sdk/nextjs/server` — Server-only: `createTokenHandler`, `exchangeToken`
@@ -1,42 +1,42 @@
1
1
  # Node SDK
2
2
 
3
- `@an-sdk/node` is a server-side client for the AN API. Use it to manage sandboxes, threads, and tokens programmatically.
3
+ `@21st-sdk/node` is a server-side client for the AN API. Use it to manage sandboxes, threads, and tokens programmatically.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install @an-sdk/node
8
+ npm install @21st-sdk/node
9
9
  ```
10
10
 
11
11
  ## Quick Start
12
12
 
13
13
  ```ts
14
- import { AnClient } from "@an-sdk/node"
14
+ import { AgentClient } from "@21st-sdk/node"
15
15
 
16
- const an = new AnClient({
17
- apiKey: process.env.AN_API_KEY!, // an_sk_...
16
+ const client = new AgentClient({
17
+ apiKey: process.env.API_KEY_21ST!, // an_sk_...
18
18
  })
19
19
 
20
20
  // Create a sandbox for your agent
21
- const sandbox = await an.sandboxes.create({ agent: "my-agent" })
21
+ const sandbox = await client.sandboxes.create({ agent: "my-agent" })
22
22
 
23
23
  // Create a thread
24
- const thread = await an.threads.create({
24
+ const thread = await client.threads.create({
25
25
  sandboxId: sandbox.sandboxId,
26
26
  name: "Review PR #42",
27
27
  })
28
28
 
29
29
  // Generate a short-lived token for browser clients
30
- const { token, expiresAt } = await an.tokens.create({
30
+ const { token, expiresAt } = await client.tokens.create({
31
31
  agent: "my-agent",
32
32
  expiresIn: "1h",
33
33
  })
34
34
  ```
35
35
 
36
- ## `AnClient`
36
+ ## `AgentClient`
37
37
 
38
38
  ```ts
39
- new AnClient({
39
+ new AgentClient({
40
40
  apiKey: string // Your an_sk_ API key
41
41
  baseUrl?: string // Default: "https://relay.an.dev"
42
42
  })
package/docs/07-cli.md CHANGED
@@ -1,35 +1,35 @@
1
1
  # CLI Reference
2
2
 
3
- `@an-sdk/cli` provides the `an` command for deploying agents.
3
+ `@21st-sdk/cli` provides the `an` command for deploying agents.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install -g @an-sdk/cli
8
+ npm install -g @21st-sdk/cli
9
9
  # or use npx
10
- npx @an-sdk/cli <command>
10
+ npx @21st-sdk/cli <command>
11
11
  ```
12
12
 
13
13
  ## Commands
14
14
 
15
- ### `@an-sdk/cli login`
15
+ ### `@21st-sdk/cli login`
16
16
 
17
17
  Authenticate with the AN platform.
18
18
 
19
19
  ```bash
20
- npx @an-sdk/cli login
20
+ npx @21st-sdk/cli login
21
21
  # Enter your API key: an_sk_...
22
22
  # Authenticated as John (team: my-team)
23
23
  ```
24
24
 
25
25
  Your key is saved to `~/.an/credentials`.
26
26
 
27
- ### `@an-sdk/cli deploy`
27
+ ### `@21st-sdk/cli deploy`
28
28
 
29
29
  Bundle and deploy your agent.
30
30
 
31
31
  ```bash
32
- npx @an-sdk/cli deploy
32
+ npx @21st-sdk/cli deploy
33
33
  # Bundling src/agent.ts...
34
34
  # Bundled (12.3kb)
35
35
  # Deploying my-agent...
@@ -71,7 +71,7 @@ Subsequent deploys update the existing agent.
71
71
  The CLI uses esbuild to bundle your agent code:
72
72
 
73
73
  - Target: Node 22, ESM
74
- - `@an-sdk/agent` is externalized (provided by the sandbox runtime)
74
+ - `@21st-sdk/agent` is externalized (provided by the sandbox runtime)
75
75
  - All other dependencies are bundled into a single file
76
76
 
77
77
  ## Configuration Files
@@ -85,4 +85,4 @@ The CLI uses esbuild to bundle your agent code:
85
85
 
86
86
  | Variable | Default | Description |
87
87
  |----------|---------|-------------|
88
- | `AN_API_URL` | `https://an.dev/api/v1` | Override API endpoint |
88
+ | `API_URL_21ST` | `https://an.dev/api/v1` | Override API endpoint |
@@ -1,6 +1,6 @@
1
1
  # Custom Tool Renderers
2
2
 
3
- The `@an-sdk/react` chat UI automatically renders tool calls from your agent. It includes built-in renderers for all standard Claude tools and supports custom renderers for your own tools.
3
+ The `@21st-sdk/react` chat UI automatically renders tool calls from your agent. It includes built-in renderers for all standard Claude tools and supports custom renderers for your own tools.
4
4
 
5
5
  ## Built-in Tool Renderers
6
6
 
@@ -24,8 +24,8 @@ These are rendered automatically when your agent uses standard tools:
24
24
  To render your custom tools differently, use the `slots.ToolRenderer` prop:
25
25
 
26
26
  ```tsx
27
- import { AnAgentChat, ToolRenderer } from "@an-sdk/react"
28
- import type { ToolPart } from "@an-sdk/react"
27
+ import { AgentChat, ToolRenderer } from "@21st-sdk/react"
28
+ import type { ToolPart } from "@21st-sdk/react"
29
29
 
30
30
  function MyToolRenderer(props: { part: ToolPart; status: string }) {
31
31
  const { part, status } = props
@@ -49,7 +49,7 @@ function MyToolRenderer(props: { part: ToolPart; status: string }) {
49
49
  return <ToolRenderer part={part} status={status} />
50
50
  }
51
51
 
52
- <AnAgentChat
52
+ <AgentChat
53
53
  slots={{ ToolRenderer: MyToolRenderer }}
54
54
  // ... other props
55
55
  />
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@21st-sdk/nextjs",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "license": "MIT",
5
- "description": "Next.js integration for AN AI agent chat — server-side token handler",
6
- "homepage": "https://an.dev",
5
+ "description": "Next.js integration for 21st Agents chat",
6
+ "homepage": "https://21st.dev/agents",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -49,8 +49,8 @@
49
49
  "agent",
50
50
  "chat",
51
51
  "ai-sdk",
52
- "an",
53
- "an.dev"
52
+ "21st",
53
+ "21st.dev"
54
54
  ],
55
55
  "scripts": {
56
56
  "prepack": "cp -r ../docs ./docs",
@@ -64,7 +64,7 @@
64
64
  "react": "^18.0.0 || ^19.0.0",
65
65
  "react-dom": "^18.0.0 || ^19.0.0",
66
66
  "@ai-sdk/react": "^2.0.0",
67
- "@21st-sdk/react": "^0.0.5",
67
+ "@21st-sdk/react": "^0.1.4",
68
68
  "ai": "^5.0.0"
69
69
  },
70
70
  "devDependencies": {
package/src/server.ts CHANGED
@@ -46,7 +46,7 @@ export async function exchangeToken(options: ExchangeTokenOptions) {
46
46
  }
47
47
 
48
48
  /** Create a Next.js API route handler that exchanges an_sk_ keys for JWTs */
49
- export function createAnTokenHandler(options: TokenHandlerOptions) {
49
+ export function createTokenHandler(options: TokenHandlerOptions) {
50
50
  return async function POST(req: Request) {
51
51
  try {
52
52
  const body = await req.json().catch(() => ({}))
@@ -60,3 +60,6 @@ export function createAnTokenHandler(options: TokenHandlerOptions) {
60
60
  }
61
61
  }
62
62
  }
63
+
64
+ // Legacy handler alias kept for compatibility.
65
+ export const createAnTokenHandler = createTokenHandler