openai_api 0.3.7 copy "openai_api: ^0.3.7" to clipboard
openai_api: ^0.3.7 copied to clipboard

A Dart API client for OpenAI. You can use it in Dart or Flutter applications. for more information please refer to Openai API reference.

openai_api #

openai_api Dart CI

Features #

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.

  • ✅ Chat
  • ✅ Images
  • ✅ Audio
    • ✅ TTS
    • ✅ STT
  • ✅ Models
  • ❌ Edits
  • ❌ Completions
  • ❌ Embeddings
  • ❌ Files
  • ❌ Fine-tunes
  • ❌ Moderations
  • ❌ Engines

Usge #

Initialize Openai Client #

  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
    ),
  );

copied to clipboard

Then call the APIs #

  • Audio Transcription
  final result = await client.createTranscription(
    TranscriptionRequest(
      file: 'assets/ttsmaker-file-2023-3-22-14-57-0.mp3',
    ),
  );
  print(result.text);
copied to clipboard
  • Audio Translation
  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.",
    ),
  );
copied to clipboard

Contributors ✨ #

Thanks goes to these wonderful people:

Contributions of any kind welcome!

Activities #

Alt

13
likes
140
points
176
downloads

Publisher

verified publishermings.in

Weekly Downloads

2024.07.28 - 2025.02.09

A Dart API client for OpenAI. You can use it in Dart or Flutter applications. for more information please refer to Openai API reference.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

cancellation_token_http, envied, envied_generator, freezed_annotation, http_parser, json_annotation

More

Packages that depend on openai_api