Documentation
Getting Started
Go Quickstart
Get your first Laghav-compressed LLM call running in Go in under 5 minutes. Uses the REST API directly — no heavy SDK dependency.
Step 1 — Add the package
bash
go get github.com/laghav-ai/laghav-go
Step 2 — Make your first call
main.go
package mainimport ("fmt""os"laghav "github.com/laghav-ai/laghav-go")func main() {client := laghav.NewClient(os.Getenv("LAGHAV_API_KEY"))resp, err := client.Complete(laghav.CompleteRequest{Messages: []laghav.Message{{Role: "user", Content: "Hey could you help me understand the revenue drop?"},},Model: "auto",})if err != nil {panic(err)}fmt.Println(resp.Choices[0].Message.Content)fmt.Printf("Tokens saved: %d\n", resp.LaghavMeta.OriginalTokens-resp.LaghavMeta.CompressedTokens)fmt.Printf("Quality score: %d/100\n", resp.LaghavMeta.QualityScore)fmt.Printf("Saved: $%.4f\n", resp.LaghavMeta.SavedUSD)fmt.Printf("Model: %s\n", resp.LaghavMeta.ModelRequested)}
Using the REST API directly
Prefer not to use an SDK? You can call the gateway REST API directly with any HTTP client:
rest.go
package mainimport ("bytes""encoding/json""fmt""net/http""os")type CompleteReq struct {Messages []map[string]string `json:"messages"`Model string `json:"model"`}func main() {body, _ := json.Marshal(CompleteReq{Messages: []map[string]string{{"role": "user", "content": "Summarize this meeting transcript"},},Model: "auto",})req, _ := http.NewRequest("POST", "https://api.laghav.ai/v1/complete", bytes.NewBuffer(body))req.Header.Set("Authorization", "Bearer "+os.Getenv("LAGHAV_API_KEY"))req.Header.Set("Content-Type", "application/json")resp, _ := http.DefaultClient.Do(req)defer resp.Body.Close()var result map[string]interface{}json.NewDecoder(resp.Body).Decode(&result)fmt.Println(result)}
ℹRate limit headers
Every response includes
X-RateLimit-Remaining and X-Laghav-Request-Id. Check the rate limits page for details.