Search packages, repositories and app categories

GitHub repositoryhrvojecukman/chat_gpt_flutter

chat_gpt_flutter

hrvojecukman/chat_gpt_flutter open-source repository details.

chat_gpt_flutter project cover
Stars
19
Forks
8
Last push (UTC)
Jan 3, 2024
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

ChatGPT API implemented in Flutter

Buy Me A Coffee

Usage example

Getting started

You have to create OpenAI account and request API key from here: https://beta.openai.com/account/api-keys

Stream usage


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


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

Hrvoje Čukman GitHub avatar
GitHub author

Hrvoje Čukman ↗

Flutter Developer

LanguagesDartC++CMakeHTMLCSwiftKotlinObjective-C

Packages published by this repository

Dependencies used

Dependency list 10 items

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗