Skip to content

Commit b9728a2

Browse files
committed
0.2.0
- Supported chat with image - Added bun script
1 parent 5022f5f commit b9728a2

22 files changed

Lines changed: 999 additions & 249 deletions

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,35 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.0] - 2025-12-XX
9+
10+
### Added
11+
- πŸ–ΌοΈ **Image Generation Support** - Added `image_config` option for models that support image generation
12+
- `image_config.aspect_ratio` - Configure aspect ratio for generated images (e.g., "16:9", "1:1", "9:16")
13+
- Works with both streaming and non-streaming requests
14+
- Full TypeScript type safety with `ImageConfigOptions` interface
15+
- Comprehensive test coverage for image config functionality
16+
17+
### Changed
18+
- `ChatCompletionStreamingRequest` and `ChatCompletionNonStreamingRequest` now support `image_config` option
19+
- Updated API documentation with image generation examples
20+
21+
## [0.1.1] - 2025-12-XX
22+
23+
### Added
24+
- πŸš€ **Bun Support** - Full support for Bun runtime (v1.0.0+)
25+
- Updated examples to use Bun instead of tsx
26+
- Updated build scripts to use Bun commands
27+
28+
### Changed
29+
- Development scripts now use Bun by default (npm still supported)
30+
- Examples updated to work with Bun's native TypeScript support
31+
- Documentation updated to mention Bun as recommended runtime
32+
833
## [0.1.0] - 2025-12-02
934

1035
### Added
11-
- πŸŽ‰ Initial release of @eternalai-org/typescript-sdk
36+
- πŸŽ‰ Initial release of @eternalai-org/sdk
1237
- `EternalAPI` client class for chat completions
1338
- `chat.send()` method with streaming and non-streaming support
1439
- OpenAI-compatible API interface
@@ -22,7 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2247
- **Streaming Support** - Real-time streaming responses using async iterators
2348
- **OpenAI Compatible** - Drop-in replacement for OpenAI API
2449
- **TypeScript First** - Strict typing with full IntelliSense support
25-
- **Multi-Environment** - Works in Node.js (v18+) and browser
50+
- **Multi-Environment** - Works in Bun (v1.0.0+), Node.js (v18+), and browser
2651
- **Error Handling** - Descriptive error messages for debugging
2752
- **Server-Sent Events** - Efficient SSE streaming parser
2853
- **Configurable Timeout** - AbortController support for request timeouts
@@ -35,4 +60,6 @@ Access multiple AI providers through EternalAI's unified API:
3560
- Google Gemini
3661
- And more via [eternalai.org](https://eternalai.org/api/build)
3762

63+
[0.2.0]: https://github.com/eternalai-org/sdk/releases/tag/v0.2.0
64+
[0.1.1]: https://github.com/eternalai-org/sdk/releases/tag/v0.1.1
3865
[0.1.0]: https://github.com/eternalai-org/sdk/releases/tag/v0.1.0

β€ŽCONTRIBUTING.mdβ€Ž

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to @eternalai-org/typescript-sdk
1+
# Contributing to @eternalai-org/sdk
22

33
Thank you for your interest in contributing! This document provides guidelines for development.
44

@@ -12,7 +12,10 @@ Thank you for your interest in contributing! This document provides guidelines f
1212

1313
2. **Install dependencies**
1414
```bash
15-
# Using yarn (recommended - project uses yarn.lock)
15+
# Using Bun (recommended - fastest)
16+
bun install
17+
18+
# Using yarn
1619
yarn install
1720

1821
# Or using npm
@@ -21,16 +24,37 @@ Thank you for your interest in contributing! This document provides guidelines f
2124

2225
3. **Run tests**
2326
```bash
27+
# Using Bun (recommended)
28+
bun test
29+
30+
# Using npm
2431
npm test
2532
```
2633

2734
4. **Build the SDK**
2835
```bash
36+
# Using Bun (recommended)
37+
bun run build
38+
39+
# Using npm
2940
npm run build
3041
```
3142

3243
## Development Commands
3344

45+
Using Bun (recommended):
46+
- `bun run dev` - Build in watch mode
47+
- `bun test` - Run tests
48+
- `bun run test:watch` - Run tests in watch mode
49+
- `bun run test:coverage` - Generate test coverage report
50+
- `bun run type-check` - Run TypeScript type checking
51+
- `bun run lint` - Lint code with ESLint
52+
- `bun run lint:fix` - Auto-fix linting issues
53+
- `bun run format` - Format code with Prettier
54+
- `bun run format:check` - Check code formatting
55+
- `bun run build` - Build production bundle
56+
57+
Using npm (alternative):
3458
- `npm run dev` - Build in watch mode
3559
- `npm test` - Run tests
3660
- `npm run test:watch` - Run tests in watch mode
@@ -71,6 +95,11 @@ tests/ # Test files
7195
Run linting and formatting before committing:
7296

7397
```bash
98+
# Using Bun (recommended)
99+
bun run lint:fix
100+
bun run format
101+
102+
# Using npm
74103
npm run lint:fix
75104
npm run format
76105
```
@@ -123,7 +152,14 @@ Please maintain 100% coverage for all new code. View the test suite documentatio
123152
1. Fork the repository
124153
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
125154
3. Make your changes
126-
4. Run tests and linting (`npm test && npm run lint`)
155+
4. Run tests and linting:
156+
```bash
157+
# Using Bun (recommended)
158+
bun test && bun run lint
159+
160+
# Using npm
161+
npm test && npm run lint
162+
```
127163
5. Commit your changes with a descriptive message
128164
6. Push to your fork (`git push origin feature/amazing-feature`)
129165
7. Open a Pull Request

β€ŽREADME.mdβ€Ž

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
# @eternalai-org/typescript-sdk
1+
# @eternalai-org/sdk
22

33
Official TypeScript SDK for **EternalAI** - The next-generation API platform for AI applications. Access hundreds of AI models through one unified interface with cashback rewards on every API call.
44

5-
[![npm version](https://img.shields.io/npm/v/@eternalai-org/typescript-sdk.svg)](https://www.npmjs.com/package/@eternalai-org/typescript-sdk)
5+
[![npm version](https://img.shields.io/npm/v/@eternalai-org/sdk.svg)](https://www.npmjs.com/package/@eternalai-org/sdk)
6+
[![Bun](https://img.shields.io/badge/Bun-1.0+-black?logo=bun)](https://bun.sh)
7+
[![Yarn](https://img.shields.io/badge/Yarn-1.22+-2C8EBB?logo=yarn&logoColor=white)](https://yarnpkg.com)
68
[![TypeScript](https://img.shields.io/badge/TypeScript-5.3-blue.svg)](https://www.typescriptlang.org/)
79
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
810

911
## Quick Start
1012

1113
```typescript
12-
import { EternalAPI } from '@eternalai-org/typescript-sdk';
14+
import { EternalAPI } from '@eternalai-org/sdk';
1315

1416
const eternalApi = new EternalAPI({ apiKey: 'your-api-key' });
1517

@@ -29,24 +31,53 @@ for await (const chunk of result) {
2931
}
3032
```
3133

34+
### Image Generation Example
35+
36+
For models that support image generation, you can configure image options:
37+
38+
```typescript
39+
const result = await eternalApi.chat.send({
40+
messages: [
41+
{
42+
role: 'user',
43+
content: 'Generate a beautiful landscape',
44+
},
45+
],
46+
model: 'image-generation-model',
47+
image_config: {
48+
aspect_ratio: '16:9', // Optional: '16:9', '1:1', '9:16', etc.
49+
},
50+
stream: false,
51+
});
52+
53+
console.log(result.choices[0].message.content);
54+
```
55+
3256
## Installation
3357

3458
Install from npm:
3559

3660
```bash
61+
# Using Bun (recommended)
62+
bun add @eternalai-org/sdk
63+
3764
# Using npm
38-
npm install @eternalai-org/typescript-sdk
65+
npm install @eternalai-org/sdk
3966

4067
# Using yarn
41-
yarn add @eternalai-org/typescript-sdk
68+
yarn add @eternalai-org/sdk
4269

4370
# Using pnpm
44-
pnpm add @eternalai-org/typescript-sdk
71+
pnpm add @eternalai-org/sdk
4572
```
4673

4774
Or install directly from GitHub:
4875

4976
```bash
77+
# Using Bun
78+
bun add git+https://github.com/eternalai-org/sdk.git
79+
80+
# Using npm
5081
npm install git+https://github.com/eternalai-org/sdk.git
5182
```
5283

@@ -123,6 +154,8 @@ Send a chat completion request.
123154
- `request.messages` (ChatMessage[], required) - Array of chat messages
124155
- `request.model` (string, required) - Model name (e.g., `"openai/gpt-5.1"`)
125156
- `request.stream` (boolean, optional) - Enable streaming responses (default: `false`)
157+
- `request.image_config` (ImageConfigOptions, optional) - Image generation configuration for models that support image generation
158+
- `image_config.aspect_ratio` (string, optional) - Aspect ratio for generated images (e.g., `"16:9"`, `"1:1"`, `"9:16"`)
126159

127160
**Returns:**
128161

@@ -148,7 +181,7 @@ import type {
148181
ChatCompletionMessage,
149182
ChatCompletionNonStreamingChoice,
150183
ChatCompletionResponse,
151-
} from '@eternalai-org/typescript-sdk';
184+
} from '@eternalai-org/sdk';
152185
```
153186

154187
## Error Handling
@@ -166,10 +199,11 @@ try {
166199
}
167200
```
168201

169-
## Browser vs Node.js
202+
## Browser vs Node.js vs Bun
170203

171-
This SDK works in both Node.js and browser environments:
204+
This SDK works in multiple environments:
172205

206+
- **Bun** - Full support (v1.0.0+) - Recommended for best performance
173207
- **Node.js** - Full support (v18+)
174208
- **Browser** - Requires a bundler (Webpack, Vite, etc.) that supports ESM
175209

@@ -178,13 +212,14 @@ This SDK works in both Node.js and browser environments:
178212
This SDK includes a comprehensive test suite. To run the tests:
179213

180214
```bash
181-
# Run all tests
182-
npm test
215+
# Using Bun (recommended)
216+
bun test
217+
bun run test:watch
218+
bun run test:coverage
183219

184-
# Run tests in watch mode
220+
# Using npm
221+
npm test
185222
npm run test:watch
186-
187-
# Generate coverage report
188223
npm run test:coverage
189224
```
190225

@@ -208,7 +243,7 @@ MIT - see [LICENSE](./LICENSE) file for details.
208243
## Support
209244

210245
For issues and questions:
211-
- πŸ“¦ **npm Package**: [npmjs.com/package/@eternalai-org/typescript-sdk](https://www.npmjs.com/package/@eternalai-org/typescript-sdk)
246+
- πŸ“¦ **npm Package**: [npmjs.com/package/@eternalai-org/sdk](https://www.npmjs.com/package/@eternalai-org/sdk)
212247
- 🌐 **Website**: [eternalai.org](https://eternalai.org)
213248
- πŸ“– **API Platform**: [eternalai.org/api/build](https://eternalai.org/api/build)
214249
- πŸ› **GitHub Issues**: [github.com/eternalai-org/sdk/issues](https://github.com/eternalai-org/sdk/issues)

β€ŽTEST_RESULTS.mdβ€Ž

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

0 commit comments

Comments
Β (0)