Skip to main content

Gateway API

Turn each workspace into an OpenAI-compatible agent model with real machine access.

AI Labs exposes /v1/chat/completions and /v1/models, so any client that speaks OpenAI — chat UIs, IDE plugins, Hrida.ai, or your own scripts — can use a workspace with full agent capabilities: file access, terminal, web search, tools.

Endpoints​

EndpointPurpose
GET /v1/modelsLists your workspaces in OpenAI model-list format. Each entry is cptr/<workspace-name>.
POST /v1/chat/completionsRuns the agentic loop on the chosen workspace and streams the result as SSE (or returns a single full response when stream is not requested).

Authentication​

Generate an API key from Settings → Gateway in the AI Labs UI. Keys are stored hashed and tied to your user. Send it as a bearer token:

curl https://<your-computer>/v1/chat/completions \
  -H "Authorization: Bearer $CPTR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cptr/my-project",
    "messages": [{"role": "user", "content": "run the tests and summarize failures"}],
    "stream": true
  }'

Manage keys (create, list, delete) from the Gateway settings page or the /v1/keys endpoints.

Session continuity​

By default each request creates a fresh chat. To continue the same AI Labs chat across turns, send a stable id header:

HeaderUse
X-Chat-IdGeneric clients — reuse the same AI Labs chat across turns.
X-HridaAI-Chat-Id, X-HridaAI-Message-Id, X-HridaAI-User-Message-Id, X-HridaAI-User-Message-Parent-Id, X-HridaAI-TaskSet by Hrida.ai (via custom header templates) so AI Labs maps its chat tree 1:1 to the Hrida.ai conversation and tool-call actions show meaningful labels.

Connecting from Hrida.ai​

Add AI Labs as an OpenAI-compatible connection in Hrida.ai pointing at https://<your-computer>/v1 with your gateway key. Each cptr/<workspace> model then behaves like an agent with a real machine behind it. Admins can set a gateway response model and tune gateway model selection in Admin → Gateway. Streaming and tool-call visibility are supported end to end.

Hrida.ai is proprietary software of Zlabs Innovation. See the license for terms. © 2026 Zlabs Innovation.