0.0.11 • Published 1 year ago
one-ai-api v0.0.11
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
- install
pnpm i one-ai-api
- use
import {askAuto} from one-ai-api
// If the OpenAI API call fails, automatically call the Azure API, and so on.
askAuto('hello', {
order: ['openai', 'bard', 'claude', '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: {
apiKey: 'xxxxx', // get from https://makersuite.google.com/app/apikey
},
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.10
2 years ago
0.0.11
1 year ago
0.0.9
2 years ago
0.0.7-beta.5
2 years ago
0.0.7-beta.4
2 years ago
0.0.7-beta.3
2 years ago
0.0.7-beta.2
2 years ago
0.0.7-beta.1
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.4-beta.3
2 years ago
0.0.4-beta.2
2 years ago
0.0.4-beta.1
2 years ago
0.0.2
2 years ago
0.0.2-beta.1
2 years ago
0.0.1
2 years ago