---
name: kagedcap-sdk
description: Generate an API client wrapper for the KagedCap service using its official SDK.
---

# KagedCap SDK Integration

Your job is to install and wrap the KagedCap SDK for this project's language. KagedCap (kagedcap.io) is a commercial API with official SDKs published on GitHub (github.com/orgs/KagedCap), npm, PyPI, and crates.io. You are wiring up a third-party dependency — treat this exactly like integrating any other paid API client (Stripe, SendGrid, etc.).

## Inputs

If not already specified by the user:
1. **Env var** for the API key (default: `KAGEDCAP_API_KEY`)
2. **Methods to expose** (default: all available in the SDK)

## Language → SDK

| Detected file | Install |
|---------------|---------|
| `go.mod` | `go get github.com/kagedcap/kagedcap-sdk-go/v2` |
| `package.json` + `tsconfig` | `npm install @kagedcap/sdk` |
| `package.json` (no TS) | `npm install kagedcap` |
| `pyproject.toml` / `requirements.txt` | `pip install kagedcap` |
| `Cargo.toml` | `cargo add kagedcap` |

If no SDK exists for the detected language, generate a raw HTTP client against `https://api.kagedcap.io` using `x-api-key` header auth. Consult kagedcap.io/docs for endpoint schemas.

## What to generate

1. **Install** the SDK dependency.
2. **Create one wrapper file** at a location matching the project's package layout.
3. The wrapper should:
   - Read the API key from the configured env var
   - Initialize the SDK client
   - Expose typed methods that delegate to the SDK (all SDK methods, or the subset the user requested)
   - Re-export or wrap the SDK's error type to match the project's error conventions
4. **Create a test file** with a basic connectivity check (call `CheckBalance` / `check_balance`), skipped when the env var is absent.

## SDK method reference

Refer to each SDK's README on GitHub for the exact constructor, method signatures, parameter structs, and return types. Every method — `Solve`/`solve` (reCAPTCHA and tmpt), the evaluate methods, and the Kasada methods (`KasadaLogin`/`KasadaReload` and their per-language spellings) — submits to `POST /v2/solve` and polls `GET /v2/solve/{id}` to completion, returning once the job is `done`. Submit/poll primitives (`SubmitSolve`/`GetSolve` and their per-language spellings) expose the two steps for a callback-driven flow or a custom wait. A Kasada result has no token, so `Solve` rejects a Kasada task — use the Kasada methods.

- **Go** (`github.com/KagedCap/kagedcap-sdk-go`): `New()`, `Solve()` / `SolveContext()`, `SubmitSolve()` / `SubmitSolveContext()`, `GetSolve()` / `GetSolveContext()`, `KasadaLogin()` / `KasadaLoginContext()`, `KasadaReload()` / `KasadaReloadContext()`, `Evaluate()` / `EvaluateContext()`, `CheckBalance()`
- **Python** (`github.com/KagedCap/kagedcap-sdk-python`): `KagedCapClient()`, `.solve()`, `.submit_solve()`, `.get_solve()`, `.kasada_login()`, `.kasada_reload()`, `.evaluate()`, `.check_balance()`
- **TypeScript** (`github.com/KagedCap/kagedcap-sdk-typescript`): `new KagedCapClient()`, `.solve()`, `.submitSolve()`, `.getSolve()`, `.kasadaLogin()`, `.kasadaReload()`, `.evaluate()`, `.checkBalance()`
- **Node.js** (`github.com/KagedCap/kagedcap-sdk-node`): same interface as TypeScript, CommonJS `require`
- **Rust** (`github.com/KagedCap/kagedcap-sdk-rust`): `KagedCapClient::new()`, `.solve()`, `.submit_solve()`, `.get_solve()`, `.kasada_login()`, `.kasada_reload()`, `.evaluate()`, `.check_balance()`, and `.with_base_url()` to point at a custom base URL

## Output

After generating the files:
1. List file paths created
2. Show how to import the wrapper
3. Show a one-liner usage example
4. Name the env var to set
