@maniclang/api-spec
v0.1.2
Published
Versioned OpenAPI contract and TypeScript types for the Manic Platform API
Maintainers
Readme
Manic API Spec
The shared TypeScript/OpenAPI contract for clients built on the Manic Platform API.
It packages the public API as a versioned OpenAPI document and generated TypeScript types. Manic Workbench, web clients, SDKs, and integrations can use the same contract instead of maintaining handwritten copies of endpoint shapes.
Install
npm install @maniclang/api-specimport createClient from "openapi-fetch";
import type { paths, CheckRequest, RenderJob, RenderRequest } from "@maniclang/api-spec";
import { MANIC_PLATFORM_API_BASE_URL } from "@maniclang/api-spec";
const client = createClient<paths>({
baseUrl: MANIC_PLATFORM_API_BASE_URL,
headers: {
Authorization: `Bearer ${process.env.MANIC_API_KEY}`,
},
});
const check: CheckRequest = { source: 'title("Hello, Manic");' };
const { data, error } = await client.POST("/check", { body: check });
if (error) throw new Error(error.error.message);
console.log(data.diagnostics);
const request: RenderRequest = {
source: 'title("Hello, Manic");',
format: "mp4",
fps: 30,
};
const response = await fetch(`${MANIC_PLATFORM_API_BASE_URL}/renders`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.MANIC_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify(request),
});
const job = (await response.json()) as RenderJob;
console.log(job.id);Install openapi-fetch alongside this package when you want its typed HTTP
client:
npm install @maniclang/api-spec openapi-fetchThe API base URL is https://api.maniclang.com/v1. See the interactive contract
and all endpoint semantics at docs.maniclang.com/api.
Keep API keys private
Use mk_… API keys from your server, serverless function, or trusted desktop
application. Do not embed a long-lived key in a browser bundle. A browser client
should call its own backend, which can authenticate the user and make the Manic
request safely.
Use the raw OpenAPI document
Tools that generate their own SDK can import the exact packaged document:
import spec from "@maniclang/api-spec/openapi.json" with { type: "json" };The document uses the public v1 API surface and is emitted to
dist/openapi.json when the package is built.
Maintain the contract
openapi/manic-platform.v1.json is the published, versioned contract. Package
maintainers synchronize it from the platform source before releasing:
npm run verifynpm run verify regenerates types, validates the package, tests the contract,
and emits dist/openapi.json for package consumers.
Publish to npm
This package is public under the @maniclang npm scope. A maintainer with access
to that scope can publish a new immutable version:
npm login
npm version patch # or minor / major
npm run releaseIf npm two-factor authentication is enabled, use npm run release -- --otp=123456
or set NPM_OTP. The guarded release command verifies the package first and
refuses to overwrite an existing version.
Consumers then install the released version normally:
npm install @maniclang/api-specLinks
- Product: maniclang.com
- Application: app.maniclang.com
- Documentation: docs.maniclang.com
- API reference: docs.maniclang.com/api
- Engine: github.com/maniclang-x/manic
- Engine installation: INSTALL.md
- Engine troubleshooting: TROUBLESHOOTING.md
- Workbench: github.com/maniclang-x/manic-workbench
- Report a contract issue: GitHub Issues
- Creator: Anish on X
- Creator website: 8gwifi.org
- Community: r/maniclang
