Skip to content

SDKs

Generation Model

SDKs are generated from the external OpenAPI schema in CI. The workflow prefers a committed docs/openapi.json when present and otherwise falls back to the deployed schema at:

https://api.tanfi.ai/api/v1/ext/openapi.json

Generated output targets:

  • sdks/python
  • sdks/typescript

Current Status

The repository now includes the generation pipeline and placeholder SDK directory. Package publishing is not wired in this task, so direct HTTP remains the supported integration path until release packaging is added.

Python Example

import requests

response = requests.post(
    "https://api.tanfi.ai/api/v1/ext/kb/query",
    headers={
        "X-API-Key": "bach_live_...",
        "Content-Type": "application/json",
    },
    json={"query": "Basel operational risk", "top_k": 5},
    timeout=10,
)
response.raise_for_status()
print(response.json())

TypeScript Example

const response = await fetch("https://api.tanfi.ai/api/v1/ext/kb/query", {
  method: "POST",
  headers: {
    "X-API-Key": "bach_live_...",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ query: "model risk management", top_k: 5 }),
});

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

console.log(await response.json());

Regenerate Locally

curl -fsS https://api.tanfi.ai/api/v1/ext/openapi.json -o docs/openapi.json

docker run --rm \
  -v "${PWD}:/local" \
  openapitools/openapi-generator-cli:v7.4.0 generate \
  -i /local/docs/openapi.json \
  -g python \
  -o /local/sdks/python