yu-api-sdk
v1.0.0
Published
Yu API - Smart AI Orchestration SDK. Access top-tier AI models through one unified API.
Readme
Yu API SDK
Features
- OpenAI Compatible - Use the same code, just change the base URL
- Smart Orchestration - Automatically routes to optimal models
- 90%+ Cost Savings - Compared to GPT-4 and Claude
- Streaming Support - Real-time responses
- TypeScript Support - Full type definitions
Installation
```bash npm install yu-api-sdk ```
Quick Start
JavaScript Usage
```javascript import YuAPI from "yu-api-sdk";
const yu = new YuAPI({ apiKey: "YOUR_API_KEY" });
async function main() { // Simple chat completion const response = await yu.createCompletion({ model: "yu", messages: [{ role: "user", content: "Hello!" }] });
console.log(response.choices[0].message.content); }
main(); ```
With OpenAI SDK
```javascript import OpenAI from "openai";
const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://yuapihub.com/api/v1" });
const completion = await client.chat.completions.create({ model: "yu", messages: [{ role: "user", content: "Hello!" }] });
console.log(completion.choices[0].message.content); ```
API Reference
Configuration
| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | apiKey | string | required | Your Yu API key | | baseURL | string | https://yuapihub.com/api/v1 | API base URL | | timeout | number | 60000 | Request timeout (ms) |
Methods
createCompletion(options)
Create a chat completion.
listModels()
List available models.
License
MIT
