A simple REST API built with Go and Gin framework that interfaces with Groq's LLM API to process text requests.
- RESTful endpoint for LLM interactions
- Uses Groq's API for text generation
- Environment-based configuration
- JSON request/response handling
- Go 1.x
- Groq API key
-
Clone the repository:
git clone git@github.com:nikitazuevblago/LLMApi.git cd LLMApi -
Initialize Go module and install dependencies:
go mod init github.com/nikitazuevblago/LLMApi go mod tidy -
Create a
.envfile in the root directory with:GROQ_API_KEY=your_api_key_here GROQ_MODEL=your_preferred_model
Start the server:
go run main.go
The server will start on localhost:8080
Send a message to the LLM and get a response.
Request body:
{
"message": "Your message here"
}Response:
{
"response": "LLM generated response"
}GROQ_API_KEY: Your Groq API keyGROQ_MODEL: The Groq model to use for completions