Skip to content

Commit 1e1be98

Browse files
chore: setup
1 parent 98aab78 commit 1e1be98

8 files changed

Lines changed: 68 additions & 128 deletions

File tree

.github/workflows/publish.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
permissions:
8+
id-token: write # Required for OIDC
9+
contents: read
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- uses: actions/setup-node@v6
18+
with:
19+
node-version: "24"
20+
registry-url: "https://registry.npmjs.org"
21+
- run: npm publish --access public

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
3+
"semi": true,
4+
"singleQuote": false,
5+
"trailingComma": "all",
6+
"printWidth": 100,
7+
"tabWidth": 2,
8+
"useTabs": false,
9+
"endOfLine": "lf"
10+
}

CLAUDE.md

Lines changed: 0 additions & 106 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
# api-verifier
22

3-
To install dependencies:
3+
Verify if the provided LLM API is compatible with Vercel AI SDk.
44

5-
```bash
6-
bun install
7-
```
8-
9-
To run:
5+
## Usage
106

117
```bash
12-
bun run index.ts
8+
bunx @bitrouter.ai/api-verifier --help
139
```
14-
15-
This project was created using `bun init` in bun v1.3.10. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.

bun.lock

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function parseArgs(): Config {
4343

4444
if (argv.includes("--help") || argv.includes("-h")) {
4545
console.log(`
46-
Usage: api-verifier --type <type> --api-base <url> --api-key <key> --model <model> [--test <test>]...
46+
Usage: bunx @bitrouter.ai/api-verifier --type <type> --api-base <url> --api-key <key> --model <model> [--test <test>]...
4747
4848
Options:
4949
--type API type: openai.chat | openai.responses | anthropic
@@ -164,8 +164,10 @@ async function runStreamTools(model: ReturnType<typeof createModel>): Promise<st
164164
stopWhen: stepCountIs(3),
165165
});
166166
// consume the full stream
167-
for await (const _ of result.fullStream) { /* drain */ }
168-
const toolCalls = (await result.toolCalls);
167+
for await (const _ of result.fullStream) {
168+
/* drain */
169+
}
170+
const toolCalls = await result.toolCalls;
169171
if (toolCalls.length === 0) throw new Error("Model did not call any tools");
170172
const text = (await result.text).trim().slice(0, 80);
171173
return `tool_calls=${toolCalls.length} text="${text}"`;
@@ -178,10 +180,18 @@ async function runTest(name: TestName, model: ReturnType<typeof createModel>): P
178180
try {
179181
let output: string;
180182
switch (name) {
181-
case "text": output = await runText(model); break;
182-
case "stream": output = await runStream(model); break;
183-
case "text-tools": output = await runTextTools(model); break;
184-
case "stream-tools":output = await runStreamTools(model); break;
183+
case "text":
184+
output = await runText(model);
185+
break;
186+
case "stream":
187+
output = await runStream(model);
188+
break;
189+
case "text-tools":
190+
output = await runTextTools(model);
191+
break;
192+
case "stream-tools":
193+
output = await runStreamTools(model);
194+
break;
185195
}
186196
return { name, passed: true, output, durationMs: Date.now() - start };
187197
} catch (err) {
@@ -227,6 +237,8 @@ for (const testName of config.tests) {
227237
const passed = results.filter((r) => r.passed).length;
228238
const failed = results.filter((r) => !r.passed).length;
229239

230-
console.log(`\n${BOLD}Results: ${passed === results.length ? GREEN : RED}${passed}/${results.length} passed${RESET}\n`);
240+
console.log(
241+
`\n${BOLD}Results: ${passed === results.length ? GREEN : RED}${passed}/${results.length} passed${RESET}\n`,
242+
);
231243

232244
process.exit(failed > 0 ? 1 : 0);

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@
66
"bin": {
77
"api-verifier": "./index.ts"
88
},
9+
"scripts": {
10+
"format": "prettier -w ."
11+
},
912
"dependencies": {
1013
"@ai-sdk/anthropic": "^3",
1114
"@ai-sdk/openai": "^3",
1215
"ai": "^6",
13-
"zod": "^3"
16+
"zod": "^4"
1417
},
1518
"devDependencies": {
16-
"@types/bun": "latest"
19+
"@types/bun": "latest",
20+
"prettier": "^3.8.1"
1721
},
1822
"peerDependencies": {
1923
"typescript": "^5"
2024
}
21-
}
25+
}

0 commit comments

Comments
 (0)