Files
sub2api/backend/internal/service/openai_chatgpt_headers.go
T

18 lines
460 B
Go

package service
import "net/http"
func setOpenAIChatGPTAccountHeaders(headers http.Header, account *Account) {
if headers == nil || account == nil || !account.IsOpenAIOAuth() {
return
}
if chatgptAccountID := account.GetChatGPTAccountID(); chatgptAccountID != "" {
headers.Set("chatgpt-account-id", chatgptAccountID)
}
if account.IsChatGPTAccountFedRAMP() {
headers.Set("x-openai-fedramp", "true")
} else {
headers.Del("x-openai-fedramp")
}
}