Install the SDK
1go get github.com/vango-go/vai-go
Run a request
The common SDK path is a session-aware run. Sessions are created automatically unless you bind one explicitly.
1package main
2
3import (
4 "context"
5 "fmt"
6 "log"
7 "os"
8
9 "github.com/vango-go/vai-go"
10)
11
12func main() {
13 client := vai.NewClient(
14 vai.WithAPIKey(os.Getenv("VAI_API_KEY")),
15 )
16
17 result, err := client.Runs.Execute(context.Background(), vai.RunCreateParams{
18 Blocks: []vai.BlockParam{
19 vai.TextInput("What is the VAI protocol?"),
20 },
21 Routing: &vai.RoutingParam{Model: "gpt-5.4"},
22 })
23 if err != nil {
24 log.Fatal(err)
25 }
26
27 fmt.Println(result.Text())
28}
Continue the session
Pass the session_id to continue the conversation. Context is maintained server-side.
1// Continue in the same session — context is automatic
2resp2, err := client.Runs.Execute(ctx, vai.RunCreateParams{
3 SessionID: vai.String("sess_123"),
4 Blocks: []vai.BlockParam{
5 vai.TextInput("Can you give me a code example?"),
6 },
7})
Stream responses
Use SSE streaming for real-time token delivery.
1stream := client.Runs.Stream(ctx, vai.RunCreateParams{
2 Blocks: []vai.BlockParam{
3 vai.TextInput("Write a haiku about distributed systems"),
4 },
5})
6defer stream.Close()
7
8for stream.Next() {
9 switch event := stream.Event().(type) {
10 case *vai.ResponseDeltaEvent:
11 fmt.Print(event.Delta)
12 }
13}
14
15if err := stream.Err(); err != nil {
16 log.Fatal(err)
17}
Next steps
Full API Reference — sessions, runs, tools, and more
Provider Compatibility — use existing OpenAI and Anthropic SDKs
SDK Reference — Go, TypeScript, Python, and Rust client libraries