@ghostspeak/plugin-gateway-ghost 0.1.0

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.
Files changed (33) hide show
  1. package/README.md +94 -0
  2. package/dist/index.js +11433 -0
  3. package/dist/index.js.map +116 -0
  4. package/dist/src/config.d.ts +56 -0
  5. package/dist/src/config.d.ts.map +1 -0
  6. package/dist/src/gateway.d.ts +34 -0
  7. package/dist/src/gateway.d.ts.map +1 -0
  8. package/dist/src/handlers/image-description.d.ts +15 -0
  9. package/dist/src/handlers/image-description.d.ts.map +1 -0
  10. package/dist/src/handlers/image-generation.d.ts +15 -0
  11. package/dist/src/handlers/image-generation.d.ts.map +1 -0
  12. package/dist/src/handlers/index.d.ts +12 -0
  13. package/dist/src/handlers/index.d.ts.map +1 -0
  14. package/dist/src/handlers/object-generation.d.ts +20 -0
  15. package/dist/src/handlers/object-generation.d.ts.map +1 -0
  16. package/dist/src/handlers/text-embedding.d.ts +12 -0
  17. package/dist/src/handlers/text-embedding.d.ts.map +1 -0
  18. package/dist/src/handlers/text-generation.d.ts +34 -0
  19. package/dist/src/handlers/text-generation.d.ts.map +1 -0
  20. package/dist/src/handlers/text-to-speech.d.ts +12 -0
  21. package/dist/src/handlers/text-to-speech.d.ts.map +1 -0
  22. package/dist/src/handlers/tokenizer.d.ts +16 -0
  23. package/dist/src/handlers/tokenizer.d.ts.map +1 -0
  24. package/dist/src/handlers/transcription.d.ts +12 -0
  25. package/dist/src/handlers/transcription.d.ts.map +1 -0
  26. package/dist/src/index.d.ts +22 -0
  27. package/dist/src/index.d.ts.map +1 -0
  28. package/dist/src/plugin.d.ts +19 -0
  29. package/dist/src/plugin.d.ts.map +1 -0
  30. package/dist/src/utils/error-handler.d.ts +25 -0
  31. package/dist/src/utils/error-handler.d.ts.map +1 -0
  32. package/dist/tsconfig.build.tsbuildinfo +1 -0
  33. package/package.json +132 -0
package/README.md ADDED
@@ -0,0 +1,94 @@
1
+ # @ghostspeak/plugin-gateway-ghost
2
+
3
+ Unified Vercel AI Gateway plugin for ElizaOS - **one API key** for all model types.
4
+
5
+ ## Features
6
+
7
+ - **Single API Key**: One `AI_GATEWAY_API_KEY` for all model operations
8
+ - **January 2026 Models**: Claude Haiku/Opus 4.5, FLUX 2 Pro, Grok 2 Vision
9
+ - **Full Model Coverage**: Text, embeddings, images, vision, speech, transcription
10
+ - **Streaming Support**: Full async streaming for text generation
11
+ - **Local Tokenization**: Uses js-tiktoken, no API calls needed
12
+
13
+ ## Supported Model Types
14
+
15
+ | ModelType | Default Model | Description |
16
+ |-----------|---------------|-------------|
17
+ | TEXT_SMALL | `anthropic/claude-haiku-4.5` | Fast, efficient text |
18
+ | TEXT_LARGE | `anthropic/claude-opus-4.5` | Best quality reasoning |
19
+ | TEXT_EMBEDDING | `openai/text-embedding-3-large` | 3072-dim embeddings |
20
+ | OBJECT_SMALL | `anthropic/claude-haiku-4.5` | Structured JSON output |
21
+ | OBJECT_LARGE | `anthropic/claude-opus-4.5` | Complex structured output |
22
+ | IMAGE | `bfl/flux-2-pro` | Image generation (FLUX) |
23
+ | IMAGE_DESCRIPTION | `xai/grok-2-vision` | Vision/multimodal |
24
+ | TRANSCRIPTION | `openai/whisper-1` | Speech-to-text |
25
+ | TEXT_TO_SPEECH | `openai/tts-1-hd` | Text-to-speech (HD) |
26
+ | TEXT_TOKENIZER_* | (local) | Token encode/decode |
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ npm install @ghostspeak/plugin-gateway-ghost
32
+ # or
33
+ bun add @ghostspeak/plugin-gateway-ghost
34
+ ```
35
+
36
+ ## Configuration
37
+
38
+ ### Environment Variables
39
+
40
+ ```bash
41
+ # Required
42
+ AI_GATEWAY_API_KEY=your_vercel_ai_gateway_key
43
+
44
+ # Optional (with defaults)
45
+ AI_GATEWAY_BASE_URL=https://ai-gateway.vercel.sh/v1
46
+ AI_GATEWAY_TEXT_SMALL_MODEL=anthropic/claude-haiku-4.5
47
+ AI_GATEWAY_TEXT_LARGE_MODEL=anthropic/claude-opus-4.5
48
+ AI_GATEWAY_EMBEDDING_MODEL=openai/text-embedding-3-large
49
+ AI_GATEWAY_IMAGE_MODEL=bfl/flux-2-pro
50
+ AI_GATEWAY_VISION_MODEL=xai/grok-2-vision
51
+ AI_GATEWAY_TRANSCRIPTION_MODEL=openai/whisper-1
52
+ AI_GATEWAY_TTS_MODEL=openai/tts-1-hd
53
+ AI_GATEWAY_TTS_VOICE=alloy
54
+ ```
55
+
56
+ ### Character Configuration
57
+
58
+ ```json
59
+ {
60
+ "name": "YourAgent",
61
+ "plugins": ["@ghostspeak/plugin-gateway-ghost"],
62
+ "bio": "Your agent bio..."
63
+ }
64
+ ```
65
+
66
+ ## Usage
67
+
68
+ The plugin automatically registers model handlers when loaded. ElizaOS will use these handlers for all model operations:
69
+
70
+ ```typescript
71
+ // The plugin registers handlers for:
72
+ // - runtime.generateText() -> TEXT_SMALL/TEXT_LARGE
73
+ // - runtime.embed() -> TEXT_EMBEDDING
74
+ // - runtime.generateObject() -> OBJECT_SMALL/OBJECT_LARGE
75
+ // - runtime.generateImage() -> IMAGE
76
+ // - etc.
77
+ ```
78
+
79
+ ## Development
80
+
81
+ ```bash
82
+ # Install dependencies
83
+ bun install
84
+
85
+ # Build
86
+ bun run build
87
+
88
+ # Test (requires AI_GATEWAY_API_KEY)
89
+ AI_GATEWAY_API_KEY=your_key bun test
90
+ ```
91
+
92
+ ## License
93
+
94
+ MIT