Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hrvojecukman/chat_gpt_flutter
https://github.com/hrvojecukman/chat_gpt_flutter
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hrvojecukman/chat_gpt_flutter
- Owner: hrvojecukman
- License: mit
- Created: 2022-12-31T16:39:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-03T11:24:23.000Z (11 months ago)
- Last Synced: 2024-08-02T20:47:30.505Z (4 months ago)
- Language: Dart
- Size: 354 KB
- Stars: 14
- Watchers: 2
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- Awesome-ChatGPT - chat_gpt_flutter
- awesome-chatgpt - chat_gpt_flutter
README
ChatGPT API implemented in Flutter
[![Buy Me A Coffee](https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png "Buy Me A Coffee")](https://www.buymeacoffee.com/hrvojecukman "Buy Me A Coffee")
![Usage example](https://hrvojecukman.github.io/chat_gpt/chat_gpt.gif)
## Getting started
You have to create OpenAI account and request API key from
here: https://beta.openai.com/account/api-keys## Stream usage
```dart
final chatGpt = ChatGpt(apiKey: apiKey);
final question =
'Which Disney character famously leaves a glass slipper behind at a royal ball?';final request = CompletionRequest(
prompt: question,
stream: true,
maxTokens: 4000,
model: ChatGptModel.textDavinci003.key,
);final stream = await chatGpt.createCompletionStream(request);
```
## Usage without stream```dart
final chatGpt = ChatGpt(apiKey: apiKey);
final testPrompt =
'Which Disney character famously leaves a glass slipper behind at a royal ball?';final testRequest = CompletionRequest(
prompt: testPrompt,
model: ChatGptModel.textDavinci003.key,
);final result = await chatGpt.createCompletion(testRequest);
```