SDK
nokai.studio は https://nokai.studio/openapi.json で OpenAPI 3.1 仕様を提供しています。1 つのコマンドで、任意の言語の型付きクライアントを生成できます。
TypeScript
pnpm add -D openapi-typescript
npx openapi-typescript https://nokai.studio/openapi.json -o kinokai.d.tsfetch で使う:
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.jsonGo
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その他の言語
OpenAPI 3.1 を扱えるツールなら何でも動作します: Rust (openapi-generator-cli)、Ruby、Java、PHP、C#、Swift、Kotlin、Elixir。
ファーストパーティ SDK
ファーストパーティの TypeScript SDK を計画中です。それまでは、仕様からの生成を推奨します。