Skip to main content
@singularity-layer/grid is the official TypeScript/JavaScript client for SGL Grid. Typed methods over the grid’s HTTP API; zero dependencies; native fetch (Node ≥ 18, modern browsers, edge runtimes).

Install

Quick start

Configuration

  • No key → public reads (capacity, models, pricing) work.
  • API key → required for submitJob, getJob, getAttestation, and billed chat. Create keys in the dashboard (see Billing).

Discovery (no auth)

Chat completions

Vision (image input)

Send an image to a vision model (e.g. qwen2.5-vl-3b) by giving a message an array of content parts — a text part and an image_url part (a data URL or an https URL). The image is sealed end-to-end with the rest of your prompt; only the image count is disclosed so the grid can quote it and route to a vision-capable node. Image requests are non-streaming.

Embeddings

Turn text into vectors for search and RAG via the OpenAI-compatible /v1/embeddings endpoint. Returns the OpenAI-style response with data ordered to match input. See the Embeddings guide for the model catalog and options.

Jobs + attestation

See Confidential inference for what the attestation proves.

Error handling

Or use the OpenAI SDK

The grid is OpenAI-compatible — skip this client if you just want drop-in chat:
Use @singularity-layer/grid for grid-native features (capacity, pricing, jobs, attestation). See the API guide and the Python SDK.