forked from swift502/Sketchbook
-
Notifications
You must be signed in to change notification settings - Fork 3
API Reference
Igor edited this page Nov 27, 2025
·
1 revision
This page documents the key APIs and functions used in Sketchbook AI.
Streams AI responses for code generation.
Parameters:
-
messages: Array of chat messages with role, content, etc. -
functions: Optional function definitions for the AI -
model: AI model to use (default: "grok-code") -
signal: AbortSignal for cancelling requests -
apiUrl: Base URL for the API endpoint -
apiKey: Authentication key for the AI service
Returns: Async generator yielding response chunks
Compiles and executes generated TypeScript code in the browser environment.
Parameters:
-
content: TypeScript code string to execute
Throws: Error if code is empty or compilation/execution fails
The main 3D world container and physics simulation manager.
Key Methods:
-
add(entity): Add an entity to the world -
remove(entity): Remove an entity from the world -
update(): Update world physics and entities
Represents controllable characters in the 3D world.
Key Methods:
-
setPosition(x, y, z): Set character position -
setRotation(x, y, z): Set character rotation -
playAnimation(name): Play a character animation
Base class for vehicles like cars, airplanes, helicopters.
Key Methods:
-
addDriver(character): Add a character as driver -
startEngine(): Start the vehicle engine -
accelerate(power): Apply acceleration
Compiles TypeScript code to JavaScript in the browser.
Merges partial JSON objects from streaming responses.
Loads and processes multiple files for context injection.