Skip to content

Client

The client handles authentication, request building, response parsing, and SSE streaming. Both the Go and TypeScript SDKs expose the same flat method surface — one method per /api/sdk/* endpoint.

import tavora "github.com/tavora-ai/tavora-sdk-go"
client := tavora.NewClient(
"https://api.tavora.ai", // or http://localhost:8080 in dev
"tvr_your_api_key", // app-scoped API key
)

The API key determines which app all operations are scoped to. One key, one app — multi-app deployments mint one key per app and create a separate client per app.

Every request sends X-API-Key: tvr_... to /api/sdk/*. Keys are app-scoped — one key, one app. Mint one in the admin web UI (covered in the platform’s internal docs) and either pass it to the client directly or store it via tavora login so the CLI picks it up too.

To work with multiple apps from the same process, create separate clients:

prodClient := tavora.NewClient(baseURL, "tvr_prod_key")
stagingClient := tavora.NewClient(baseURL, "tvr_staging_key")

Failures return a typed error with code, message, and a details map carrying any structured fields from the server. Two recovery helpers ship out of the box:

doc, err := client.GetDocument(ctx, id)
if err != nil {
if conflict, ok := tavora.AsVersionConflict(err); ok {
// 409: re-read, merge, retry with conflict.CurrentVersion
}
var apiErr *tavora.APIError
if errors.As(err, &apiErr) {
log.Printf("[%d] %s — code=%s details=%v",
apiErr.StatusCode, apiErr.Message, apiErr.Code, apiErr.Details)
}
}

Network errors (DNS, timeout, TLS) come through as error / exception values from the underlying transport — they don’t carry an HTTP status.

In development the server typically runs at http://localhost:8080. In production, point at your deployed Tavora instance — https://api.tavora.ai for the hosted platform, or your self-hosted hostname.

  • MCP servers — declare your domain API in agent.jsonc → mcp so the agent can call your tools.
  • Browser-based chat — session-token exchange for browser SDK consumers.
  • tavora CLI — author agents code-first with init / dev / deploy.