---
title: "Discussion on \"Building a ChatGPT client app with Flutter\" | Hashnode"
description: "Discussion on \"Building a ChatGPT client app with Flutter\". Introduction\nIn this blog post, we will build a simple conversational interface to chat with OpenAI's ChatGPT through its API.\nThere has been a lot of hype with OpenAI and ChatGPT lately, especially with GPT-4 being released recently. A ton of use ca..."
url: "https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Building a ChatGPT client app with Flutter](https://dartling.dev/building-a-chatgpt-client-app-with-flutter?utm_source=hashnode&utm_medium=feed)

Introduction In this blog post, we will build a simple conversational interface to chat with OpenAI's ChatGPT through its API. There has been a lot of hype with OpenAI and ChatGPT lately, especially with GPT-4 being released recently. A ton of use ca...

Mar 17, 2023 · 10 min read · dartling.dev  
Read the article

-   [#dart](https://hashnode.com/tag/dart)
-   [#flutter](https://hashnode.com/tag/flutter)
-   [#chatgpt](https://hashnode.com/tag/chatgpt)
-   [#openai](https://hashnode.com/tag/openai)

## Written by

[Christos](https://hashnode.com/@yallurium)

@yallurium

  
[View profile](https://hashnode.com/@yallurium)

## Responses 7

Markdown supported · ⌘↵ to post

[Jakub Wiśniewski](https://hashnode.com/@jakubwisniewski)

[Nov 29, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/6566bcfecda818ef519dea17)

conversation storage would be great

[Dee](https://hashnode.com/@lavecli)

[Nov 16, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/6556371bae40844d6fdc054f)

Hello, is it possible to pass a system message somehow before any of the messages?

[Christos](https://hashnode.com/@yallurium)

[Nov 19, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/6556371bae40844d6fdc054f#reply-655a27532a6c065f3be4e66f)

Yes, you simply need to add a message at the beginning of the messages in the `completeChat` method. The role should be `system` instead of `user`.

[Jakob](https://hashnode.com/@JakobGrayAus)

[May 23, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/646c4a925ccc6321b7044988)

I cloned the github repo and attempted to run the application, however upon replacement of the API, the application will not run providing the error:

"Const variables must be initialized with a constant value."

If I wrap the api key in '' then the application just says "an error has occurred" when trying to send messages...

Any ideas to help a newbie?

[Christos](https://hashnode.com/@yallurium)

[Nov 19, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/646c4a925ccc6321b7044988#reply-655a270b2a6c065f3be4e658)

You need to get your own API key from OpenAI, otherwise this won't work. (apologies for the late response)

[az](https://hashnode.com/@az96)

[Apr 21, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/64428b424e068825836cb12f)

Can we use voice input/output to the chats? maybe use google stt and tts? and is there any widget to monetize?

[Christos](https://hashnode.com/@yallurium)

[Apr 24, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/64428b424e068825836cb12f#reply-6446bca628221b47cc4901ae)

Voice input/output should be possible! There are a few Flutter plugins making use of Google/Apple APIs for this.

To monetize an app such as this one, you should first move the OpenAI interactions to e.g. your own server, as your API key should remain secret.

[Franklin Mayoyo](https://hashnode.com/@mayoyo)

[Mar 18, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/641543b74f10afbe5c4c36c0)

I liked the article even though am a web dev. I see dart and JavaScript are similar in many ways. I understood the code even though I've touched neither flutter nor dart. Nice article ❤️❤️

[Hongkai Wang](https://hashnode.com/@MiceLife)

[Mar 17, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/6414fcad4f10afbe5c4c2fb8)

Good job

[Rafael dos Santos Miguel Filho](https://hashnode.com/@ThePragmaticEngineer)

[Mar 17, 2023](https://hashnode.com/posts/building-a-chatgpt-client-app-with-flutter/64146492f240fdbee3dba60d/comment/6414b94d4f10afbe5c4c2956)

Awesome! Dart and Flutter are on my future study list, thanks for sharing this rich content with the community!
