Skip to content

SDKs

Native integrations. Type-safe SDKs with full API coverage, async support, and excellent developer experience.


Available SDKs

Language Package Status
Python pauhu Stable
TypeScript @pauhu/sdk Stable
Go github.com/pauhu/pauhu-go Stable
Rust pauhu Beta

Python

Installation

pip install pauhu

Quick Start

from pauhu import Pauhu

client = Pauhu(api_key="pk_...")

# Sync API
result = client.translate("Hello", target="fi")
print(result.translation)  # "Hei"

# Async API
import asyncio
from pauhu import AsyncPauhu

async def main():
    client = AsyncPauhu()
    result = await client.translate("Hello", target="fi")
    print(result.translation)

asyncio.run(main())

Features

  • Full type hints (PEP 484)
  • Sync and async clients
  • Pydantic models for all responses
  • Streaming support
  • Automatic retries
  • Rate limit handling

Documentation

Python SDK Reference


TypeScript

Installation

npm install @pauhu/sdk
# or
pnpm add @pauhu/sdk
# or
yarn add @pauhu/sdk

Quick Start

import { Pauhu } from '@pauhu/sdk';

const client = new Pauhu({ apiKey: 'pk_...' });

// Async/await
const result = await client.translate({
  text: 'Hello',
  target: 'fi'
});

console.log(result.translation); // "Hei"

// Streaming
for await (const token of client.translateStream({
  text: 'Hello, world!',
  target: 'fi'
})) {
  process.stdout.write(token);
}

Features

  • Full TypeScript types
  • ESM and CommonJS
  • Node.js and browser support
  • React hooks included
  • Streaming with async iterators
  • Automatic retries

React Hook

import { useTranslate } from '@pauhu/react';

function TranslateComponent() {
  const { translate, result, loading, error } = useTranslate();

  return (
    <button onClick={() => translate('Hello', 'fi')}>
      {loading ? 'Translating...' : result?.translation || 'Translate'}
    </button>
  );
}

Documentation

TypeScript SDK Reference


Go

Installation

go get github.com/pauhu/pauhu-go

Quick Start

package main

import (
    "context"
    "fmt"
    "github.com/pauhu/pauhu-go"
)

func main() {
    client := pauhu.NewClient("pk_...")

    result, err := client.Translate(context.Background(), &pauhu.TranslateRequest{
        Text:   "Hello",
        Target: "fi",
    })
    if err != nil {
        panic(err)
    }

    fmt.Println(result.Translation) // "Hei"
}

Features

  • Idiomatic Go API
  • Context support
  • Concurrent-safe
  • Connection pooling
  • Custom HTTP client support
  • Structured errors

Documentation

Go SDK Reference


Rust

Installation

# Cargo.toml
[dependencies]
pauhu = "0.1"
tokio = { version = "1", features = ["full"] }

Quick Start

use pauhu::Client;

#[tokio::main]
async fn main() -> Result<(), pauhu::Error> {
    let client = Client::new("pk_...")?;

    let result = client.translate()
        .text("Hello")
        .target("fi")
        .send()
        .await?;

    println!("{}", result.translation); // "Hei"
    Ok(())
}

Features

  • Async/await with Tokio
  • Type-safe builder pattern
  • Zero-copy deserialization
  • Connection pooling
  • WASM support (planned)

Documentation

Rust SDK Reference


Common Patterns

Environment Variables

All SDKs support configuration via environment variables:

export PAUHU_API_KEY="pk_..."
export PAUHU_BASE_URL="https://api.pauhu.ai/v1"
export PAUHU_TIMEOUT="30"

Error Handling

from pauhu import Pauhu
from pauhu.exceptions import RateLimitError, AuthenticationError

try:
    result = client.translate("Hello", target="fi")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except AuthenticationError:
    print("Invalid API key")
import { Pauhu, RateLimitError, AuthenticationError } from '@pauhu/sdk';

try {
  const result = await client.translate({ text: 'Hello', target: 'fi' });
} catch (e) {
  if (e instanceof RateLimitError) {
    console.log(`Rate limited. Retry after ${e.retryAfter}s`);
  } else if (e instanceof AuthenticationError) {
    console.log('Invalid API key');
  }
}
result, err := client.Translate(ctx, req)
if err != nil {
    var rateLimitErr *pauhu.RateLimitError
    if errors.As(err, &rateLimitErr) {
        log.Printf("Rate limited. Retry after %ds", rateLimitErr.RetryAfter)
    }
}

Retries

All SDKs include automatic retry logic:

from pauhu import Pauhu

client = Pauhu(
    api_key="pk_...",
    max_retries=3,
    retry_delay=1.0,  # seconds
    retry_statuses=[429, 500, 502, 503, 504]
)

Timeouts

from pauhu import Pauhu

client = Pauhu(
    api_key="pk_...",
    timeout=30.0,  # seconds
    connect_timeout=5.0
)

Community SDKs

Community-maintained SDKs:

Language Package Maintainer
Java io.pauhu:pauhu-java Community
C# Pauhu.SDK Community
PHP pauhu/pauhu-php Community
Ruby pauhu Community

Community Support

Community SDKs are not officially supported. Use at your own discretion.


OpenAPI Codegen

Generate clients for any language:

# Download OpenAPI spec
curl -o openapi.json https://api.pauhu.ai/v1/openapi.json

# Generate client (example: Java)
openapi-generator generate \
  -i openapi.json \
  -g java \
  -o ./pauhu-java