thebird 1.2.1 → 1.2.2
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/README.md +39 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,24 +2,58 @@
|
|
|
2
2
|
|
|
3
3
|
Anthropic SDK to multi-provider bridge. Drop-in adapter that translates Anthropic-style messages, tool calls, and content blocks to Google Gemini or any OpenAI-compatible API — with routing, transformers, streaming, vision, retry logic, and full TypeScript types.
|
|
4
4
|
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
thebird accepts **Anthropic SDK message format** — the same `{ role, content }` structure you use with `@anthropic-ai/sdk` — and translates it to Gemini or any OpenAI-compatible API. No proxy server needed. You write Anthropic-format messages, thebird streams them through Gemini.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Anthropic SDK format → thebird → Gemini / OpenAI-compatible API
|
|
11
|
+
(messages) (bridge) (native streaming)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This means you can use `@anthropic-ai/sdk` to build your messages and tool definitions, then pass them directly to thebird for execution against Gemini models.
|
|
15
|
+
|
|
5
16
|
## Install
|
|
6
17
|
|
|
7
18
|
```bash
|
|
8
|
-
npm install thebird
|
|
19
|
+
npm install thebird @anthropic-ai/sdk
|
|
9
20
|
```
|
|
10
21
|
|
|
11
22
|
## Quick Start
|
|
12
23
|
|
|
13
|
-
**Gemini (
|
|
24
|
+
**Anthropic SDK format → Gemini (streaming)**
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
const Anthropic = require('@anthropic-ai/sdk');
|
|
28
|
+
const { streamGemini } = require('thebird');
|
|
29
|
+
|
|
30
|
+
// Build messages using Anthropic SDK format — same structure as client.messages.create()
|
|
31
|
+
const messages = [
|
|
32
|
+
{ role: 'user', content: 'Count from 1 to 5.' }
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
// Stream through Gemini — no server, no proxy
|
|
36
|
+
const { fullStream } = streamGemini({
|
|
37
|
+
model: 'gemini-3-flash-preview',
|
|
38
|
+
system: 'You are a helpful assistant.',
|
|
39
|
+
messages
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
for await (const event of fullStream) {
|
|
43
|
+
if (event.type === 'text-delta') process.stdout.write(event.textDelta);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Anthropic SDK format → Gemini (non-streaming)**
|
|
14
48
|
|
|
15
49
|
```js
|
|
16
|
-
const { generateGemini
|
|
17
|
-
// requires GEMINI_API_KEY env var
|
|
50
|
+
const { generateGemini } = require('thebird');
|
|
18
51
|
|
|
19
52
|
const { text } = await generateGemini({
|
|
20
|
-
model: 'gemini-
|
|
53
|
+
model: 'gemini-3-flash-preview',
|
|
21
54
|
messages: [{ role: 'user', content: 'Hello!' }]
|
|
22
55
|
});
|
|
56
|
+
console.log(text);
|
|
23
57
|
```
|
|
24
58
|
|
|
25
59
|
**Multi-provider router**
|
package/package.json
CHANGED