Skip to content

Generate an SDK

Generate a type-safe API client for any language from the Tholos OpenAPI spec.

The Tholos API publishes a full OpenAPI 3.1 specification that you can use to generate a type-safe client in any language. This means you get autocomplete, type checking, and up-to-date method signatures without maintaining a hand-written SDK.

https://api.tholos.app/openapi.json

You can point any OpenAPI-compatible code generator at this URL to produce a client for your language of choice.

@hey-api/openapi-ts generates a fully typed client with optional React Query integration.

  1. Install the generator

    Terminal window
    pnpm add -D @hey-api/openapi-ts
    pnpm add @hey-api/client-fetch
  2. Create a config file

    Create openapi-ts.config.ts in your project root:

    import { defineConfig } from "@hey-api/openapi-ts";
    export default defineConfig({
    input: "https://api.tholos.app/openapi.json",
    output: {
    path: "src/generated/tholos",
    format: "prettier",
    },
    client: "@hey-api/client-fetch",
    plugins: ["@hey-api/typescript", "@hey-api/sdk"],
    });
  3. Generate the client

    Terminal window
    npx openapi-ts

    This creates typed functions for every API endpoint in src/generated/tholos/.

  4. Use the generated client

    import { client, getMe, getOrganizationVaults } from "./generated/tholos";
    client.setConfig({
    baseUrl: "https://api.tholos.app",
    headers: {
    Authorization: `Bearer ${process.env.THOLOS_API_TOKEN}`,
    },
    });
    const { data: user } = await getMe();
    console.log(user);
    const { data: vaults } = await getOrganizationVaults({
    path: { organization_id: 123 },
    });
    console.log(vaults);

openapi-python-client generates a typed Python client with httpx.

  1. Install the generator

    Terminal window
    pip install openapi-python-client
  2. Generate the client

    Terminal window
    openapi-python-client generate \
    --url https://api.tholos.app/openapi.json \
    --output-path ./tholos_client
  3. Use the generated client

    from tholos_client import Client, AuthenticatedClient
    client = AuthenticatedClient(
    base_url="https://api.tholos.app",
    token="tholos_pat_your_token_here",
    )
    from tholos_client.api.user import get_me
    response = get_me.sync(client=client)
    print(response)

ogen generates a Go client with full type definitions and built-in security support. We recommend ogen over oapi-codegen because it supports OpenAPI 3.1.

  1. Install the generator

    Terminal window
    go install github.com/ogen-go/ogen/cmd/ogen@latest
  2. Create a config file

    Create ogen.yml in your project:

    generator:
    ignore_not_implemented: ["all"]

    The ignore_not_implemented setting tells ogen to skip operations it cannot generate (e.g., complex anyOf schemas) instead of failing.

  3. Generate the client

    Terminal window
    curl -o openapi.json https://api.tholos.app/openapi.json
    ogen --config ogen.yml --target tholos --clean openapi.json

    This creates a fully typed client and request/response types in the tholos/ directory.

  4. Use the generated client

    package main
    import (
    "context"
    "fmt"
    "github.com/ogen-go/ogen/ogenerrors"
    "your-module/tholos"
    )
    // bearerTokenSource provides PAT authentication.
    type bearerTokenSource struct {
    token string
    }
    func (s *bearerTokenSource) APIKeyCookie(_ context.Context, _ tholos.OperationName) (tholos.APIKeyCookie, error) {
    return tholos.APIKeyCookie{}, ogenerrors.ErrSkipClientSecurity
    }
    func (s *bearerTokenSource) APIKeyHeader(_ context.Context, _ tholos.OperationName) (tholos.APIKeyHeader, error) {
    return tholos.APIKeyHeader{APIKey: "Bearer " + s.token}, nil
    }
    func main() {
    client, _ := tholos.NewClient(
    "https://api.tholos.app",
    &bearerTokenSource{token: "tholos_pat_your_token_here"},
    )
    resp, _ := client.GetMe(context.Background())
    fmt.Println(resp)
    }

Any OpenAPI code generator works with the Tholos spec. Some popular options:

LanguageGenerator
Rubyopenapi-generator with the ruby client
Java/Kotlinopenapi-generator with the java or kotlin client
Swiftopenapi-generator with the swift6 client
Rustprogenitor
C#/.NETNSwag or Kiota

For any generator, point it at https://api.tholos.app/openapi.json and configure it to use Bearer token authentication.

The OpenAPI spec is always up to date with the latest API version. To pick up new endpoints or changes, re-run your generator command. We recommend adding the generation step to your CI pipeline or as a package script:

{
"scripts": {
"generate:api": "openapi-ts"
}
}