Skip to main content

Client Libraries

Kallglot does not currently provide official SDKs or client libraries.

Current Status

Official Kallglot SDKs for Node.js, Python, Ruby, Go, and browser environments are not available yet.
If you need to integrate today, use the API directly with your language’s standard HTTP and WebSocket tooling.
  • Use the REST API over HTTPS with a Bearer token
  • Use the session stream.url and stream.token for WebSocket audio streaming
  • Verify webhooks with the Kallglot-Signature header
  • Build thin internal wrappers for retries, auth headers, and error handling

Direct API Examples

JavaScript / TypeScript

const response = await fetch('https://api.kallglot.com/v1/sessions', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.KALLGLOT_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID()
  },
  body: JSON.stringify({
    mode: 'bidirectional_translation',
    source_language: 'de',
    target_language: 'en'
  })
});

const session = await response.json();
console.log(session.id);

Python

import os
import requests
import uuid

response = requests.post(
    'https://api.kallglot.com/v1/sessions',
    headers={
        'Authorization': f'Bearer {os.environ["KALLGLOT_API_KEY"]}',
        'Content-Type': 'application/json',
        'Idempotency-Key': str(uuid.uuid4())
    },
    json={
        'mode': 'bidirectional_translation',
        'source_language': 'de',
        'target_language': 'en'
    }
)

session = response.json()
print(session['id'])

Ruby

require 'net/http'
require 'json'
require 'securerandom'

uri = URI('https://api.kallglot.com/v1/sessions')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{ENV['KALLGLOT_API_KEY']}"
request['Content-Type'] = 'application/json'
request['Idempotency-Key'] = SecureRandom.uuid
request.body = {
  mode: 'bidirectional_translation',
  source_language: 'de',
  target_language: 'en'
}.to_json

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

session = JSON.parse(response.body)
puts session['id']

Go

package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "os"
)

func main() {
    payload, _ := json.Marshal(map[string]string{
        "mode": "bidirectional_translation",
        "source_language": "de",
        "target_language": "en",
    })

    req, _ := http.NewRequest("POST", "https://api.kallglot.com/v1/sessions", bytes.NewBuffer(payload))
    req.Header.Set("Authorization", "Bearer "+os.Getenv("KALLGLOT_API_KEY"))
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    var session map[string]any
    json.NewDecoder(resp.Body).Decode(&session)
    fmt.Println(session["id"])
}

Browser Integrations

For browser-based clients:
  • Create sessions server-side with your API key
  • Pass only the short-lived stream.token and stream.url to the browser
  • Open the WebSocket directly from the browser with the session token
  • Never expose your API key in client-side code

Build Your Own Wrapper

If you want a more ergonomic integration, build a thin internal client around:
  • Bearer token authentication
  • JSON request and response parsing
  • Idempotency keys for POST endpoints
  • Retries for 429, 500, and 502
  • Error normalization from the API error envelope
  • Webhook signature verification

Helpful Docs