MCPcopy Index your code
hub / github.com/SMNETSTUDIO/Groq2API / GetModels

Function GetModels

pkg/groq/request.go:120–142  ·  view source on GitHub ↗
(client tls_client.HttpClient, api_key string, organization string, proxy string)

Source from the content-addressed store, hash-verified

118 return response, nil
119}
120func GetModels(client tls_client.HttpClient, api_key string, organization string, proxy string) (*http.Response, error) {
121 header := baseHeader()
122 header.Set("authorization", "Bearer "+api_key)
123 header.Set("groq-app", "chat")
124 header.Set("groq-organization", organization)
125 if proxy != "" {
126 client.SetProxy(proxy)
127 }
128 req, err := http.NewRequest(http.MethodGet, "https://api.groq.com/openai/v1/models", nil)
129 //response, err := client.Request("GET", "https://api.groq.com/openai/v1/models", header, nil, nil)
130 req.Header = header
131 if err != nil {
132 return nil, err
133 }
134 response, err := client.Do(req)
135 if err != nil {
136 return nil, err
137 }
138 if response.StatusCode != 200 {
139 return nil, errors.New("response status code is not 200")
140 }
141 return response, nil
142}

Callers

nothing calls this directly

Calls 3

baseHeaderFunction · 0.85
SetMethod · 0.80
SetProxyMethod · 0.80

Tested by

no test coverage detected