Metadata-Version: 2.4
Name: apibazzar
Version: 0.1.3
Summary: Python SDK for APIBazzar — call standardized Blocks (translation, OCR, summarization, and more) instead of building them yourself
License-Expression: MIT
Project-URL: Homepage, https://apibazzar.com
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.32

# apibazzar

Python SDK for [APIBazzar](https://apibazzar.com) — a marketplace of standardized,
callable **Blocks** (translation, OCR, summarization, and more). Instead of building a feature
yourself, search for a Block and call it:

> **필요한 기능을 다시 만들지 말고, 가져다 조립하세요.**
> *(Don't rebuild the feature you need — find it and plug it in.)*

## Install

```bash
pip install apibazzar
```

## Usage

Get an API key from your [APIBazzar dashboard](https://apibazzar.com/dashboard/api-keys),
then:

```python
from apibazzar import Client

client = Client(api_key="ab_live_...")

result = client.run(
    "translation",
    data={"text": "Hello", "target_language": "Korean"},
)
print(result)  # {"translated_text": "안녕하세요"}
```

If you call the same Block repeatedly, `client.service()` saves you from repeating the slug:

```python
translate = client.service("translation")
result = translate(data={"text": "Hello", "target_language": "Korean"})
```

### Secrets

Some Blocks call external APIs (e.g. OpenAI) on your behalf. Register your own key once in the
dashboard under **Secrets**, and it's used automatically — or pass it per-request if you'd rather
not store it:

```python
result = client.run(
    "summarization",
    data={"text": long_article},
    secrets={"OPENAI_API_KEY": "sk-..."},
)
```

### Errors

Failed calls raise `apibazzar.APIBazzarError` with the server's error message:

```python
from apibazzar import APIBazzarError

try:
    client.run("translation", data={"text": "Hello"})  # missing required field
except APIBazzarError as exc:
    print(exc)  # "translation: Input validation failed: 'target_language' is a required property"
```

## Links

- [Browse available Blocks](https://apibazzar.com)
