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¶
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¶
TypeScript¶
Installation¶
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¶
Go¶
Installation¶
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¶
Rust¶
Installation¶
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¶
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¶
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');
}
}
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: