0.0.9 • Published 6 months ago

one-ai-api v0.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

Description

Unified AI Interface

Supports

  • OpenAI
  • Azure
  • Claude (web api)
  • Bard (web api)

If you need to integrate other SDKs, please submit an issue or a pull request.

Todo

✅ Supports cloudflare ai gateway

⭕️ Supports streaming

Usage

  1. install
pnpm i one-ai-api
  1. use
import {ask} from one-ai-api

// If the OpenAI API call fails, automatically call the Azure API, and so on.
ask('hello', {
    order: ['openai', 'claude', 'bard', 'azure'], // specify the AI you want to use and the order of their usage.
    openai: {
        apiKey: 'sk-xxxxx', // get from openai
        config: { // openai sdk config
            // ...
        }
    },
    azure: {
        apiKey?: string // get from azure
        config: {
            baseURL: 'xxx' // endPoint, get from azure
            // ...
        }
    },
    claude: {
        orgId: string, // get from api [orgId]/chat_conversations
        sessionKey: string // get from cookie
    },
    bard: {
        secure1psid: string, // get from cookie
        secure1psidts: string  // get from cookie
    },
    debugger: true // enable log
})

You can also use it separately

import {ask} from "one-ai-api/openai";
const prompt = 'hello'
const result = await ask(prompt, 'sk-xxx')

Contributing

Welcome contributions to the One AI API project. If you have suggestions or improvements, please submit a pull request with your proposed changes.

0.0.9

6 months ago

0.0.7-beta.5

6 months ago

0.0.7-beta.4

6 months ago

0.0.7-beta.3

6 months ago

0.0.7-beta.2

6 months ago

0.0.7-beta.1

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.4-beta.3

6 months ago

0.0.4-beta.2

6 months ago

0.0.4-beta.1

6 months ago

0.0.2

6 months ago

0.0.2-beta.1

6 months ago

0.0.1

6 months ago