Skip to content

Commit 0817c9e

Browse files
Add LICENSE, AGENTS.md, and richer package.json metadata
Make the published npm package easier to discover and consume: - LICENSE (MIT) so the published tarball ships with explicit terms. - AGENTS.md is the dedicated agent-facing playbook covering install, the typed client surface, auth, error handling, and rate limits. - package.json gains an English description, license=MIT, an uapis.cn homepage, an issues URL, and npm-search-friendly keywords (uapi, uapis.cn, sdk, typescript, public-api, openapi, ...). No code changes; build/publish pipeline is unaffected. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 2790566 commit 0817c9e

3 files changed

Lines changed: 126 additions & 1 deletion

File tree

‎AGENTS.md‎

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# AGENTS.md — uapi-sdk-typescript
2+
3+
This file tells AI coding agents how to use the **official TypeScript /
4+
Node.js SDK** for the [uapis.cn](https://uapis.cn) public API platform.
5+
6+
## What this package is
7+
8+
Strongly-typed Node / browser-compatible client for UAPI. Generated from the
9+
live OpenAPI 3.1 spec at <https://uapis.cn/openapi.json> — so the method
10+
list, parameter shapes, and return types stay in lock-step with the real
11+
API.
12+
13+
```bash
14+
npm i uapi-sdk-typescript
15+
# or
16+
pnpm add uapi-sdk-typescript
17+
# or
18+
yarn add uapi-sdk-typescript
19+
```
20+
21+
## Quick start
22+
23+
```ts
24+
import { UapiClient } from "uapi-sdk-typescript";
25+
26+
// Free-tier endpoints don't need an API key
27+
const client = new UapiClient("https://uapis.cn");
28+
29+
const weather = await client.misc.getMiscWeather({ city: "北京" });
30+
console.log(weather);
31+
32+
// Paid endpoints take a key
33+
const paid = new UapiClient("https://uapis.cn", process.env.UAPI_KEY!);
34+
const ocr = await paid.image.postImageOcr({ url: "https://…/photo.png" });
35+
```
36+
37+
The client is grouped by tag (`misc`, `network`, `text`, `image`, `social`,
38+
`translate`, `search`, …) and each method name matches the underlying
39+
`operationId` from the OpenAPI spec.
40+
41+
## Discovery
42+
43+
When generating code, agents should:
44+
45+
1. Pull the spec from <https://uapis.cn/openapi.json> if the schema you need
46+
isn't already in your local types.
47+
2. Map the operation's `operationId` to a SDK method (`get-misc-weather` →
48+
`client.misc.getMiscWeather`).
49+
3. Pass the request parameters as a single object — query params, path
50+
params, and body all live there.
51+
52+
## Authentication
53+
54+
- Many UAPI endpoints (network, text, random, convert, weather, time,
55+
hotboard) work with no key.
56+
- Paid endpoints want `X-API-Key`. The SDK forwards the second
57+
`UapiClient` constructor argument to that header.
58+
- For human-in-the-loop OAuth flows, see
59+
<https://uapis.cn/.well-known/oauth-authorization-server>.
60+
61+
## Errors
62+
63+
Every method throws an `AxiosError`-shaped error on non-2xx responses. The
64+
error body is a JSON object: `{code, success: false, error, request_id?}`.
65+
Surface the `error` text verbatim.
66+
67+
## Rate limits
68+
69+
Headers `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`,
70+
`Retry-After` are returned on every response. Honor them — back off on
71+
`429` and obey `Retry-After`.
72+
73+
## Related repos
74+
75+
- MCP server: <https://github.com/AxT-Team/uapi-mcp> — same endpoints as MCP tools.
76+
- Skills bundle: <https://github.com/AxT-Team/uapi-agent-skills> — markdown
77+
skills for AI agents that prefer SKILL-driven workflows.
78+
- Browser-only SDK: <https://github.com/AxT-Team/uapi-browser-sdk>.
79+
- Other languages: `uapi-sdk-python`, `uapi-sdk-go`, `uapi-sdk-rust`,
80+
`uapi-sdk-java`, `uapi-sdk-csharp`, `uapi-sdk-cpp`, `uapi-sdk-php`.

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 AxT-Team / UAPI
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

‎package.json‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,29 @@
2424
"devDependencies": {
2525
"typescript": "^5.4.0",
2626
"@types/node": "^20.11.0"
27-
}
27+
},
28+
"description": "Official TypeScript / Node.js SDK for UAPI / uapis.cn — a strongly-typed wrapper around 100+ free public-API endpoints (network, text, image, social, translation, search). Generated from the live OpenAPI 3.1 spec.",
29+
"homepage": "https://uapis.cn/docs/sdk/typescript",
30+
"bugs": {
31+
"url": "https://github.com/AxT-Team/uapi-sdk-typescript/issues"
32+
},
33+
"author": "UAPI <dev@uapis.cn>",
34+
"license": "MIT",
35+
"keywords": [
36+
"uapi",
37+
"uapis",
38+
"uapis.cn",
39+
"sdk",
40+
"typescript",
41+
"nodejs",
42+
"public-api",
43+
"free-api",
44+
"rest",
45+
"rest-api",
46+
"openapi",
47+
"axios",
48+
"client",
49+
"agent",
50+
"mcp"
51+
]
2852
}

0 commit comments

Comments
 (0)