Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/winlinvip/go-openai-example
https://github.com/winlinvip/go-openai-example
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/winlinvip/go-openai-example
- Owner: winlinvip
- License: mit
- Created: 2024-01-09T08:27:16.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-05-19T13:03:45.000Z (7 months ago)
- Last Synced: 2024-05-20T00:37:15.855Z (7 months ago)
- Language: Go
- Size: 68.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-openai-example
This is an example of using the [OpenAI API](https://platform.openai.com/docs/api-reference).
## Usage
First, create `.env` and setup the API key, from [here](https://platform.openai.com/api-keys) you can create and get the API key.
```bash
OPENAI_API_KEY=sk-xxxxxx
OPENAI_PROXY=https://api.openai.com/v1
```Then, run test for OpenAI service:
```bash
go test openai_test.go -v
```If want to test Tencent AI service, create a `.env.tencent` file:
```bash
TENCENT_SPEECH_APPID=xxxx
TENCENT_SECRET_ID=xxxx
TENCENT_SECRET_KEY=xxxx
```Then, run test for Tencent AI service:
```bash
go test tencent_test.go -v
```