tekimax-ts 0.2.3 β†’ 0.2.4

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 (2) hide show
  1. package/README.md +98 -142
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,28 +1,52 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/TEKIMAX/tekimax-ts/main/apps/docs/public/tekimax-logo.png" alt="Tekimax SDK Logo" width="200" />
3
- <h1>Tekimax TS</h1>
4
- <p><strong>The Universal Standard.</strong></p>
5
- <p>A type-safe, framework-agnostic AI SDK for building AI-powered apps.</p>
6
-
7
- [![npm version](https://img.shields.io/npm/v/tekimax-ts.svg)](https://www.npmjs.com/package/tekimax-ts)
8
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2
+ <img src="https://raw.githubusercontent.com/TEKIMAX/tekimax-ts/main/apps/docs/public/tekimax-logo.png" alt="Tekimax SDK Logo" width="120" />
3
+ <h1>Tekimax SDK</h1>
4
+ <p><strong>The Universal Standard</strong></p>
5
+
6
+ <p>
7
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a>
8
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.0-3178C6.svg" alt="TypeScript"></a>
9
+ <a href="https://tekimax.com"><img src="https://img.shields.io/badge/Standard-Tekimax-000000.svg" alt="Standard"></a>
10
+ <a href="https://www.npmjs.com/package/tekimax-ts"><img src="https://img.shields.io/npm/v/tekimax-ts.svg" alt="NPM Version"></a>
11
+ <a href="https://packagephobia.com/result?p=tekimax-ts"><img src="https://packagephobia.com/badge?p=tekimax-ts" alt="Bundle Size"></a>
12
+ </p>
13
+
14
+ <p>
15
+ Integrate <strong>OpenAI</strong>, <strong>Anthropic</strong>, <strong>Gemini</strong>, <strong>Ollama</strong>, <strong>Grok</strong>, and <strong>OpenRouter</strong> with a single, type-safe API.
16
+ </p>
9
17
 
18
+ <div>
19
+ <img src="https://img.shields.io/badge/OpenAI-412991?style=for-the-badge&logo=openai&logoColor=white" alt="OpenAI" />
20
+ <img src="https://img.shields.io/badge/Anthropic-D06940?style=for-the-badge&logo=anthropic&logoColor=white" alt="Anthropic" />
21
+ <img src="https://img.shields.io/badge/Gemini-8E75B2?style=for-the-badge&logo=google%20gemini&logoColor=white" alt="Gemini" />
22
+ <img src="https://img.shields.io/badge/Ollama-000000?style=for-the-badge&logo=ollama&logoColor=white" alt="Ollama" />
23
+ <img src="https://img.shields.io/badge/Grok-000000?style=for-the-badge&logo=x&logoColor=white" alt="Grok" />
24
+ <img src="https://img.shields.io/badge/OpenRouter-6366F1?style=for-the-badge&logo=openai&logoColor=white" alt="OpenRouter" />
25
+ </div>
10
26
  </div>
11
27
 
12
- ## πŸ“¦ Installation
28
+ ---
13
29
 
14
- ```bash
15
- npm install tekimax-ts
16
- ```
30
+ ## πŸš€ The Universal Standard
17
31
 
18
- ## 🌟 Features
32
+ The **Tekimax SDK** solves the fragmentation of AI APIs. Instead of rewriting your integration code for every provider (handling different request formats, streaming implementations, and error types), you use **one standard interface**.
19
33
 
20
- - **Universal API**: One interface for all providers. Switch from OpenAI to Ollama with a single config change.
21
- - **Strict Modality Type Safety**: End-to-end TypeScript support. Strong capability interfaces ensure compile-time safety (e.g., your code won't compile if you call `.images.generate()` on a provider missing the `ImageGenerationCapability`). Zod schemas for runtime validation.
22
- - **Zero Latency**: Lightweight adapter pattern with zero runtime overhead.
23
- - **Zero CVEs**: Hardened supply chain using Chainguard images.
34
+ - **Write Once, Run Anywhere**: Switch between OpenAI (Cloud) and Ollama (Local) with a single line of config.
35
+ - **Type-Safe**: Full TypeScript support with Zod validation for inputs and outputs.
36
+ - **Multi-Modal**: Text, images, audio, video, and **embeddings** through a unified namespace API.
37
+ - **OpenResponses Catalog**: Fuses `models.dev` metadata into standard `ModelDefinition` objects for reasoning, modalities, and token limits.
38
+ - **Middleware Plugins**: Built-in architecture for Security (`PIIFilterPlugin`), Scalability (`MaxContextOverflowPlugin`), and Telemetry (`LoggerPlugin`).
39
+ - **React Ready**: Includes a `useChat` hook for instant UI integration, complete with SSE streaming.
24
40
  - **Redis Adapter** _(optional)_: Response caching, rate limiting, token budgets, and session storage with any Redis client.
25
41
 
42
+
43
+ ## πŸ’» Installation
44
+
45
+ ```bash
46
+ # Install core and your desired adapters
47
+ npm install tekimax-ts
48
+ ```
49
+
26
50
  ## πŸ’» Usage
27
51
 
28
52
  ### 1. Initialize the Client
@@ -52,60 +76,6 @@ const claude = new Tekimax({
52
76
  const local = new Tekimax({
53
77
  provider: new OllamaProvider({ baseUrl: 'http://localhost:11434' })
54
78
  })
55
-
56
- // Custom Model Proxies (e.g. Internal API gateways)
57
- const proxyClient = new Tekimax({
58
- provider: new OpenAIProvider({
59
- apiKey: process.env.CUSTOM_PROXY_KEY,
60
- baseURL: 'https://api.my-custom-proxy.internal/v1'
61
- })
62
- })
63
-
64
- ### Streaming
65
-
66
- Tekimax-TS uses standard Javascript Async Iterables for real-time streaming:
67
-
68
- ```typescript
69
- const stream = await client.text.generateStream({
70
- model: "gpt-4o",
71
- messages: [{ role: "user", content: "Tell me a story" }]
72
- })
73
-
74
- for await (const chunk of stream) {
75
- process.stdout.write(chunk.delta)
76
- }
77
- ```
78
-
79
- ## πŸ”Œ Plugin Architecture (Lifecycle Hooks)
80
-
81
- The SDK provides a robust middleware architecture via `plugins`. You can snap in pre-built plugins for Security, Scalability, and Telemetry, or build your own.
82
-
83
- ```typescript
84
- import { Tekimax, OpenAIProvider, PIIFilterPlugin, LoggerPlugin, MaxContextOverflowPlugin } from 'tekimax-ts'
85
-
86
- const client = new Tekimax({
87
- provider: new OpenAIProvider({ apiKey: 'sk-...' }),
88
- plugins: [
89
- new LoggerPlugin(), // Telemetry
90
- new PIIFilterPlugin(), // Security: Redacts emails and SSNs
91
- new MaxContextOverflowPlugin(15) // Scalability: Prevents context bloat in long loops
92
- ]
93
- })
94
- ```
95
-
96
- ### Building Custom Plugins
97
- Implement the `TekimaxPlugin` interface to hook into the request/response lifecycle:
98
-
99
- ```typescript
100
- export interface TekimaxPlugin {
101
- name: string
102
- onInit?: (client: Tekimax) => void
103
- beforeRequest?: (context: PluginContext) => Promise<void | PluginContext>
104
- afterResponse?: (context: PluginContext, result: ChatResult) => Promise<void>
105
- onStreamChunk?: (context: PluginContext, chunk: StreamChunk) => void
106
- beforeToolExecute?: (toolName: string, args: unknown) => Promise<void>
107
- afterToolExecute?: (toolName: string, result: unknown) => Promise<void>
108
- }
109
79
  ```
110
80
 
111
81
  ### 2. Multi-Modal Interfaces
@@ -160,109 +130,95 @@ const analysis = await client.videos.analyze({
160
130
  })
161
131
  ```
162
132
 
163
- ## πŸ“š Documentation
164
-
165
- For full documentation, guides, and API references, visit **[docs.tekimax.com](https://docs.tekimax.com)**.
166
-
167
- ## 🧠 Motivation
168
-
169
-
170
- Modern LLM systems have converged on similar primitives: messages, function calls, tool usage, and multimodal inputs but each provider encodes them differently. **Tekimax** standardizes these concepts, enabling:
171
-
172
- - **One spec, many providers**: Describe inputs/outputs once; run on OpenAI, Anthropic, Gemini, or local models.
173
- - **Composable agentic loops**: Unified streaming, tool invocation, and message orchestration.
174
- - **Easier evaluation and routing**: Compare providers, route requests, and log results through a shared schema.
175
- - **Blueprints for provider APIs**: Labs and model providers wanting to expose their APIs in a common format can easily do so.
176
-
177
- ## πŸ”‘ Key Principles
178
-
179
- ### Agentic Loop
180
-
181
- All models, to some extent, exhibit agency: the ability to perceive input, reason, act through tools, and reflect on outcomes.
133
+ #### Embeddings
182
134
 
183
- The **Tekimax Standard** at its core is designed to expose the power of this agentic loop to developers, making requests that allow the model to do multiple things and yield back a result, whether this is developer-hosted tool calls where control is yielded back to the user, or provider-hosted tools where control is held by the model provider until the model signals an exit criteria.
184
-
185
- Tekimax defines a common pattern for defining control flow in the agent loop, a set of item definitions for developer-controlled tools, and pattern for defining provider and router-hosted tools.
186
-
187
- ### Items β†’ Items
188
-
189
- Items are the fundamental unit of context in Tekimax: they represent an atomic unit of model output, tool invocation, or reasoning state. Items are bidirectional, they can be provided as inputs to the model, or as outputs from the model.
190
-
191
- Each item type has a defined schema that binds it and contains properties specific to its unique purpose.
135
+ ```typescript
136
+ const vectors = await client.text.embed({
137
+ model: 'text-embedding-3-small',
138
+ input: ['Hello world', 'Tekimax SDK is awesome']
139
+ })
140
+ console.log(vectors.embeddings)
141
+ ```
192
142
 
193
- Tekimax defines a common set of items supported by a quorum of model providers, and defines how provider-specific item types can be defined.
143
+ ### 3. Cross-Provider Model Catalog
194
144
 
195
- ### Semantic Events
145
+ The SDK strictly implements the **OpenResponses** schema, optionally fusing metadata from `models.dev` so your application always knows what capabilities the active provider supports.
196
146
 
197
- Streaming is modeled as a series of semantic events, not raw text or object deltas.
147
+ ```typescript
148
+ // Returns standard ModelDefinition[] populated with reasoning levels, modal limits, and costs
149
+ const models = await client.provider.getModels?.()
198
150
 
199
- Events describe meaningful transitions. They are either state transitions (e.g., `response.in_progress`, `response.completed`) or they can represent a delta from a previous state (e.g., `response.output_item.added`, `response.output_text.delta`).
151
+ if (models) {
152
+ console.log(models.find(m => m.id === 'gpt-4o')?.modalities.input) // ['text', 'image', 'audio', 'video']
153
+ }
154
+ ```
200
155
 
201
- Tekimax defines a common set of streaming events supported by a quorum of model providers, and defines how provider-specific streaming events can be defined.
156
+ ## πŸ—οΈ Monorepo Structure
202
157
 
203
- ### State Machines
158
+ This repository is managed as a **Turborepo** monorepo.
204
159
 
205
- Objects in Tekimax are state machines, that is, they can live in one of a finite number of states, such as `in_progress`, `completed`, or `failed`. The spec defines the set of valid states for each state machine in the API.
160
+ - **`apps/docs`**: Documentation site (Next.js + Fumadocs).
161
+ - **`packages/*`**: Core SDK and Provider Adapters.
162
+ - **`tekimax-cli`**: Developer tools for Tekimax.
206
163
 
207
- ## πŸ›‘οΈ Security & Trust
164
+ ### Commands
208
165
 
209
- At **Tekimax**, we believe security is a feature, not an afterthought.
166
+ ```bash
167
+ # Build all packages
168
+ npx turbo build
210
169
 
211
- - **Zero Vulnerabilities**: We enforce a strict **Zero CVE** policy. Our SDK is audited daily.
212
- - **Minimal Surface Area**: By optimizing our dependency tree, we identified and **removed 159 unnecessary packages**, drastically reducing the attack surface.
213
- - **Secured by Chainguard**: Our build pipeline and artifacts rely on [Chainguard Images](https://www.chainguard.dev/chainguard-images)β€”hardened, minimal container images designed to secure the software supply chain. Chainguard images are stripped of shells, package managers, and other unnecessary tools that attackers often exploit.
170
+ # Run tests
171
+ npx turbo test
214
172
 
215
- Supply chain attacks on the Node.js/npm ecosystem are increasingly common. By building on Chainguard, we ensure that the Tekimax SDK meets the highest standards of integrity and safety for enterprise and production use.
173
+ # Start Docs Site
174
+ npx turbo dev --filter=docs
175
+ ```
216
176
 
217
177
  ## ⚑ Optional Redis Adapter
218
178
 
179
+ No extra dependency β€” bring your own `ioredis`, `@upstash/redis`, or `node-redis`:
180
+
219
181
  ```typescript
220
182
  import { ResponseCache, RateLimiter, TokenBudget, SessionStore } from 'tekimax-ts'
221
183
  import Redis from 'ioredis'
222
184
 
223
185
  const redis = new Redis(process.env.REDIS_URL)
224
- const cache = new ResponseCache(redis, { ttl: 3600 }) // Cache responses
225
- const limiter = new RateLimiter(redis, { maxRequests: 60 }) // Rate limit
226
- const budget = new TokenBudget(redis, { maxTokens: 100_000 }) // Token budget
227
- const sessions = new SessionStore(redis, { ttl: 1800 }) // Sessions
186
+
187
+ // Cache AI responses (avoid repeat API costs)
188
+ const cache = new ResponseCache(redis, { ttl: 3600 })
189
+
190
+ // Enforce rate limits per provider
191
+ const limiter = new RateLimiter(redis, { maxRequests: 60, windowSeconds: 60 })
192
+
193
+ // Track daily token spend
194
+ const budget = new TokenBudget(redis, { maxTokens: 100_000, periodSeconds: 86400 })
195
+
196
+ // Conversation state for serverless
197
+ const sessions = new SessionStore(redis, { ttl: 1800 })
228
198
  ```
229
199
 
230
200
  ## πŸ—ΊοΈ Roadmap
231
201
 
232
202
  | Feature | Description | Status |
233
203
  |---------|-------------|--------|
234
- | **Batch API** | OpenAI's Batch API for 50% cost reduction on large jobs. Queue thousands of requests and retrieve results asynchronously. | πŸ”œ Planned |
235
- | **Edge Runtime** | Cloudflare Workers / Deno support. Current `Buffer` usage blocks edge compatibility β€” will be replaced with `Uint8Array` and Web Streams. | πŸ”œ Planned |
236
- | **Assistants / Threads** | Stateful conversation management with persistence. Create threads, append messages, and resume conversations across sessions. | πŸ”œ Planned |
237
- | **Fine-tuning API** | Programmatic fine-tuning via OpenAI and Gemini APIs. Upload training data, launch jobs, and deploy custom models through a unified interface. | πŸ”œ Planned |
238
- | **Observability** | OpenTelemetry spans for every provider call β€” latency, tokens, cost, and error rate. | πŸ”œ Planned |
239
- | **Redis Adapter** | Optional response caching, rate limiting, token budget tracking, and session storage with any Redis-compatible client. | βœ… Shipped |
204
+ | **Middleware Plugins** | Pre-built and custom lifecycle hooks for Security, Telemetry, and Scalability. | βœ… Shipped |
205
+ | **OpenResponses Catalog** | Provider abstraction parsing `models.dev` metadata for token limits, reasoning capabilities, and allowed modalities. | βœ… Shipped |
206
+ | **Real-time SSE Streaming** | Native SDK token streaming, `StreamChunk` event typing, and full React hooks support (`useChat`). | βœ… Shipped |
207
+ | **Redis Adapter** | Optional response caching, rate limiting, token budget tracking, and session storage with any Redis client. | βœ… Shipped |
208
+ | **Observability** | Telemetry and tracing via `plugins` architecture. | βœ… Shipped |
209
+ | **Batch API** | Queue thousands of requests and retrieve results asynchronously. | πŸ”œ Planned |
210
+ | **Edge Runtime** | Cloudflare Workers / Deno support. | πŸ”œ Planned |
211
+ | **Assistants / Threads** | Stateful conversation management with persistence. | πŸ”œ Planned |
212
+ | **Fine-tuning API** | Programmatic fine-tuning via internal and integrated APIs. | πŸ”œ Planned |
240
213
 
241
214
  > **Want to help?** Pick a feature and open a PR, or join the discussion in [GitHub Issues](https://github.com/TEKIMAX/tekimax-ts/issues).
242
215
 
243
- ## Get Involved
216
+ ## πŸ’– Support
244
217
 
245
- - We welcome issues and pull requests!
246
- - Participate in **GitHub Discussions**.
247
- - See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup instructions.
218
+ Tekimax is open source. If you find it valuable, please consider [becoming a sponsor](https://github.com/sponsors/TEKIMAX) to support long-term maintenance.
248
219
 
249
- ## Partners
250
-
251
- We're looking for Tekimax Partners to join our mission! Partner with us to push the boundaries of Tekimax and build amazing things together.
252
-
253
- [LET'S CHAT](mailto:info@tekimax.com?subject=Tekimax%20Partnership)
254
-
255
- ## Code of Conduct
256
-
257
- ## Please note that this project is released with a [Contributor Code of Conduct](./CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
220
+ ---
258
221
 
259
222
  <div align="center">
260
- <p>
261
- <strong>Secured by <a href="https://www.chainguard.dev">Chainguard</a></strong><br>
262
- Zero-CVE Images for a Safe Supply Chain
263
- </p>
264
- <p>
265
- Built on the <a href="https://openresponses.org">OpenResponses Standard</a> β€’ Generated with <a href="https://kubb.dev">Kubb</a>
266
- </p>
267
- <sub>Built with ❀️ by the Tekimax Team</sub>
223
+ <p>Built with ❀️ by the Tekimax Team</p>
268
224
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tekimax-ts",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "description": "A type-safe, framework-agnostic AI SDK for building AI-powered apps.",
6
6
  "homepage": "https://tekimax.com",