› cavi-ai/
GitHub ↗

Verified example · TypeScript

Custom provider

examples/custom-provider.ts

@cavi-ai/api-clientv0.21.007f0ee45
TypeScript · complete source
import {
  createRuntimeClient,
  createRuntimeProviderRegistry,
  type RuntimeClient,
  type RuntimeProviderModule,
} from "@cavi-ai/api-client";

// Supply your real request/mapping implementation; this adapter does not invent a run.
export function createCustomRuntime(baseUrl: string, startRun: RuntimeClient["startRun"]) {
  const module: RuntimeProviderModule = {
    kind: "acme",
    capabilities: { runs: true },
    createClient: () => ({
      getRuntimeCapabilities: async () => ({ providerKind: "acme", supports: { runs: true } }),
      startRun,
    }),
  };
  return createRuntimeClient(module.kind, {
    registry: createRuntimeProviderRegistry({ modules: [module] }),
    clientOptions: { baseUrl },
  });
}

Package imports

Artifact provenance
Package
@cavi-ai/api-client@0.21.0
Release
v0.21.0
Commit
07f0ee45424c267278f7b0c89a7dcea4e2492cc1
Source
examples/custom-provider.ts
Tarball SHA-256
0924b5d3a7a40869bd44fedc47a9b8eb9844c2af1fd5c7ca77469d8b7c0b8558
Content SHA-256
24eff463c41582eaf5e70c58f42e5ae13bd12d02fa14ae2a886afa3abf5cdf48