# dart_openai openai sdk ## Usage ``` dart_openai: ^1.9.1 ``` ## Reference 类似项目: - [chat_gpt_sdk](https://pub.dev/packages/chat_gpt_sdk) ``` _openAI = OpenAI.instance.build( token: OPENAI_API_KEY, baseOption: HttpSetup(receiveTimeout: const Duration(seconds: 5)), enableLog: true); final request = ChatCompleteText( model: GptTurbo0301ChatModel(), messages: messagesHistory, maxToken: 200); final response = await _openAI.onChatCompletion(request: request); return response!.choices .map((choice) => ChatMessage( user: ChatUser(id: '2'), createdAt: DateTime.now(), text: choice.message!.content)) .toList(); } ```