MultiVibe Cloud

Developers

← Back to dashboard

SDK GUIDE / SOURCE PREVIEW

Go

Cloud · context cancellation

1. Set up your project

Start from sdk/go in the Cloud repository. These commands use the local source package, not a registry release.

go test ./...
go run ./examples/basic

2. Prepare authentication

Server examples read MULTIVIBE_BASE_URL and MULTIVIBE_TOKEN from the environment. Use an origin without /v1. Never ship a project key in a browser or mobile bundle.

For client applications, use a user-authorized OAuth access-token provider and OS-secure storage. Browser refresh and exchange require a backend. Backendless publisher-funded sessions are not implemented.

Follow the OAuth + PKCE guide →

3. Make your first request

This example discovers models. Mobile snippets belong in your authenticated application; they are not standalone app projects.

examples/basic/main.go
package main

import (
	"context"
	"fmt"
	"multivibe.cloud/sdk/go"
	"os"
)

func main() {
	c, e := multivibe.New(os.Getenv("MULTIVIBE_BASE_URL"), func(context.Context) (string, error) { return os.Getenv("MULTIVIBE_TOKEN"), nil }, nil)
	if e != nil {
		panic(e)
	}
	if _, e = c.Models(context.Background()); e != nil {
		panic(e)
	}
	fmt.Println("Model catalog request succeeded (response not logged).")
}

Next steps

Choose a compatible model from the catalog before inference. Handle expired access, insufficient scope and unavailable models separately. Never retry a billable inference blindly after a timeout or partial stream.

Operations, streaming and usage →

Local execution and fallback policy →