Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.
Memory
go-perplexity
Try itUnofficial Go client for the Perplexity REST API at https://api.perplexity.ai. Package perplexity (github.com/psyb0t/go-perplexity), generated with oapi-codegen from Perplexity's OpenAPI document, has one typed method per endpoint on the client from perplexity.NewClientWithResponses, covering Sonar chat completions (sync and async), web search, embeddings and contextualized embeddings, agents and their files, skills, decisions, models and usage analytics, with JSON bodies decoded into Go structs. Auth is a bearer API key set through a request editor. Use when Go code needs to call the Perplexity API or already imports go-perplexity.
What it does
Typed Go client for the Perplexity API. Every endpoint in Perplexity's OpenAPI document is a method on .
The skill document
go-perplexity
Typed Go client for the Perplexity API. Every endpoint in Perplexity's OpenAPI document is a method on ClientWithResponses.
For install, the method list, union types and error handling, see references/setup.md.
Security & safety
- Read the API key from an environment variable such as
PERPLEXITY_API_KEY. Never hardcode it, commit it or log it, and never print request headers. - Requests go only to the base URL passed to
NewClientWithResponses. Usehttps://api.perplexity.ai. - Calls cost money and some change account state (creating, updating and deleting skills, creating and cancelling agent runs). Make those calls only when the user asked for them, and only on resources the task created or named.
When to use
- Go code needs Sonar answers with citations, Perplexity web search, embeddings or another Perplexity endpoint.
- The project already imports
github.com/psyb0t/go-perplexity.
When NOT to use
- The code is not Go.
- You need streaming. The generated methods read the whole response body; for server-sent events, use the plain
Clientmethod, which returns the*http.Responsewith the body unread, and parse the stream yourself.
Usage
import (
"context"
"fmt"
"net/http"
"os"
"github.com/psyb0t/go-perplexity"
)
auth := perplexity.WithRequestEditorFn(func(_ context.Context, req *http.Request) error {
req.Header.Set("Authorization", "Bearer "+os.Getenv("PERPLEXITY_API_KEY"))
return nil
})
client, err := perplexity.NewClientWithResponses("https://api.perplexity.ai", auth)
if err != nil {
return err
}
A Sonar chat completion. Message content is a union, built and read with From... and As... helpers (Content0 is plain text):
var content perplexity.ChatMessageInput_Content
if err := content.FromChatMessageInputContent0("What changed in Go 1.26?"); err != nil {
return err
}
res, err := client.ChatCompletionsChatCompletionsPostWithResponse(ctx, perplexity.ApiChatCompletionsRequest{
Model: perplexity.ApiChatCompletionsRequestModelSonar,
Messages: []perplexity.ChatMessageInput{{
Content: &content,
Role: perplexity.ChatMessageRoleUser,
}},
})
if err != nil {
return err // transport error
}
if res.JSON200 == nil {
return fmt.Errorf("sonar: status %d: %s", res.StatusCode(), res.Body)
}
for _, choice := range res.JSON200.Choices {
if choice.Message.Content == nil {
continue
}
text, err := choice.Message.Content.AsChatMessageOutputContent0()
if err == nil {
fmt.Println(text)
}
}
A web search:
var query perplexity.ApiSearchRequest_Query
if err := query.FromApiSearchRequestQuery0("go generics tutorial"); err != nil {
return err
}
maxResults := 5
found, err := client.SearchSearchPostWithResponse(ctx, perplexity.ApiSearchRequest{
Query: query,
MaxResults: &maxResults,
})
if err != nil {
return err
}
if found.JSON200 == nil {
return fmt.Errorf("search: status %d: %s", found.StatusCode(), found.Body)
}
for _, page := range found.JSON200.Results {
fmt.Println(page.Title, page.Url)
}
Related skills
Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.
Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.
Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.
Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.
Write, debug, and tune Playwright specs with locator strategy, trace diagnosis, and CI-aware timeouts.
More from psyb0t
Browse all skillsDrive a user-deployed mt5-httpapi MetaTrader 5 bridge over HTTP, with per-action confirmation on every real-money call.
Docker-packaged browser automation for QA against anti-bot stacks and authorized detection testing.
Self-hosted OpenAI-compatible speech service — transcription, translation, and synthesis from one container.
Run ffmpeg, sox, and ImageMagick jobs against your files in a fixed-allowlist SSH sandbox.
Generate speech audio via Qwen3-TTS over SSH with preset voices, voice cloning, and voice design.
Drive one or more IMAP/SMTP mailboxes through a single REST + MCP endpoint — read, search, send, mark-seen, and delete across accounts in parallel.