Skip to content

[DEPRECATED WARNING] Add SecretKey List it and Delete it API SDK

License

Notifications You must be signed in to change notification settings

Esonhugh/OpenAI-Platform-API

Repository files navigation

Simple OpenAI Platform API

Support list keys add key and delete key with it

checkout test/demo.go file about it

Idea comes from https://github.com/linweiyuan/go-chatgpt-api project. Thanks and respect.

Lib Usage

package main

import (
	"log"
	"github.com/esonhugh/openai-platform-api"
)

func main() {
	c := platform.NewUserPlatformClient("accessToken there")
	_, err := c.LoginWithAccessToken()
	if err != nil {
		log.Println(err)
		return
	}
	// if you want accessToken based without login by username and password please use this with
	//  c.LoginWithAccessToken()
	// or replace it with
	//  c.LoginWithAuth0("username", "password")
	resp, err := c.GetSecretKeys()
	if err != nil {
		log.Println(err)
		return
	}
	log.Println(resp)
}

Cli tool guides

Installation

go install github.com/esonhugh/openai-platform-api/cmd/openai-cli@latest

Before use

# you need create a config file in ~/.config folder
cat << EOF > ~/.config/openai-cli/config.yaml
openai:
  username: your-openai-username
  password: your-openai-password
secret_key_prefix: temp
EOF

Basic Usage

export https_proxy=http://127.0.0.1:7890 # optional
openai-cli key ls

About

[DEPRECATED WARNING] Add SecretKey List it and Delete it API SDK

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages