---
title: "How to use OpenAI API with WizFi360"
url: "https://maker.wiznet.io/austin/projects/how-to-use-openai-api-with-wizfi360/"
markdown_url: "https://maker.wiznet.io/austin/projects/how-to-use-openai-api-with-wizfi360/md"
type: "WCC: WIZnet Created Content"
author: "austin"
original_author: "Austin"
published: "2023-06-23"
language: "en"
hardware: ["WIZnet WizFi360-EVB-Shield"]
likes: 1
views: 220
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# How to use OpenAI API with WizFi360

> How to use ChatGPT service using OpenAI API with WizFi360.

Original author: Austin

## Components

- **WIZnet WizFi360-EVB-Shield** x 1 ([docs](https://docs.wiznet.io/Product/Wi-Fi-Module/WizFi360/wizfi360_evb_shield))

## Article

In this document I will provide instructions how to use **ChatGPT** using **OpenAI** with WIZnet's Wi-Fi product - **WizFi360-EVB-Shield**.

WizFi360-EVB-shield was used as a **stand-alone**, and after connecting WizFi360-EVB-Shield to desktop with USB type A to USB micro B cable, I entered and used **AT commands** through serial to use OpenAI and ChatGPT service.

### **1. Environment Preparation**

- **Hardware**

I'll use [**WizFi360-EVB-Shield**](https://docs.wiznet.io/Product/Wi-Fi-Module/WizFi360/wizfi360_evb_shield).

Even if it is not WizFi360-EVB-Shield, if WizFi360 is included like WizFi360-EVB-Mini and has the environment where AT commands can be input through serial, it is fine.

- **Software**

Here I'll use [**Tera Term**](https://osdn.net/projects/ttssh2/releases/) as the terminal program.

If you have another terminal program you prefer, feel free to use it.

- **OpenAI API KeyOpenAI API key** is required to connect to OpenAI and use ChatGPT service.

Follow the steps below to generate the OpenAI API key.

① [**OpenAI**](https://openai.com/) **Sign up** & **Log-in**.

![](https://hackster.imgix.net/uploads/attachments/1604544/image_4HCYKZqXuk.png?auto=compress%2Cformat&w=740&h=555&fit=max)

② Select **API**.

![](https://hackster.imgix.net/uploads/attachments/1604545/image_LHrwuiYq5w.png?auto=compress%2Cformat&w=740&h=555&fit=max)

③ Select **View API keys**.

![](https://hackster.imgix.net/uploads/attachments/1604546/image_hqkqMBZais.png?auto=compress%2Cformat&w=740&h=555&fit=max)

④ Select **+ Create new secret key** and generate **API Key**.

![](https://hackster.imgix.net/uploads/attachments/1604548/image_5FxV99bvpV.png?auto=compress%2Cformat&w=740&h=555&fit=max)

### **2. AT command**

Refer to the AT commands below and input the AT commands through serial.

```plaintext
/* Restore factory default settings */
AT+RESTORE=1

/* Check WizFi360 Version */
AT+GMR

/* Setup Wi-Fi and connect to AP */
AT+CWMODE_CUR=1
AT+CWDHCP_CUR=1,1
AT+CWJAP_CUR="SSID","PASSWORD"

/* Connect to OpenAI */
AT+CIPSTART="SSL","api.openai.com",443

/* Prepare to input data to send */
AT+CIPSEND=283

/* Input data to send */
POST /v1/chat/completions HTTP/1.1
Host: api.openai.com
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
Content-Length: 92

{
    "model": "gpt-3.5-turbo",
    "messages": [{"role": "user", "content": "Hello!"}]
}
```

### **3. Result**

If you enter AT commands normally, you can see the result as below.

![](https://maker.wiznet.io/upload/ckeditor5/67375825%5F1687773374%2Epng)

---

Source: https://maker.wiznet.io/austin/projects/how-to-use-openai-api-with-wizfi360/
