A Dart API client for OpenAI. You can use it in Dart or Flutter applications. for more information please refer to Openai API reference.
MIT License
APIs have been supported by this library. Update to support latest models. Now you can use the API to create speech and generate images with Dall-E 3.
final client = OpenaiClient(
config: OpenaiConfig(
apiKey: Env.apiKey, // your api key from openai.com
baseUrl: Env.baseUrl, // you can set your reverse proxy api
httpProxy: Env.httpProxy, // if you need access api through http proxy
),
);
final result = await client.createTranscription(
TranscriptionRequest(
file: 'assets/ttsmaker-file-2023-3-22-14-57-0.mp3',
),
);
print(result.text);
final translateResult = await client.createTraslation(
TranslationRequest(
file: 'assets/ttsmaker-file-2023-3-22-17-27-30.mp3',
// file: "assets/ttsmaker-file-2023-3-22-14-2-35.mp3",
// Wierd. this will be translated into Pinyin for Chinese if prompt not set.
// 你好朋友,我好想你。
// Ni Hao Peng You, Wo Hao Xiang Ni
// prompt: "Please translate into Chinese.",
),
);
Thanks goes to these wonderful people:
Contributions of any kind welcome!