MULTI-TENANT CLOUD API & MCP

API Reference.

Cloud Base URL https://api.masidyn.dev · Remote MCP https://api.masidyn.dev/mcp · OAuth 2.0 / OIDC Issuer https://account.masidyn.dev. Download openapi.yaml (3.1) ↗ or openapi-copilot.json (2.0 for Copilot Studio) ↗.

CLOUD ENDPOINTS

24/7 Cloud routes, OAuth-protected.

POST /v1/chat/completions, POST /v1/embeddings, and POST /mcp authenticate via OAuth 2.0 Bearer JWTs from https://account.masidyn.dev (discovered at /.well-known/oauth-protected-resource) or MasiDyn service credentials.

GET
/health

Cloud service readiness

Public status only: ok or degraded. No service map.

GET
/v1/identity

Cloud deployment identity

Reports deployment mode, provider, service URLs, default model, and supported routes. Local source and binary hashes are not part of the cloud response.

GET
/v1/models

Available cloud models

OpenAI-compatible model catalog. Requires a MasiDyn bearer token. Use a returned model ID, such as masidyn-auto, in requests.

POST
/v1/chat/completions

Cloud chat completion

Authenticated chat with messages, temperature, max_tokens, and optional SSE streaming. Returns the resolved model in the response.

POST
/v1/embeddings

Cloud text embeddings

Authenticated string or string-array input using masidyn-embed, backed by Gemini Embedding 001. Native nomic and feature-hash settings apply only to local runtimes.

POST
/mcp

Remote Streamable HTTP MCP Server

JSON-RPC 2.0 MCP endpoint for Microsoft Copilot Studio and MCP hosts exposing masidyn_chat, masidyn_list_models, and masidyn_workspace_status.

Connect Microsoft Copilot Studio

Copilot Studio connects directly to MasiDyn Cloud over HTTPS — no local port forwarding or workstation tunnel is required. Choose either Remote MCP or an OpenAPI 2.0 Custom Connector:

Copilot StudioMCP or OpenAPI 2.0
Option A — Remote MCP Server (Tools -> Add a tool -> Model Context Protocol)
  Server URL:            https://api.masidyn.dev/mcp
  Resource Metadata:     https://api.masidyn.dev/.well-known/oauth-protected-resource
  Authorization URL:     https://account.masidyn.dev/oauth/authorize
  Token URL:             https://account.masidyn.dev/oauth/token
  Resource:              https://api.masidyn.dev/mcp

Option B — OpenAPI 2.0 Custom Connector
  Import Swagger file:   https://masidyn.dev/openapi-copilot.json
  Host:                  api.masidyn.dev
  Authorization URL:     https://account.masidyn.dev/oauth/authorize?resource=https%3A%2F%2Fapi.masidyn.dev%2Fv1
  Auth Type:             OAuth 2.0 (Authorization Code via account.masidyn.dev)

POST /v1/chat/completions

Standard chat-completions request shape served on https://api.masidyn.dev/v1/chat/completions and backed by Google Gemini. Supports temperature, max_tokens, and stream: true SSE responses.

Authenticated requests cap max_tokens at 2,048. This budget covers reasoning and visible output. If it runs out before any answer text or tool call, the API returns PROVIDER_OUTPUT_LIMIT with HTTP 422, or a terminal error event if streaming has started. Increase the budget within the cap or shorten the prompt before making a new request. Partial text already produced remains valid.

requestapplication/json
{
  "model": "masidyn-auto",
  "messages": [
    { "role": "system", "content": "You are helpful." },
    { "role": "user", "content": "Summarize MasiDyn Cloud in one line." }
  ],
  "temperature": 0.2,
  "max_tokens": 512,
  "stream": false
}
response · 200chat.completion
{
  "id": "chatcmpl-masidyn-1737331200",
  "object": "chat.completion",
  "created": 1737331200,
  "model": "gemini-3.8-flash",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "..." },
    "finish_reason": "stop"
  }],
  "usage": { "prompt_tokens": 12, "completion_tokens": 18, "total_tokens": 30 }
}
response · streamtext/event-stream
data: {"id":"chatcmpl-masidyn-...","object":"chat.completion.chunk",
       "choices":[{"index":0,"delta":{"content":"Ma"},"finish_reason":null}]}
data: {"...":"...","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]

Streaming starts with HTTP 200 before generation completes. If a failure occurs after that, the stream sends a terminal data: {"error": RECEIPT} event containing the diagnostic fields below, then closes without [DONE]. Its error.request_id matches X-Request-ID. Both SDKs raise MasiDynError with those fields, even when earlier text chunks were received. Use [DONE] to distinguish a successful terminal event from a failure.

POST /v1/embeddings

Accepts a string or array of strings on https://api.masidyn.dev/v1/embeddings and returns dense embeddings backed by Gemini Embedding 001 (or local nomic-embed-text in optional desktop offline mode).

requestapplication/json
{
  "model": "masidyn-embed",
  "input": ["multi-tenant cloud", "oauth2 mcp"]
}
response · 200list
{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [/* floats */] },
    { "object": "embedding", "index": 1, "embedding": [/* floats */] }
  ],
  "model": "gemini-embedding-001",
  "usage": { "prompt_tokens": 6, "total_tokens": 6 }
}

GET /v1/identity

Reports the active MasiDyn Cloud deployment identity, backing provider, MCP URL, and supported routes.

response · 200masidyn.identity
{
  "object": "masidyn.identity",
  "product": "masidyn",
  "version": "0.masidyn-1.3",
  "deployment_mode": "cloud",
  "provider": "google-gemini",
  "cloud_api_url": "https://api.masidyn.dev",
  "mcp_url": "https://api.masidyn.dev/mcp",
  "native_ready": true,
  "default_model": "masidyn-auto",
  "endpoints": {
    "health": "/v1/health",
    "identity": "/v1/identity",
    "models": "/v1/models",
    "chat_completions": "/v1/chat/completions",
    "embeddings": "/v1/embeddings",
    "mcp": "/mcp"
  }
}

Diagnose a failed cloud request.

Chat and embedding failures return a stable code, a safe message, and a server-generated request_id that matches the X-Request-ID response header. Keep that ID when reporting a failure. The existing string error field remains available for client compatibility.

example · 401application/json
{
  "error": "missing_bearer_token",
  "code": "AUTH_REQUIRED",
  "message": "A MasiDyn access token is required.",
  "request_id": "b680f14c-2aa4-4b1d-b245-0a75312b75e8",
  "stage": "LOCAL_PREFLIGHT",
  "retryable": false,
  "execution_status": "not_started",
  "next_action": "Sign in with MasiDyn and send the returned access token as a Bearer credential."
}
  • LOCAL_PREFLIGHT: authentication, validation, or configuration stopped the request before provider execution.
  • TRANSPORT: communication failed or exceeded its deadline.
  • PROVIDER: the provider returned an error or an unusable response.
  • UNKNOWN: the server could not establish the failure stage.

Follow next_action and retryable. An execution_status of unknown means completion is unconfirmed; check status before repeating an action that changes data. OAuth endpoints retain the standard error and error_description protocol fields.

Reconnect credentials that lack the required grant.

  • AUTH_AUDIENCE_UNVERIFIED: the token does not attest its resource. Reauthorize with the REST API resource https://api.masidyn.dev/v1.
  • AUTH_AUDIENCE_MISMATCH: the token targets another resource. Use a REST API grant for chat and embeddings; generic MCP uses https://api.masidyn.dev/mcp.
  • AUTH_SCOPE_INSUFFICIENT: grant masidyn.workspace.read through OAuth consent for the REST API, then obtain a new access token.
  • TENANT_REQUIRED: a verified workspace is missing from the credential. Complete account workspace setup and reconnect; an arbitrary tenant ID in the request does not establish access.

OPTIONAL LOCAL OFFLINE DESKTOP MODE

Loopback runtime (127.0.0.1:11434).

For offline desktop installations only, MasiDyn Desktop and CLI clients also speak the same /v1/* contract on local loopback http://127.0.0.1:11434 (or BEAM control 127.0.0.1:11435) without exposing any local ports to the internet.

Local runtimes may provide native nomic-embed-textembeddings and source or backend binary hashes in their identity response. Those fields and native fallback settings belong to the installed local runtime; they are not cloud API guarantees. Use the runtime's Port-0 discovery address and inspect its identity and model catalog before choosing local model IDs.