Skip to content
会nokai.studio

SDKs

nokai.studio ships an OpenAPI 3.1 spec at https://nokai.studio/openapi.json. Generate a typed client in any language with one command.

TypeScript

pnpm add -D openapi-typescript
npx openapi-typescript https://nokai.studio/openapi.json -o kinokai.d.ts

Use with fetch:

import type { paths } from './kinokai';
 
type CreateTaskBody =
  paths['/api/v1/jobs/createTask']['post']['requestBody']['content']['application/json'];
 
const res = await fetch('https://nokai.studio/api/v1/jobs/createTask', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.NOKAI_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'wan-i2v-480p',
    input: { prompt: 'A cat on a rooftop at sunset' },
  } satisfies CreateTaskBody),
});

Python

pip install openapi-python-client
openapi-python-client generate --url https://nokai.studio/openapi.json

Go

go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest
curl https://nokai.studio/openapi.json -o openapi.json
oapi-codegen -package nokai -generate types,client openapi.json > nokai.gen.go

Other languages

Any tool that consumes OpenAPI 3.1 works: Rust (openapi-generator-cli), Ruby, Java, PHP, C#, Swift, Kotlin, Elixir.

First-party SDK

A first-party TypeScript SDK is planned. Until then, generation from the spec is the recommended path.