Skip to content

New AI assistant answers: ChatGPT, Gemini, Copilot and AI Mode by API

SerpKite
Get API key

Go · go get serpkite

Go + SerpKite

The official SerpKite Go module: typed params and responses, context-aware calls, automatic retries with backoff on 429 and 5xx, and every vertical from web search to Maps and webpages.

Overview

What Go is, and where SerpKite fits

go get github.com/serpkite/serpkite-go gives you package serpkite. serpkite.NewClient() reads SERPKITE_API_KEY; options like WithAPIKey, WithBaseURL, WithHTTPClient and WithMaxRetries override the defaults.

Every call takes a context.Context, which bounds the total time across retries. API errors are *serpkite.Error with Status, Code, Message and RequestID.

Setup

Set it up in 3 steps

  1. 1

    Get an API key

    Sign up (no card), create a key in the dashboard and export it as SERPKITE_API_KEY. New accounts get 2,500 free credits, then 1,000 every month.

    export SERPKITE_API_KEY=skt_live_…
  2. 2

    Add the module

    Standard library HTTP under the hood.

    go get github.com/serpkite/serpkite-go
  3. 3

    Search

    Call c.Search(ctx, serpkite.SearchParams{Q: …}); res.Meta.CreditsUsed is what the call cost.

Code

main.go

Go
package main

import (
	"context"
	"errors"
	"fmt"
	"os"
	"time"

	serpkite "github.com/serpkite/serpkite-go"
)

func main() {
	ctx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
	defer cancel()

	c := serpkite.NewClient() // reads SERPKITE_API_KEY

	res, err := c.Search(ctx, serpkite.SearchParams{Q: "golang context timeout", Country: "us"})
	if err != nil {
		var apiErr *serpkite.Error
		if errors.As(err, &apiErr) {
			fmt.Fprintln(os.Stderr, apiErr.Status, apiErr.Code, apiErr.Message, apiErr.RequestID)
		}
		os.Exit(1)
	}
	for _, r := range res.Results {
		fmt.Println(r.Position, r.Domain, r.Title)
	}
	fmt.Printf("used %v credits\n", res.Meta.CreditsUsed)

	// Markdown for an LLM prompt
	md, err := c.SearchMarkdown(ctx, serpkite.SearchParams{Q: "golang context timeout"})
	if err == nil {
		fmt.Println(md[:200])
	}
}

AI assistants

Ask ChatGPT, Gemini and other AI assistants

c.ChatGPT (with serpkite.ChatGPTParams) and c.Gemini, c.Copilot, c.AIMode and c.BraveAI (with serpkite.AssistantParams) ask an AI assistant as a logged-out visitor and return the answer with the sources it cited. Track adds Mentions: whether the answer names each brand or domain and whether a cited source is on it. See AI assistants.

ChatGPT 4, Gemini 3, Copilot Search 3, Google AI Mode 2 and Brave AI 2 credits per answer; failed, refused and empty answers are free. Brave answers in 1–10 s, ChatGPT in 10–30 s and Gemini in 5–30 s, so allow at least 120 seconds per call.

Go
res, err := c.ChatGPT(ctx, serpkite.ChatGPTParams{
	Prompt: "What are the best CRMs for a 10-person startup?",
	Track:  []string{"hubspot.com", "Pipedrive"},
})
if err != nil {
	log.Fatal(err)
}
fmt.Println(res.Markdown) // citations as [n](link), matching Sources[].Position
for _, m := range res.Mentions {
	fmt.Println(m.Term, m.Mentioned, m.Cited)
}

FAQ

Go and SerpKite: common questions

Start building

Give your Go project Google search

2,500 free credits, then 1,000 every month. No credit card.