GO-GIN-RESTAPI-OPENAI
1. Introduction
A simple RESTful API in Go using Gin that forwards user messages to OpenAI and returns responses.
2. Architecture
- Language: Go
- Framework: Gin
- AI Integration: OpenAI API
- Flow:
- Client sends JSON to
/chat
.
- Server calls OpenAI with the prompt.
- Server returns OpenAIβs response as JSON.
3. Prerequisites
- Go 1.20 or higher installed
- OpenAI API key available
GO111MODULE=on
(default in Go β₯1.13)
4. Installation
git clone https://github.com/username/go-gin-restapi-openai.git
cd go-gin-restapi-openai
go mod download