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.
Creating a client
Section titled “Creating a client”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", // project-scoped API key)import { Client } from '@tavora/sdk';
const client = new Client( 'https://api.tavora.ai', // or http://localhost:8080 in dev 'tvr_your_api_key', // project-scoped API key);The API key determines which project all operations are scoped to. One key, one project — multi-project deployments mint one key per project and create a separate client per project.
Authentication
Section titled “Authentication”Every request sends X-API-Key: tvr_... to /api/sdk/*. Keys are
project-scoped — one key, one project. 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 projects from the same process, create separate clients:
prodClient := tavora.NewClient(baseURL, "tvr_prod_key")stagingClient := tavora.NewClient(baseURL, "tvr_staging_key")const prodClient = new Client(baseUrl, 'tvr_prod_key');const stagingClient = new Client(baseUrl, 'tvr_staging_key');Error handling
Section titled “Error handling”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) }}import { TavoraAPIError, asVersionConflict, isNotFound, isUnauthorized,} from '@tavora/sdk';
try { await client.getDocument(id);} catch (err) { const conflict = asVersionConflict(err); if (conflict) { // retry with conflict.currentVersion } else if (isNotFound(err)) { // 404 } else if (isUnauthorized(err)) { // 401 — re-mint API key (browser path) or check env (backend path) } else if (err instanceof TavoraAPIError) { console.error(err.status, err.code, err.apiMessage, err.details); }}Network errors (DNS, timeout, TLS) come through as error /
exception values from the underlying transport — they don’t carry an
HTTP status.
Base URL
Section titled “Base URL”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.
What you’d configure next
Section titled “What you’d configure next”- MCP servers — declare your domain API in
agent.jsonc → mcpso the agent can call your tools. - Browser-based chat — session-token exchange for browser SDK consumers.
tavoraCLI — author agents code-first withinit/dev/deploy.