ModelWorks logoModelWorks

Managing Circuits

Create, list, update, and deprecate your AI circuits via the API.

Managing Circuits

A circuit is your versioned, reusable unit of AI logic on ModelWorks. This guide covers everything you can do with a circuit itself — creating one, fetching it, updating its metadata, starring it, and deprecating it. For the versions inside a circuit, see Circuit Versions.

Base URL

All examples assume the following base URL:

Text
https://modelworks.ai/api

Authentication

All endpoints below require an API token sent as Authorization: Bearer YOUR_API_TOKEN, unless the endpoint is marked public. See Authentication.

All list endpoints support pagination with limit (items per page) and page (1-based page number), and return a meta object containing total_count, limit, and page.


Create a circuit

POST /circuits

Creates a new circuit owned by the authenticated user.

Request body

FieldTypeRequiredDescription
namestringyesHuman-friendly circuit name.
descriptionstringnoShort description shown in listings.
is_privatebooleannoIf true, the circuit is private (default false).
is_protectedbooleannoIf true, the circuit is protected.
license_typestringnoLicense identifier for the circuit.
user_circuit_metric_uidstringnoUID of an existing metric configuration to attach.

Example

Bash
curl -X POST https://modelworks.ai/api/circuits \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "SEC Filing Discovery",
    "description": "Finds SEC filings for a given ticker.",
    "is_private": false,
    "is_protected": false,
    "license_type": "mit"
  }'

Response (200 OK)

Returns the created circuit object, including its uid, name, description, visibility flags, and timestamps.


Get a circuit

You can fetch a circuit three ways: by its UID, by owner + name, or just its primary version UID.

GET /circuits/{circuit_uid}

Fetch a circuit by its unique ID. Public circuits need no auth; private or protected circuits require the owner's token.

Bash
curl https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a \
  -H "Authorization: Bearer YOUR_API_TOKEN"
ParameterTypeDescription
circuit_uidstringThe circuit's unique ID.

GET /users/{username}/circuits/{circuit_name}

Fetch a circuit by its owner's username and the circuit's name. This is handy when you only know the human-readable names (for example, modelworks/SEC-Filing-Discovery).

Bash
curl https://modelworks.ai/api/users/modelworks/circuits/SEC-Filing-Discovery \
  -H "Authorization: Bearer YOUR_API_TOKEN"
ParameterTypeDescription
usernamestringThe circuit owner's username.
circuit_namestringThe circuit's name.

GET /circuits/{circuit_uid}/primary

Returns the UID of the circuit's primary version — the version that gets run when callers don't pin a specific one. Cache this and reuse it instead of re-fetching on every request.

Bash
curl https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/primary \
  -H "Authorization: Bearer YOUR_API_TOKEN"
ParameterTypeDescription
circuit_uidstringThe circuit's unique ID.

List circuits

GET /users/{username}/circuits

List a user's public circuits. No authentication is needed to view public circuits; include your token only if you want to see private ones you own.

Bash
curl "https://modelworks.ai/api/users/modelworks/circuits?limit=20&page=1" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
ParameterTypeDescription
usernamestringThe user whose circuits to list.
limitintegerItems per page (optional).
pageinteger1-based page number (optional).

GET /circuits/{circuit_uid}/circuit-versions

List the versions of a circuit, newest first. Pagination applies.

Bash
curl "https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/circuit-versions?limit=10&page=1" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
ParameterTypeDescription
circuit_uidstringThe circuit's unique ID.
limitintegerItems per page (optional).
pageinteger1-based page number (optional).

Update a circuit

PUT /users/{username}/circuits/{circuit_name}

Update a circuit's metadata or visibility. Owner only.

Request body

All fields are optional — send only the ones you want to change.

FieldTypeDescription
descriptionstringNew description.
is_privatebooleanToggle private visibility.
is_protectedbooleanToggle protected visibility.
license_typestringNew license identifier.

Example

Bash
curl -X PUT https://modelworks.ai/api/users/modelworks/circuits/SEC-Filing-Discovery \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Finds SEC filings for a given ticker (updated).",
    "is_private": true
  }'

Deprecate a circuit

PUT /circuits/{circuit_uid}/deprecate

Marks the circuit and all of its versions as deprecated. Owner only. Deprecated circuits still run, but callers see deprecation notices.

Bash
curl -X PUT https://modelworks.ai/api/circuits/73120d53-bf89-44fa-a035-5b88fe41574a/deprecate \
  -H "Authorization: Bearer YOUR_API_TOKEN"
ParameterTypeDescription
circuit_uidstringThe circuit's unique ID.

Star and unstar

Starring is a way to bookmark circuits you find useful.

POST /users/{username}/circuits/{circuit_name}/stars

Star a circuit. Requires an API token.

Bash
curl -X POST https://modelworks.ai/api/users/modelworks/circuits/SEC-Filing-Discovery/stars \
  -H "Authorization: Bearer YOUR_API_TOKEN"

DELETE /users/{username}/circuits/{circuit_name}/stars

Unstar a circuit.

Bash
curl -X DELETE https://modelworks.ai/api/users/modelworks/circuits/SEC-Filing-Discovery/stars \
  -H "Authorization: Bearer YOUR_API_TOKEN"

GET /users/{username}/circuits/{circuit_name}/stars

Check whether you have starred a circuit. Returns a boolean.

Bash
curl https://modelworks.ai/api/users/modelworks/circuits/SEC-Filing-Discovery/stars \
  -H "Authorization: Bearer YOUR_API_TOKEN"

GET /users/stars

List the circuits you have starred (up to 50).

Bash
curl https://modelworks.ai/api/users/stars \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Check access

GET /users/{username}/circuits/{circuit_name}/ping

Returns a boolean indicating whether you can read the circuit. No auth required. This is a cheap way to check access before attempting a heavier query call.

Bash
curl https://modelworks.ai/api/users/modelworks/circuits/SEC-Filing-Discovery/ping

Embeds

GET /users/{username}/circuits/{circuit_name}/embeds

List the circuits that embed this one. Paginated, max 200 results.

Bash
curl "https://modelworks.ai/api/users/modelworks/circuits/SEC-Filing-Discovery/embeds?limit=20&page=1" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Explain

GET /users/{username}/circuits/{circuit_name}/explain

Returns the circuit's explain detail — a human-readable breakdown of what the circuit does. Visibility is gated by the circuit's visibility settings and your access.

Bash
curl https://modelworks.ai/api/users/modelworks/circuits/SEC-Filing-Discovery/explain \
  -H "Authorization: Bearer YOUR_API_TOKEN"
On this page

On this page