Go HTTP Example
This complete program uses the standard library; it needs no third-party SDK dependency. Go 1.22+. Save as example.go; run go run example.go.
Set MAKAS_API_KEY to your full regional token and OPENAI_API_KEY to your provider key in the environment. Select your region above before copying. Run this only on your server/local machine, never a public browser bundle.
package main
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"time"
)
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
body := []byte(`{"model":"gpt-4.1-mini","messages":[{"role":"user","content":"Say hello"}],"max_tokens":64}`)
request, err := http.NewRequestWithContext(ctx, http.MethodPost,
"https://eu.makas.ai/proxy/openai/v1/chat/completions", bytes.NewReader(body))
if err != nil { panic(err) }
request.Header.Set("Content-Type", "application/json")
request.Header.Set("Makas-Api-Key", os.Getenv("MAKAS_API_KEY"))
request.Header.Set("Authorization", "Bearer "+os.Getenv("OPENAI_API_KEY"))
response, err := http.DefaultClient.Do(request)
if err != nil { panic(err) }
defer response.Body.Close()
if response.StatusCode >= 400 { panic(fmt.Sprintf("HTTP %d", response.StatusCode)) }
var result struct { Choices []struct { Message struct { Content string `json:"content"` } `json:"message"` } `json:"choices"` }
if err := json.NewDecoder(response.Body).Decode(&result); err != nil { panic(err) }
if len(result.Choices) == 0 { panic("No response choices") }
fmt.Println(result.Choices[0].Message.Content)
fmt.Println("Routed:", response.Header.Get("Makas-Was-Routed"))
}
The request is bounded to 64 output tokens; provider text varies. Header metadata is conditional. Check Request Logs and the header reference. For Anthropic or Google payload/header differences, use their complete quickstarts.