Pipeline API

Build with Treza

Every pipeline you build on the canvas becomes a versioned HTTP endpoint. Call it with the typed /invoke API or an OpenAI-compatible /chat/completions endpoint, and generate video, images, and text from your product, scripts, or agents.

Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    api_key="treza_live_...",
    base_url="https://trezalabs.com/api/pipelines/YOUR_PIPELINE_ID",
)

completion = client.chat.completions.create(
    model="treza",
    messages=[{"role": "user", "content": "A 6-second product demo, cinematic"}],
)

print(completion.choices[0].message.content)  # -> https://.../output.mp4

Two ways to call a pipeline

Pick JSON in and JSON out, or a drop-in for the OpenAI SDK. Both run the published version and record every call in run history.

POST/invoketyped JSON
curl
curl https://trezalabs.com/api/pipelines/YOUR_PIPELINE_ID/invoke \
  -H "Authorization: Bearer treza_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "inputs": { "brief": "A serene mountain lake at sunrise" } }'
POST/chat/completionsOpenAI-compatible, streaming
Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    api_key="treza_live_...",
    base_url="https://trezalabs.com/api/pipelines/YOUR_PIPELINE_ID",
)

completion = client.chat.completions.create(
    model="treza",
    messages=[{"role": "user", "content": "A 6-second product demo, cinematic"}],
)

print(completion.choices[0].message.content)  # -> https://.../output.mp4

Full reference, streaming, and the error model in the Pipeline API docs.

Developer FAQ

How do I call a Treza pipeline from code?

Build a pipeline on the canvas and publish it, create an API key on the API keys page, then POST to https://trezalabs.com/api/pipelines/{id}/invoke with your input keys, or point any OpenAI SDK at the /chat/completions endpoint. The key must own the pipeline and the pipeline must be published.

Is the pipeline API OpenAI-compatible?

Yes. Every published pipeline exposes a /chat/completions endpoint that works as a drop-in for any OpenAI SDK. Change the base URL to your pipeline endpoint and the API key to your Treza key. The latest user message is fed into the pipeline and the output is returned as the assistant message. Streaming via server-sent events is supported.

What languages and clients are supported?

Anything that can make an HTTP request. The typed /invoke endpoint takes JSON and returns JSON, so it works with any language. For the OpenAI-compatible endpoint, the official OpenAI SDKs for Python and JavaScript/TypeScript work directly by changing the base URL.

How do versioning and run history work?

Publishing snapshots the pipeline graph and assigns an incrementing version number. API traffic always runs the published version, never your in-progress draft, and you can roll back at any time. Every call is recorded in run history with per-node timing, token and credit usage, and the version that served it.

How am I billed for API runs?

Treza uses prepaid credits, with no subscription. Model runs are paid from your credit balance and only successful runs are charged. If your balance is too low, the API returns a 402 and you can top up in billing settings.

Can I swap models without changing my integration?

Yes. Models are chosen per node inside the pipeline, so you can swap a model, add a step, or roll back a version and your endpoint keeps working. Your API contract, the input and output keys, stays the same.

Ready to build?

Get your API key and turn your first pipeline into a live endpoint. Start with free credits, no card required.

Get your API key->