Use only one line of code to call multiple model APIs similar to ChatGPT. Currently supported: Azure OpenAI Resource endpoint API, OpenAI Official API, and Anthropic Claude series model API.
Project description
OneAPI
Use only one line of code to call multiple model APIs similar to ChatGPT. Currently supported: Azure OpenAI Resource endpoint API, OpenAI Official API, and Anthropic Claude series model API.
Installation
pip install -U oneapi
Usage
1. (Recommended method) Set your key information in the local configuration file.
OpenAI config:
{
"api_key": "YOUR_API_KEY",
"api": "https://api.openai.com/v1",
"api_type": "open_ai"
}
Azure OpenAI config:
{
"api_key": "YOUR_API_KEY",
"api": "Change to your Azure OpenAI resource's endpoint value.",
"api_type": "azure"
}
Antropic config:
{
"api_key": "YOUR_API_KEY",
"api": "https://api.anthropic.com",
"api_type": "anthropic"
}
api_key
OpenAI API key is availalle on the , Clade API key here
api
The base api used to send requests, you may also specify to a proxy url like: "https://your_proxy_domain/v1". For Azure APIs, you can find relevant information on the Azure resource dashboard, the form of API is usually: https://{your origization}.openai.azure.com/
api_type
fixed value for "open_ai", "azure" or "anthropic"
import oneapi
res = oneapi.OneAPITool.from_config_file("your_config_file.json").simple_chat("Hello AI!")
print(res)
2. derectly set the api_key in code
import oneapi
res = oneapi.OneAPITool.from_config(api_key, api, api_type).simple_chat("Hello AI!")
print(res)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for one_api_tool-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e559fd30e41aa1acb1bf9e9be63c530d82f83e43fceb436762a9676202504b4 |
|
MD5 | 6f1272863649e733ea18f1551aefd0ff |
|
BLAKE2b-256 | fcac195250c805c91018bac2da6106060a6c25d93933057a72d20b1b4e987e8f |