تخطَّ إلى المحتوى
CADCAMFUN
الوثائق

الوثائق

جلسات وإجراءات الذكاء الاصطناعي

الموفرون، وبيانات الاعتماد، والمحادثات، ودورات البث، واستدعاء الإجراء، ورموز الجسر، والمهارات، واسترداد الجلسة.

مترجم تلقائيًا من الإنجليزية. عرض الأصل بالإنجليزية

ساحة التجربة

أرسل هذه الطلبات إلى السايدكار الخاصة بك. تبقى القيم في هذا المتصفح.

غير متصل
كيف يعمل هذا

يستمع السايدكار إلى منفذ الاسترجاع الذي تم اختياره عند بدء التشغيل ويطبعه في منفذ الاسترجاع الخاص به ready خط؛ استخدم عنوان URL هذا و CADCAMFUN_TOKEN لقد بدأ مع. تذهب الطلبات مباشرة من هذه الصفحة إلى هذا العنوان.

يرسل السايدكار رؤوس CORS فقط إلى أصول Tauri وإلى http://localhost أو http://127.0.0.1 على أي منفذ. من المستندات المستضافة، يحظر المتصفح الاستجابة، لذا قم بتشغيل المستندات محليًا (bun run dev في packages/web) لاستخدام الملعب، أو نسخ الطلب كحليقة. للتجربة دون لمس البيانات الحقيقية، ابدأ تشغيل السايدكار باستخدام CADCAMFUN_DATA_DIR أشار إلى دليل مهمل - انظر إرشادات واجهة برمجة التطبيقات.

العمليات

52 نقاط نهاية في ai المجموعة التي تم إنشاؤها من السايدكار مستند OpenAPI. تأخذ العمليات المحمية Authorization: Bearer $CADCAMFUN_TOKEN; يرى المصادقة. السلوك والحدود موجودة دليل النظام الفرعي.

يحصل /api/ai/actions ai.actions
بريد /api/ai/actions/invoke ai.invokeAction
بريد /api/ai/bridge/tokens ai.issueBridgeToken
يحصل /api/ai/bridge/tokens ai.bridgeTokens
يمسح /api/ai/bridge/tokens/{id} ai.revokeBridgeToken
يحصل /api/ai/agents ai.agents
بريد /api/ai/sessions/control ai.sessionControl
بريد /api/ai/sessions/state ai.sessionState
بريد /api/ai/sessions/remove ai.removeSession
يحصل /api/ai/extensions/mcp ai.mcpServers
يضع /api/ai/extensions/mcp ai.saveMcpServer
يمسح /api/ai/extensions/mcp/{name} ai.deleteMcpServer
يمسح /api/ai/extensions/plugins/{id} ai.removeExtensionPlugin
يضع /api/ai/extensions/plugins/{id} ai.toggleExtensionPlugin
يحصل /api/ai/extensions/plugins ai.extensionPlugins
بريد /api/ai/extensions/plugins ai.installExtensionPlugin
يحصل /api/ai/extensions/mods ai.extensionMods
يضع /api/ai/extensions/mods/{id} ai.toggleExtensionMod
يمسح /api/ai/extensions/mods/{id} ai.removeExtensionMod
يحصل /api/ai/modes ai.modes
يحصل /api/ai/skills ai.skills
يضع /api/ai/skills ai.saveSkill
يمسح /api/ai/skills/{name} ai.deleteSkill
يضع /api/ai/credentials ai.setCredentials
يمسح /api/ai/credentials/{provider} ai.clearCredentials
يحصل /api/ai/status ai.status
يحصل /api/ai/models ai.models
يحصل /api/ai/providers ai.providers
بريد /api/ai/models/refresh ai.refreshModels
يحصل /api/ai/prompts ai.prompts
بريد /api/ai/title ai.title
بريد /api/ai/design-analysis ai.designAnalysis
بريد /api/ai/machining-parameters ai.machiningParameters
بريد /api/ai/gcode-optimization ai.gcodeOptimization
بريد /api/ai/design-suggestions ai.designSuggestions
بريد /api/ai/chat ai.chat
بريد /api/ai/chat/stream ai.chatStream
بريد /api/ai/sessions/prompt ai.sessionPrompt
يحصل /api/ai/sessions/{sessionId}/stream ai.sessionStream
يحصل /api/ai/sessions ai.sessionList
يحصل /api/ai/sessions/{sessionId}/messages ai.sessionMessages
بريد /api/ai/chat/queue ai.chatQueue
بريد /api/ai/chat/abort ai.chatAbort
بريد /api/ai/permission/reply ai.permissionReply
بريد /api/ai/completion ai.completion
بريد /api/ai/analyze-gcode ai.analyzeGcode
بريد /api/ai/gcode ai.gcode
بريد /api/ai/toolpath-analysis ai.toolpathAnalysis
بريد /api/ai/feedback ai.feedback
بريد /api/ai/proxy ai.proxy
بريد /api/ai/oauth/authorize ai.oauthAuthorize
بريد /api/ai/oauth/complete ai.oauthComplete
جلسات الذكاء الاصطناعي وعمليات الإجراءات في 3د اسحب إلى المدار · قم بالتمرير للتكبير · اسحب بزر الماوس الأيمن للتحريك
كتلة واحدة لكل عملية (52)، مكدسة لكل قسم موارد في هذه الصفحة وملونة حسب الطريقة: GET الأخضر، POST البرتقالي، PUT الأزرق، PATCH البنفسجي، DELETE الأحمر. تم إنشاؤها من مستند OpenAPI في وقت الإنشاء.

/api/ai/actions

يحصل /api/ai/actions # ai.actions

يتطلب Authorization: Bearer <token>.

الردود
200 هدف application/json
{
  tools: Array<{
    id: string
    description: string
    kind: "read" | "write" | "destructive"
    actions: Array<{
      id: string
      name: string
      kind: "read" | "write" | "destructive"
    }>
    parameters: object
  }>
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
رد المثال تم الالتقاط · 200
الحصول على /api/ai/actions
{
  "tools": [
    {
      "id": "cad",
      "description": "Read the open drawing. All actions are read-only.\n\nActions\n- describe: the drawing: counts, bounds and layers. Start here.\n- check: model checks (sizes, rotations, Boolean operands, duplicates, floating parts); fix findings after modelling.\n- relations: bounds, placement, distances and parameter dependencies; equal names do not bind parameters.\n- grep: search ids, names, layers and properties; includes each parametric hit's revision.\n- vision: the CAD viewport plus scene evidence as an image.\n- inspect_elements: full properties and bounds of elements, paged.\n- inspect_layers: the workspace layers and the active one.\n- inspect_search: elements whose text matches a query, paged.\n- inspect_property: one property of one element by path, paged by characters.\n- parametric_validate: rebuild a parametric history and report what it cannot build.\n- parametric_inspect: history, parameters and report of one parametric part.\n- drawing: technical sheet from one elementId or history; options (sheet, projection, views, section, detail: see schema). SVG, dimensions, callouts, warnings; exact B-rep edges where available; nothing stored.\n- parametric_test: run parameter variants; report bodies, volumes and dimensional checks.\n- parametric_dfm: manufacturability findings for a history or an existing part.\n- parametric_exact: exact B-rep per body (volume, area, centroid, throughHoles, faces, surfaces) or why mesh-only; STEP on request.\n- exact: every solid on the exact kernel: validity, volume, bounds, holes, and whether CAM machines it by features or as a 3D surface, with why.\n- assembly: exact interference (clash volumes), bill of materials with mass, hole joints, fasteners still missing.\n- parametric_fastener: thread, tap drill, clearance and counterbore of a metric size.\n- parametric_recipe: standard part history from `recipe` (mounting_plate, flange, l_bracket, stepped_shaft, pipe_bend, duct_transition, enclosure) and `params`; cad_edit.parametric_recipe_create stores it.\n- parametric_from_element: history with named parameters from an existing solid, flat shape or component; cad_edit.parametric_convert stores it.\n\nParameters (mm, radians; ids are read, never invented)\n- describe, check, inspect_layers: none.\n- relations: firstId, secondId - two different existing ids.\n- grep: query (1-200 chars), layerId, parametricOnly, includeParameters, offset, limit (1-50).\n- vision: focus - wha
…
مثال SDK
ai.actions
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.ai.actions()
curl
الحصول على /api/ai/actions
curl --request GET "${CADCAMFUN_URL}/api/ai/actions" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
بريد /api/ai/actions/invoke # ai.invokeAction

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  projectId: string
  drawingId?: string | null
  callId?: string | null
  tool: string
  input: object
}
الردود
200 هدف application/json
{
  tool: string
  action: string
  result: unknown
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.invokeAction
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiInvokeActionInput
const result = await client.ai.invokeAction({
  projectId: "",
  drawingId: "",
  callId: "",
  tool: "",
  input: {}
})
curl
POST /api/ai/actions/invoc
curl --request POST "${CADCAMFUN_URL}/api/ai/actions/invoke" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/bridge

بريد /api/ai/bridge/tokens # ai.issueBridgeToken

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  name?: string | null
  projectId: string
  mode: "read" | "write"
  days?: number | "Infinity" | "-Infinity" | "NaN" | null
}
الردود
200 هدف application/json
{
  info: {
    id: string
    name: string
    projectId: string
    mode: "read" | "write"
    userId: string
    createdAt: string
    expiresAt: string
  }
  token: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.issueBridgeToken
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiIssueBridgeTokenInput
const result = await client.ai.issueBridgeToken({
  name: "",
  projectId: "",
  mode: "read",
  days: 0
})
curl
POST /api/ai/bridge/tokens
curl --request POST "${CADCAMFUN_URL}/api/ai/bridge/tokens" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يحصل /api/ai/bridge/tokens # ai.bridgeTokens

يتطلب Authorization: Bearer <token>.

الردود
200 صفيف <كائن> application/json
Array<{
  id: string
  name: string
  projectId: string
  mode: "read" | "write"
  userId: string
  createdAt: string
  expiresAt: string
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
رد المثال تم الالتقاط · 200
احصل على /api/ai/bridge/tokens
[]
مثال SDK
ai.bridgeTokens
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.ai.bridgeTokens()
curl
احصل على /api/ai/bridge/tokens
curl --request GET "${CADCAMFUN_URL}/api/ai/bridge/tokens" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يمسح /api/ai/bridge/tokens/{id} # ai.revokeBridgeToken

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
200 هدف application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.revokeBridgeToken
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiRevokeBridgeTokenInput
const result = await client.ai.revokeBridgeToken({
  id: "<id>"
})
curl
حذف /api/ai/bridge/tokens/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/ai/bridge/tokens/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/agents

يحصل /api/ai/agents # ai.agents

يتطلب Authorization: Bearer <token>.

الردود
200 صفيف <كائن> application/json
Array<{
  id: string
  title: string
  description: string
  tools: string[]
  edits: boolean
  kind?: string | null
  canEdit?: boolean | null
  delegates?: boolean | null
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
رد المثال تم الالتقاط · 200
احصل على /api/ai/agents
[
  {
    "id": "general",
    "title": "General",
    "description": "Does drawing and machining itself, and delegates separable work to subagents (background tasks included).",
    "tools": [],
    "edits": true
  },
  {
    "id": "cad",
    "title": "CAD",
    "description": "Drawing and 3D modelling. Reads the machining side but does not change operations, G-code or the machining libraries.",
    "tools": [],
    "edits": true
  },
  {
    "id": "cam",
    "title": "CAM",
    "description": "Machining: operations, G-code, verification and the machining libraries. Reads the drawing but does not change it.",
    "tools": [],
    "edits": true
  }
]
مثال SDK
ai.agents
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.ai.agents()
curl
احصل على /api/ai/agents
curl --request GET "${CADCAMFUN_URL}/api/ai/agents" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/sessions

بريد /api/ai/sessions/control # ai.sessionControl

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  sessionId: string
  projectId?: string | null
  action: "status" | "compact" | "cancel_task" | "answer_question" | "reject_question" | "reply_permission" | "consolidate_memory" | "context" | "acceptance" | "set_acceptance"
  criteria?: unknown | null
  taskId?: string | null
  requestId?: string | null
  answers?: string[][] | null
  decision?: "once" | "always" | "reject" | null
  model?: {
    provider?: string | null
    model?: string | null
    tier?: "fast" | "balanced" | "best" | null
    variant?: string | null
  } | null
}
الردود
200 هدف application/json
{
  goal?: {
    objective: string
    status: "active" | "paused" | "blocked" | "usage_limited" | "budget_limited" | "complete"
    iteration: number | "Infinity" | "-Infinity" | "NaN"
    tokensUsed: number | "NaN"
    tokenBudget?: number | "NaN" | null
  } | null
  permissions?: Array<{
    requestId: string
    sessionId: string
    permission: string
    patterns: string[]
  }> | null
  busy: boolean
  text: string
  tasks: Array<{
    id: string
    agent: string
    description: string
    status: "queued" | "running" | "completed" | "error" | "cancelled"
    background: boolean
    text?: string | null
    error?: string | null
    createdAt?: number | "Infinity" | "-Infinity" | "NaN" | null
    startedAt?: number | "Infinity" | "-Infinity" | "NaN" | null
    finishedAt?: number | "Infinity" | "-Infinity" | "NaN" | null
  }>
  questions: Array<{
    requestId: string
    questions: Array<{
      header: string
      question: string
      options: Array<{
        label: string
        description: string
      }>
      multiple?: boolean | null
      custom?: boolean | null
    }>
  }>
  engineeringAcceptance?: {
    status: "accepted" | "failed" | "unmeasured" | "stale" | "not_configured"
    projectId: string
    drawingId: string
    revision: string
    criteriaDigest?: string | null
    checks: Array<{
      id: string
      status: "pass" | "fail" | "stale"
      reason?: string | null
      report?: unknown | null
    }>
    note: string
  } | null
  context: {
    memory?: {
      enabled: boolean
      memoryEnabled: boolean
      minHours: number | "Infinity" | "-Infinity" | "NaN"
      minSessions: number | "NaN"
      lastBrainAt: number | "NaN"
      hoursSinceLastBrain: number | "NaN"
      sessionsSinceLastBrain: number | "NaN"
      shouldTrigger: boolean
    } | null
    source: "host-config"
    auto: boolean
    prune: boolean
    reserved?: number | "Infinity" | "-Infinity" | "NaN" | null
    provider?: string | null
    model?: string | null
    contextWindow?: number | "Infinity" | "-Infinity" | "NaN" | null
    maxOutput?: number | "Infinity" | "-Infinity" | "NaN" | null
    inputWindow?: number | "Infinity" | "-Infinity" | "NaN" | null
    requestOutput?: number | "Infinity" | "-Infinity" | "NaN" | null
    compactAt?: number | "Infinity" | "-Infinity" | "NaN" | null
    tokens?: number | "Infinity" | "-Infinity" | "NaN" | null
    compacted: boolean
    breakdown?: {
      estimatedTotal: number | "Infinity" | "-Infinity" | "NaN"
      categories: Array<{
        category: string
        tokens: number | "NaN"
      }>
    } | null
  }
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.sessionControl
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiSessionControlInput
const result = await client.ai.sessionControl({
  sessionId: "",
  projectId: "",
  action: "status",
  criteria: null,
  taskId: "",
  requestId: "",
  answers: [
    [
      ""
    ]
  ],
  decision: "once",
  model: {}
})
curl
POST /api/ai/sessions/control
curl --request POST "${CADCAMFUN_URL}/api/ai/sessions/control" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
بريد /api/ai/sessions/state # ai.sessionState

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  sessionId: string
  projectId?: string | null
}
الردود
200 هدف application/json
{
  busy: boolean
  text: string
  error?: string | null
  tasks?: Array<{
    id: string
    agent: string
    description: string
    status: "queued" | "running" | "completed" | "error" | "cancelled"
    background: boolean
    text?: string | null
    error?: string | null
    createdAt?: number | "Infinity" | "-Infinity" | "NaN" | null
    startedAt?: number | null
    finishedAt?: number | null
  }> | null
  events?: Array<{
    type: "tool_call"
    sessionId: string
    agent?: string
    callId: string
    tool: string
    input: unknown
  } | {
    type: "tool_result"
    sessionId: string
    agent?: string
    callId: string
    tool: string
    ok: boolean
    output: string
    images?: string[]
  } | {
    type: "todo"
    sessionId: string
    todos: Array<{
      id?: string
      content: string
      status: "pending" | "in_progress" | "completed" | "cancelled"
      priority?: string
    }>
  } | {
    type: "tool_diagnostic"
    sessionId: string
    agent?: string
    callId: string
    tool: string
    kind: "argument" | "execution" | "partial" | "verification"
    severity: "error" | "warning" | "info"
    message: string
    recovery?: string
    mutationApplied?: boolean
  }> | null
  usage?: {
    inputTokens: number
    outputTokens: number
  } | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.sessionState
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiSessionStateInput
const result = await client.ai.sessionState({
  sessionId: "",
  projectId: ""
})
curl
POST /api/ai/sessions/state
curl --request POST "${CADCAMFUN_URL}/api/ai/sessions/state" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
بريد /api/ai/sessions/remove # ai.removeSession

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  sessionId: string
  projectId?: string | null
}
الردود
200 هدف application/json
{
  removed: boolean
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.removeSession
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiRemoveSessionInput
const result = await client.ai.removeSession({
  sessionId: "",
  projectId: ""
})
curl
POST /api/ai/sessions/remove
curl --request POST "${CADCAMFUN_URL}/api/ai/sessions/remove" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
بريد /api/ai/sessions/prompt # ai.sessionPrompt

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  permissionMode?: "auto" | "ask" | "approve" | null
  agent?: string | null
  mode?: string | null
  attachments?: Array<{
    name: string
    mime?: string | null
    data: string
    encoding?: "base64" | "text" | null
  }> | null
  message?: string | null
  sessionId?: string | null
  projectId?: string | null
  drawingId?: string | null
  context?: string | null
  includeContext?: boolean | null
  model?: {
    provider?: string | null
    model?: string | null
    tier?: "fast" | "balanced" | "best" | null
    variant?: string | null
  } | null
}
الردود
200 هدف application/json
{
  sessionId: string
  seq: number | "Infinity" | "-Infinity" | "NaN"
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
409 ConflictEncoded application/json
ConflictEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.sessionPrompt
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/sessions/prompt`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
POST /api/ai/sessions/prompt
curl --request POST "${CADCAMFUN_URL}/api/ai/sessions/prompt" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يحصل /api/ai/sessions/{sessionId}/stream # ai.sessionStream

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
sessionId طريق خيط مطلوب
بعد استفسار خيط | null خياري
الردود
200 هدف text/event-stream
{
  id: string | null
  event: string
  data: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.sessionStream
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/sessions/${sessionId}/stream`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
احصل على /api/ai/sessions/{sessionId}/stream
curl --request GET "${CADCAMFUN_URL}/api/ai/sessions/<sessionId>/stream" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يحصل /api/ai/sessions # ai.sessionList

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
projectId استفسار خيط مطلوب
حد استفسار خيط | null خياري
الردود
200 صفيف <كائن> application/json
Array<{
  id: string
  projectId: string
  title: string
  createdAt: string | null
  updatedAt: string | null
  busy: boolean
}>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.sessionList
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/sessions`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
الحصول على /api/ai/sessions
curl --request GET "${CADCAMFUN_URL}/api/ai/sessions?projectId=<projectId>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يحصل /api/ai/sessions/{sessionId}/messages # ai.sessionMessages

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
sessionId طريق خيط مطلوب
قبل استفسار خيط | null خياري
حد استفسار خيط | null خياري
الردود
200 هدف application/json
{
  sessionId: string
  messages: Array<{
    id: string
    role: "user" | "assistant"
    text: string
    createdAt: string | null
    agent: string | null
    model: string | null
    error: string | null
    truncated: boolean
    tools: Array<{
      callId: string
      tool: string
      status: "pending" | "running" | "completed" | "error"
      input?: unknown | null
      output: string
      truncated: boolean
    }>
  }>
  before: string | null
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.sessionMessages
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/sessions/${sessionId}/messages`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
احصل على /api/ai/sessions/{sessionId}/messages
curl --request GET "${CADCAMFUN_URL}/api/ai/sessions/<sessionId>/messages" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/extensions

يحصل /api/ai/extensions/mcp # ai.mcpServers

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
projectId استفسار خيط مطلوب
الردود
200 هدف application/json
{
  servers: Array<{
    name: string
    config: {
      type: "local"
      command: string[]
      environment?: {
        [key: string]: string
      } | null
      enabled: boolean
      timeout?: number | "Infinity" | "-Infinity" | "NaN" | null
    } | {
      type: "remote"
      url: string
      headers?: {
        [key: string]: string
      } | null
      oauth?: false
    status: string
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.mcpServers
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/mcp`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
احصل على /api/ai/extensions/mcp
curl --request GET "${CADCAMFUN_URL}/api/ai/extensions/mcp?projectId=<projectId>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يضع /api/ai/extensions/mcp # ai.saveMcpServer

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  projectId: string
  name: string
  config: {
    type: "local"
    command: string[]
    environment?: {
      [key: string]: string
    } | null
    enabled: boolean
    timeout?: number | "Infinity" | "-Infinity" | "NaN" | null
  } | {
    type: "remote"
    url: string
    headers?: {
      [key: string]: string
    } | null
    oauth?: false
}
الردود
200 هدف application/json
{
  servers: Array<{
    name: string
    config: {
      type: "local"
      command: string[]
      environment?: {
        [key: string]: string
      } | null
      enabled: boolean
      timeout?: number | "Infinity" | "-Infinity" | "NaN" | null
    } | {
      type: "remote"
      url: string
      headers?: {
        [key: string]: string
      } | null
      oauth?: false
    status: string
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.saveMcpServer
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/mcp`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
PUT /api/ai/extensions/mcp
curl --request PUT "${CADCAMFUN_URL}/api/ai/extensions/mcp" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يمسح /api/ai/extensions/mcp/{name} # ai.deleteMcpServer

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
اسم طريق خيط مطلوب
projectId استفسار خيط مطلوب
الردود
200 هدف application/json
{
  servers: Array<{
    name: string
    config: {
      type: "local"
      command: string[]
      environment?: {
        [key: string]: string
      } | null
      enabled: boolean
      timeout?: number | "Infinity" | "-Infinity" | "NaN" | null
    } | {
      type: "remote"
      url: string
      headers?: {
        [key: string]: string
      } | null
      oauth?: false
    status: string
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.deleteMcpServer
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/mcp/${name}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
حذف /api/ai/extensions/mcp/{name}
curl --request DELETE "${CADCAMFUN_URL}/api/ai/extensions/mcp/<name>?projectId=<projectId>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يمسح /api/ai/extensions/plugins/{id} # ai.removeExtensionPlugin

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
200 هدف application/json
{
  plugins: Array<{
    id: string
    name: string
    version: string
    enabled: boolean
    tools: number | "Infinity" | "-Infinity" | "NaN"
    mods: number | "Infinity" | "-Infinity" | "NaN"
    modes: number | "Infinity" | "-Infinity" | "NaN"
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.removeExtensionPlugin
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/plugins/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
حذف /api/ai/extensions/plugins/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/ai/extensions/plugins/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يضع /api/ai/extensions/plugins/{id} # ai.toggleExtensionPlugin

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
نص الطلب · مطلوب · application/json
{
  enabled: boolean
}
الردود
200 هدف application/json
{
  plugins: Array<{
    id: string
    name: string
    version: string
    enabled: boolean
    tools: number | "Infinity" | "-Infinity" | "NaN"
    mods: number | "Infinity" | "-Infinity" | "NaN"
    modes: number | "Infinity" | "-Infinity" | "NaN"
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.toggleExtensionPlugin
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/plugins/${id}`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
PUT /api/ai/extensions/plugins/{id}
curl --request PUT "${CADCAMFUN_URL}/api/ai/extensions/plugins/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يحصل /api/ai/extensions/plugins # ai.extensionPlugins

يتطلب Authorization: Bearer <token>.

الردود
200 هدف application/json
{
  plugins: Array<{
    id: string
    name: string
    version: string
    enabled: boolean
    tools: number | "Infinity" | "-Infinity" | "NaN"
    mods: number | "Infinity" | "-Infinity" | "NaN"
    modes: number | "Infinity" | "-Infinity" | "NaN"
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.extensionPlugins
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/plugins`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
احصل على /api/ai/extensions/plugins
curl --request GET "${CADCAMFUN_URL}/api/ai/extensions/plugins" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
بريد /api/ai/extensions/plugins # ai.installExtensionPlugin

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  manifest: string
  source: string
  files?: {
    [key: string]: string
  } | null
}
الردود
200 هدف application/json
{
  plugins: Array<{
    id: string
    name: string
    version: string
    enabled: boolean
    tools: number | "Infinity" | "-Infinity" | "NaN"
    mods: number | "Infinity" | "-Infinity" | "NaN"
    modes: number | "Infinity" | "-Infinity" | "NaN"
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.installExtensionPlugin
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/plugins`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
POST /api/ai/extensions/plugins
curl --request POST "${CADCAMFUN_URL}/api/ai/extensions/plugins" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يحصل /api/ai/extensions/mods # ai.extensionMods

يتطلب Authorization: Bearer <token>.

الردود
200 هدف application/json
{
  mods: Array<{
    id: string
    name: string
    description: string
    enabled: boolean
    origin: "assistant" | "user" | "plugin"
    pluginId?: string | null
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.extensionMods
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/mods`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
احصل على /api/ai/extensions/mods
curl --request GET "${CADCAMFUN_URL}/api/ai/extensions/mods" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يضع /api/ai/extensions/mods/{id} # ai.toggleExtensionMod

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
نص الطلب · مطلوب · application/json
{
  enabled: boolean
}
الردود
200 هدف application/json
{
  mods: Array<{
    id: string
    name: string
    description: string
    enabled: boolean
    origin: "assistant" | "user" | "plugin"
    pluginId?: string | null
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.toggleExtensionMod
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/mods/${id}`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
PUT /api/ai/extensions/mods/{id}
curl --request PUT "${CADCAMFUN_URL}/api/ai/extensions/mods/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يمسح /api/ai/extensions/mods/{id} # ai.removeExtensionMod

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
بطاقة تعريف طريق خيط مطلوب
الردود
200 هدف application/json
{
  mods: Array<{
    id: string
    name: string
    description: string
    enabled: boolean
    origin: "assistant" | "user" | "plugin"
    pluginId?: string | null
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.removeExtensionMod
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/extensions/mods/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
حذف /api/ai/extensions/mods/{id}
curl --request DELETE "${CADCAMFUN_URL}/api/ai/extensions/mods/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/modes

يحصل /api/ai/modes # ai.modes

يتطلب Authorization: Bearer <token>.

الردود
200 هدف application/json
{
  modes: Array<{
    id: string
    title: string
    description: string
    pluginId: string
    pluginName: string
  }>
  builtin?: Array<{
    id: string
    title: string
    description: string
    pluginId: string
    pluginName: string
  }> | null
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.modes
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/modes`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
الحصول على /api/ai/modes
curl --request GET "${CADCAMFUN_URL}/api/ai/modes" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/skills

يحصل /api/ai/skills # ai.skills

يتطلب Authorization: Bearer <token>.

الردود
200 هدف application/json
{
  skills: Array<{
    name: string
    description: string
    builtIn: boolean
    category: string
  }>
  max: number | "Infinity" | "-Infinity" | "NaN"
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
رد المثال تم الالتقاط · 200
احصل على /api/ai/skills
{
  "skills": [
    {
      "name": "cad-3d-modeling",
      "description": "Model 3D and 2D geometry in the open editor (45 element types): conventions, recipes for common parts, how to build complex objects.",
      "builtIn": true,
      "category": "cad"
    },
    {
      "name": "cam-operation-workflow",
      "description": "The loop from a drawing to verified G-code: describe, parameters, operation, generate, analyse, verify, fix.",
      "builtIn": true,
      "category": "cam"
    },
    {
      "name": "toolpath-verification",
      "description": "How to read and report a cam_edit action verify result: every finding code, its cause and its fix, and what was not modelled.",
      "builtIn": true,
      "category": "cam"
    },
    {
      "name": "cutting-parameters",
      "description": "Speeds, feeds, stepdown and stepover starting points by material, and the formulas behind them.",
      "builtIn": true,
      "category": "cam"
    },
    {
      "name": "drilling-and-holes",
      "description": "Drilling operations: cycles, peck rules, through-hole depth, large holes.",
      "builtIn": true,
      "category": "cam"
    },
    {
      "name": "precision-and-tolerances",
      "description": "Working to microns: nominal sizes, tolerance on round shapes, ISO 286 grades, finishing strategy and what the verification can and cannot show.",
      "builtIn": true,
      "category": "cam"
    },
    {
      "name": "industrial-standards",
      "description": "Mechanical and industrial rules for professional parts: ISO 2768 general tolerances, ISO 286 fits, surface finish, ISO 273 / ISO 4762 fastener holes, tap drills, DIN 6885 keys, ISO 54 gears, preferred numbers, design rules per process (milling, turning, sheet metal, casting, printing) and material densities.",
      "builtIn": true,
      "category": "cad"
    },
    {
      "name": "machines-and-axes",
      "description": "Mill, lathe and 3D printer: what turns, the sense of every axis, zeros and work offsets, touch probes and tool setters, and how to check a program against its machine.",
      "builtIn": true,
      "category": "cam"
    },
    {
      "name": "drawings-and-images",
      "description": "From a DXF/SVG file, an image of a dimensioned drawing, a photo or a sketch to a 3D model: which tool, what to ask, how to check the result.",
      "builtIn": true,
      "category": "cad"
    },
    {
      "name": "plugin-authoring",
      "description": "Write an extension for the ap
…
مثال SDK
ai.skills
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.ai.skills()
curl
احصل على /api/ai/skills
curl --request GET "${CADCAMFUN_URL}/api/ai/skills" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
يضع /api/ai/skills # ai.saveSkill

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  markdown?: string | null
  name?: string | null
  description?: string | null
  body?: string | null
}
الردود
200 هدف application/json
{
  skill: {
    name: string
    description: string
    builtIn: boolean
    category: string
  }
  skills: Array<{
    name: string
    description: string
    builtIn: boolean
    category: string
  }>
  live: boolean
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.saveSkill
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiSaveSkillInput
const result = await client.ai.saveSkill({
  markdown: "",
  name: "",
  description: "",
  body: ""
})
curl
ضع /api/ai/skills
curl --request PUT "${CADCAMFUN_URL}/api/ai/skills" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يمسح /api/ai/skills/{name} # ai.deleteSkill

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
اسم طريق خيط مطلوب
الردود
200 هدف application/json
{
  skills: Array<{
    name: string
    description: string
    builtIn: boolean
    category: string
  }>
  max: number | "Infinity" | "-Infinity" | "NaN"
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.deleteSkill
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiDeleteSkillInput
const result = await client.ai.deleteSkill({
  name: "<name>"
})
curl
حذف /api/ai/skills/{name}
curl --request DELETE "${CADCAMFUN_URL}/api/ai/skills/<name>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/credentials

يضع /api/ai/credentials # ai.setCredentials

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  provider?: string | null
  key?: string | null
  baseUrl?: string | null
}
الردود
200 هدف application/json
{
  providers: {
    [key: string]: "configured" | "missing"
  }
  configured: boolean
  tools?: Array<{
    id: string
    description: string
  }> | null
  host: "nikcli" | "direct"
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.setCredentials
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiSetCredentialsInput
const result = await client.ai.setCredentials({
  provider: "",
  key: "",
  baseUrl: ""
})
curl
ضع /api/ai/credentials
curl --request PUT "${CADCAMFUN_URL}/api/ai/credentials" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
يمسح /api/ai/credentials/{provider} # ai.clearCredentials

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
مزود طريق خيط مطلوب
الردود
200 هدف application/json
{
  providers: {
    [key: string]: "configured" | "missing"
  }
  configured: boolean
  tools?: Array<{
    id: string
    description: string
  }> | null
  host: "nikcli" | "direct"
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.clearCredentials
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiClearCredentialsInput
const result = await client.ai.clearCredentials({
  provider: "<provider>"
})
curl
حذف /api/ai/credentials/{provider}
curl --request DELETE "${CADCAMFUN_URL}/api/ai/credentials/<provider>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/status

يحصل /api/ai/status # ai.status

يتطلب Authorization: Bearer <token>.

الردود
200 هدف application/json
{
  providers: {
    [key: string]: "configured" | "missing"
  }
  configured: boolean
  tools?: Array<{
    id: string
    description: string
  }> | null
  host: "nikcli" | "direct"
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
رد المثال تم الالتقاط · 200
الحصول على /api/ai/status
{
  "providers": {
    "anthropic": "missing",
    "openai": "missing",
    "minimax": "missing",
    "gateway": "missing"
  },
  "configured": false,
  "host": "direct"
}
مثال SDK
ai.status
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.ai.status()
curl
الحصول على /api/ai/status
curl --request GET "${CADCAMFUN_URL}/api/ai/status" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/models

يحصل /api/ai/models # ai.models

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
configuredOnly استفسار "حقيقي" | "خطأ شنيع" | null خياري
الردود
200 صفيف <كائن> application/json
Array<{
  id: string
  provider: string
  tier?: "fast" | "balanced" | "best" | null
  contextWindow: number | "Infinity" | "-Infinity" | "NaN"
  tools: boolean
  vision: boolean
  configured: boolean
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
رد المثال تم الالتقاط · 200
الحصول على /api/ai/models
[
  {
    "id": "claude-haiku-4-5",
    "provider": "anthropic",
    "tier": "fast",
    "contextWindow": 200000,
    "tools": true,
    "vision": true,
    "configured": false
  },
  {
    "id": "claude-sonnet-5-5",
    "provider": "anthropic",
    "tier": "balanced",
    "contextWindow": 1000000,
    "tools": true,
    "vision": true,
    "configured": false
  },
  {
    "id": "claude-opus-5-5",
    "provider": "anthropic",
    "tier": "best",
    "contextWindow": 1000000,
    "tools": true,
    "vision": true,
    "configured": false
  },
  {
    "id": "gpt-5-mini",
    "provider": "openai",
    "tier": "fast",
    "contextWindow": 400000,
    "tools": true,
    "vision": true,
    "configured": false
  },
  {
    "id": "gpt-5",
    "provider": "openai",
    "tier": "balanced",
    "contextWindow": 400000,
    "tools": true,
    "vision": true,
    "configured": false
  },
  {
    "id": "MiniMax-M2",
    "provider": "minimax",
    "tier": "fast",
    "contextWindow": 200000,
    "tools": true,
    "vision": false,
    "configured": false
  },
  {
    "id": "anthropic/claude-haiku-4-5",
    "provider": "gateway",
    "tier": "fast",
    "contextWindow": 200000,
    "tools": true,
    "vision": true,
    "configured": false
  },
  {
    "id": "anthropic/claude-sonnet-5-5",
    "provider": "gateway",
    "tier": "balanced",
    "contextWindow": 1000000,
    "tools": true,
    "vision": true,
    "configured": false
  },
  {
    "id": "anthropic/claude-opus-5-5",
    "provider": "gateway",
    "tier": "best",
    "contextWindow": 1000000,
    "tools": true,
    "vision": true,
    "configured": false
  }
]
مثال SDK
ai.models
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiModelsInput
const result = await client.ai.models({})
curl
الحصول على /api/ai/models
curl --request GET "${CADCAMFUN_URL}/api/ai/models" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه
بريد /api/ai/models/refresh # ai.refreshModels

يتطلب Authorization: Bearer <token>.

الردود
200 صفيف <كائن> application/json
Array<{
  id: string
  name: string
  source: string
  auth: string[]
  configured: boolean
  baseUrl?: string | null
  defaultModel?: string | null
  models: Array<{
    id: string
    name: string
    provider: string
    contextWindow: number | "Infinity" | "-Infinity" | "NaN"
    maxOutput: number | "Infinity" | "-Infinity" | "NaN"
    inputWindow?: number | "Infinity" | "-Infinity" | "NaN" | null
    reasoning?: boolean | null
    variants?: string[] | null
    tools: boolean
    vision: boolean
    cost: {
      input: number | "Infinity" | "-Infinity" | "NaN"
      output: number | "Infinity" | "-Infinity" | "NaN"
    }
  }>
}>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.refreshModels
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/models/refresh`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
POST /api/ai/models/refresh
curl --request POST "${CADCAMFUN_URL}/api/ai/models/refresh" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/providers

يحصل /api/ai/providers # ai.providers

يتطلب Authorization: Bearer <token>.

الردود
200 صفيف <كائن> application/json
Array<{
  id: string
  name: string
  source: string
  auth: string[]
  configured: boolean
  baseUrl?: string | null
  defaultModel?: string | null
  models: Array<{
    id: string
    name: string
    provider: string
    contextWindow: number | "Infinity" | "-Infinity" | "NaN"
    maxOutput: number | "Infinity" | "-Infinity" | "NaN"
    inputWindow?: number | "Infinity" | "-Infinity" | "NaN" | null
    reasoning?: boolean | null
    variants?: string[] | null
    tools: boolean
    vision: boolean
    cost: {
      input: number | "Infinity" | "-Infinity" | "NaN"
      output: number | "Infinity" | "-Infinity" | "NaN"
    }
  }>
}>
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
رد المثال تم الالتقاط · 200
الحصول على /api/ai/providers
[
  {
    "id": "anthropic",
    "name": "anthropic",
    "source": "config",
    "auth": [
      "api"
    ],
    "configured": false,
    "models": [
      {
        "id": "claude-haiku-4-5",
        "name": "claude-haiku-4-5",
        "provider": "anthropic",
        "contextWindow": 200000,
        "maxOutput": 16000,
        "reasoning": false,
        "variants": [],
        "tools": true,
        "vision": true,
        "cost": {
          "input": 0,
          "output": 0
        }
      },
      {
        "id": "claude-sonnet-5-5",
        "name": "claude-sonnet-5-5",
        "provider": "anthropic",
        "contextWindow": 1000000,
        "maxOutput": 16000,
        "reasoning": false,
        "variants": [],
        "tools": true,
        "vision": true,
        "cost": {
          "input": 0,
          "output": 0
        }
      },
      {
        "id": "claude-opus-5-5",
        "name": "claude-opus-5-5",
        "provider": "anthropic",
        "contextWindow": 1000000,
        "maxOutput": 16000,
        "reasoning": false,
        "variants": [],
        "tools": true,
        "vision": true,
        "cost": {
          "input": 0,
          "output": 0
        }
      }
    ]
  },
  {
    "id": "openai",
    "name": "openai",
    "source": "config",
    "auth": [
      "api"
    ],
    "configured": false,
    "models": [
      {
        "id": "gpt-5-mini",
        "name": "gpt-5-mini",
        "provider": "openai",
        "contextWindow": 400000,
        "maxOutput": 16000,
        "reasoning": false,
        "variants": [],
        "tools": true,
        "vision": true,
        "cost": {
          "input": 0,
          "output": 0
        }
      },
      {
        "id": "gpt-5",
        "name": "gpt-5",
        "provider": "openai",
        "contextWindow": 400000,
        "maxOutput": 16000,
        "reasoning": false,
        "variants": [],
        "tools": true,
        "vision": true,
        "cost": {
          "input": 0,
          "output": 0
        }
      }
    ]
  },
  {
    "id": "minimax",
    "name": "minimax",
    "source": "config",
    "auth": [
      "api"
    ],
    "configured": false,
    "models": [
      {
        "id": "MiniMax-M2",
        "name": "MiniMax-M2",
        "provider": "minimax",
        "contextWindow": 200000,
        "maxOutput": 16000,
        "reasoning": false,
        "variants": [],
        "tools": true,
        "vision": false,
        "cost": {
          "input": 0,
          "output"
…
مثال SDK
ai.providers
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// no input
const result = await client.ai.providers()
curl
الحصول على /api/ai/providers
curl --request GET "${CADCAMFUN_URL}/api/ai/providers" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/prompts

يحصل /api/ai/prompts # ai.prompts

يتطلب Authorization: Bearer <token>.

حدود
اسمفييكتبمطلوب
وضع استفسار خيط | null خياري
الردود
200 هدف application/json
{
  prompts: string[]
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
رد المثال تم الالتقاط · 200
احصل على /api/ai/prompts
{
  "prompts": [
    "How do I get started with CAD/CAM?",
    "What's the difference between CAD and CAM?",
    "Can you recommend resources for learning more?"
  ]
}
مثال SDK
ai.prompts
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiPromptsInput
const result = await client.ai.prompts({})
curl
احصل على /api/ai/prompts
curl --request GET "${CADCAMFUN_URL}/api/ai/prompts" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
جربه

/api/ai/title

بريد /api/ai/title # ai.title

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  excerpt?: string | null
  model?: {
    provider?: string | null
    model?: string | null
    tier?: "fast" | "balanced" | "best" | null
    variant?: string | null
  } | null
}
الردود
200 هدف application/json
{
  title: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.title
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiTitleInput
const result = await client.ai.title({
  excerpt: "",
  model: {}
})
curl
POST /api/ai/title
curl --request POST "${CADCAMFUN_URL}/api/ai/title" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/design-analysis

بريد /api/ai/design-analysis # ai.designAnalysis

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  description?: string | null
  layer?: string | null
  machine?: string | null
  model?: {
    provider?: string | null
    model?: string | null
    tier?: "fast" | "balanced" | "best" | null
    variant?: string | null
  } | null
}
الردود
200 هدف application/json
{
  suggestions: Array<{
    title: string
    description: string
    confidence: number | "Infinity" | "-Infinity" | "NaN"
    priority: "low" | "medium" | "high"
    kind: "optimization" | "warning" | "critical"
  }>
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.designAnalysis
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiDesignAnalysisInput
const result = await client.ai.designAnalysis({
  description: "",
  layer: "",
  machine: "",
  model: {}
})
curl
POST /api/ai/تحليل التصميم
curl --request POST "${CADCAMFUN_URL}/api/ai/design-analysis" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/machining-parameters

بريد /api/ai/machining-parameters # ai.machiningParameters

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  material?: string | null
  tool?: string | null
  operation?: string | null
  machine?: string | null
  model?: {
    provider?: string | null
    model?: string | null
    tier?: "fast" | "balanced" | "best" | null
    variant?: string | null
  } | null
}
الردود
200 هدف application/json
{
  cuttingSpeedMPerMin: number | "Infinity" | "-Infinity" | "NaN"
  feedRateMmPerMin: number | "Infinity" | "-Infinity" | "NaN"
  depthOfCutMm: number | "Infinity" | "-Infinity" | "NaN"
  stepoverPct: number | "Infinity" | "-Infinity" | "NaN"
  coolant: "flood" | "mist" | "none"
  engagement: "conventional" | "climb"
  warnings: string[]
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.machiningParameters
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiMachiningParametersInput
const result = await client.ai.machiningParameters({
  material: "",
  tool: "",
  operation: "",
  machine: "",
  model: {}
})
curl
POST /api/ai/machining-parameters
curl --request POST "${CADCAMFUN_URL}/api/ai/machining-parameters" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/gcode-optimization

بريد /api/ai/gcode-optimization # ai.gcodeOptimization

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  gcode?: string | null
  material?: string | null
  machineType?: string | null
  constraints?: string | null
  model?: {
    provider?: string | null
    model?: string | null
    tier?: "fast" | "balanced" | "best" | null
    variant?: string | null
  } | null
}
الردود
200 هدف application/json
{
  gcode: string
  changes: Array<{
    line: number | "Infinity" | "-Infinity" | "NaN"
    before: string
    after: string
    reason: string
  }>
  estimatedSavings: {
    timePct: number | "Infinity" | "-Infinity" | "NaN"
    toolLifePct: number | "Infinity" | "-Infinity" | "NaN"
    qualityNote: string
  }
  notes: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.gcodeOptimization
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiGcodeOptimizationInput
const result = await client.ai.gcodeOptimization({
  gcode: "",
  material: "",
  machineType: "",
  constraints: "",
  model: {}
})
curl
POST /api/ai/gcode-optimization
curl --request POST "${CADCAMFUN_URL}/api/ai/gcode-optimization" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/design-suggestions

بريد /api/ai/design-suggestions # ai.designSuggestions

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  elements?: string | null
  currentOperation?: string | null
  currentTool?: string | null
  model?: {
    provider?: string | null
    model?: string | null
    tier?: "fast" | "balanced" | "best" | null
    variant?: string | null
  } | null
}
الردود
200 صفيف <كائن> application/json
Array<{
  title: string
  rationale: string
  nextStep: string
}>
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.designSuggestions
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiDesignSuggestionsInput
const result = await client.ai.designSuggestions({
  elements: "",
  currentOperation: "",
  currentTool: "",
  model: {}
})
curl
POST /api/ai/design-suggestions
curl --request POST "${CADCAMFUN_URL}/api/ai/design-suggestions" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/chat

بريد /api/ai/chat # ai.chat

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  messages?: unknown | null
  mcpServerId?: string | null
  mcpReference?: string | null
}
الردود
200 هدف application/json
{
  reply: string
  hasMcpData: boolean
}
400 AiBadRequestEncoded application/json
AiBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 AiNotFoundEncoded application/json
AiNotFoundEncoded
500 AiFailureEncoded application/json
AiFailureEncoded
مثال SDK
ai.chat
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiChatInput
const result = await client.ai.chat({
  messages: null,
  mcpServerId: "",
  mcpReference: ""
})
curl
نشر /api/ai/chat
curl --request POST "${CADCAMFUN_URL}/api/ai/chat" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
بريد /api/ai/chat/stream # ai.chatStream

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  permissionMode?: "auto" | "ask" | "approve" | null
  agent?: string | null
  mode?: string | null
  attachments?: Array<{
    name: string
    mime?: string | null
    data: string
    encoding?: "base64" | "text" | null
  }> | null
  message?: string | null
  sessionId?: string | null
  projectId?: string | null
  drawingId?: string | null
  context?: string | null
  includeContext?: boolean | null
  model?: {
    provider?: string | null
    model?: string | null
    tier?: "fast" | "balanced" | "best" | null
    variant?: string | null
  } | null
}
الردود
200 هدف text/event-stream
{
  id: string | null
  event: string
  data: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.chatStream
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiChatStreamInput
const result = await client.ai.chatStream({
  permissionMode: "auto",
  agent: "",
  mode: "",
  attachments: [
    {
      name: "",
      data: ""
    }
  ],
  message: "",
  sessionId: "",
  projectId: "",
  drawingId: "",
  context: "",
  includeContext: false,
  model: {}
})
curl
نشر /api/ai/chat/stream
curl --request POST "${CADCAMFUN_URL}/api/ai/chat/stream" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
بريد /api/ai/chat/queue # ai.chatQueue

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  sessionId: string
  message: string
  projectId?: string | null
  delivery?: "queue" | "steer" | null
}
الردود
200 هدف application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.chatQueue
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiChatQueueInput
const result = await client.ai.chatQueue({
  sessionId: "",
  message: "",
  projectId: "",
  delivery: "queue"
})
curl
POST /api/ai/chat/queue
curl --request POST "${CADCAMFUN_URL}/api/ai/chat/queue" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
بريد /api/ai/chat/abort # ai.chatAbort

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  sessionId?: string | null
  projectId?: string | null
}
الردود
200 هدف application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.chatAbort
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiChatAbortInput
const result = await client.ai.chatAbort({
  sessionId: "",
  projectId: ""
})
curl
POST /api/ai/chat/abort
curl --request POST "${CADCAMFUN_URL}/api/ai/chat/abort" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/permission

بريد /api/ai/permission/reply # ai.permissionReply

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  sessionId: string
  projectId?: string | null
  requestId: string
  decision: "once" | "always" | "reject"
}
الردود
200 هدف application/json
{
  message: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.permissionReply
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiPermissionReplyInput
const result = await client.ai.permissionReply({
  sessionId: "",
  projectId: "",
  requestId: "",
  decision: "once"
})
curl
POST /api/ai/permission/reply
curl --request POST "${CADCAMFUN_URL}/api/ai/permission/reply" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/completion

بريد /api/ai/completion # ai.completion

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  prompt?: string | null
  systemPrompt?: string | null
  model?: string | null
  temperature?: number | "Infinity" | "-Infinity" | "NaN" | null
}
الردود
200 هدف application/json
{
  text: string
  model: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.completion
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiCompletionInput
const result = await client.ai.completion({
  prompt: "",
  systemPrompt: "",
  model: "",
  temperature: 0
})
curl
POST /api/ai/completion
curl --request POST "${CADCAMFUN_URL}/api/ai/completion" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/analyze-gcode

بريد /api/ai/analyze-gcode # ai.analyzeGcode

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  gcode?: string | null
  model?: string | null
}
الردود
200 هدف application/json
{
  issues: Array<{
    severity: "error" | "warning" | "info"
    code: string
    line: number | "Infinity" | "-Infinity" | "NaN"
    message: string
  }>
  stats: {
    lines: number | "Infinity" | "-Infinity" | "NaN"
    rapidMoves: number | "Infinity" | "-Infinity" | "NaN"
    cutMoves: number | "Infinity" | "-Infinity" | "NaN"
    toolChanges: number | "Infinity" | "-Infinity" | "NaN"
    bounds: {
      min: {
        x: number | "Infinity" | "-Infinity" | "NaN"
        y: number | "NaN"
        z: number | "NaN"
      }
      max: {
        x: number | "NaN"
      }
    } | null
  }
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.analyzeGcode
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiAnalyzeGcodeInput
const result = await client.ai.analyzeGcode({
  gcode: "",
  model: ""
})
curl
POST /api/ai/analyze-gcode
curl --request POST "${CADCAMFUN_URL}/api/ai/analyze-gcode" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/gcode

بريد /api/ai/gcode # ai.gcode

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  action?: string | null
  gcode?: string | null
  partialCode?: string | null
  machineType?: string | null
  material?: string | null
  model?: string | null
  options?: unknown | null
  description?: string | null
  toolpathType?: string | null
}
الردود
200 هدف application/json
{
  success: true
  action: string
  data: unknown
  processedAt: string
}
400 GcodeActionErrorEncoded application/json
GcodeActionErrorEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 GcodeActionFailureEncoded application/json
GcodeActionFailureEncoded
مثال SDK
ai.gcode
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiGcodeInput
const result = await client.ai.gcode({
  action: "",
  gcode: "",
  partialCode: "",
  machineType: "",
  material: "",
  model: "",
  options: null,
  description: "",
  toolpathType: ""
})
curl
POST /api/ai/gcode
curl --request POST "${CADCAMFUN_URL}/api/ai/gcode" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/toolpath-analysis

بريد /api/ai/toolpath-analysis # ai.toolpathAnalysis

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  gcode?: string | null
  model?: string | null
  max_tokens?: number | "Infinity" | "-Infinity" | "NaN" | null
}
الردود
200 هدف application/json
{
  insights: string
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.toolpathAnalysis
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiToolpathAnalysisInput
const result = await client.ai.toolpathAnalysis({
  gcode: "",
  model: "",
  max_tokens: 0
})
curl
POST /api/ai/toolpath-ana Analysis
curl --request POST "${CADCAMFUN_URL}/api/ai/toolpath-analysis" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/feedback

بريد /api/ai/feedback # ai.feedback

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  messageId?: string | null
  rating?: string | null
  comment?: string | null
}
الردود
200 هدف application/json
{
  success: true
  message: string
}
400 AiBadRequestEncoded application/json
AiBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 AiFailureEncoded application/json
AiFailureEncoded
مثال SDK
ai.feedback
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiFeedbackInput
const result = await client.ai.feedback({
  messageId: "",
  rating: "",
  comment: ""
})
curl
نشر /api/ai/feedback
curl --request POST "${CADCAMFUN_URL}/api/ai/feedback" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/proxy

بريد /api/ai/proxy # ai.proxy

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  model?: string | null
  messages?: unknown | null
  max_tokens?: number | "Infinity" | "-Infinity" | "NaN" | null
  temperature?: number | "Infinity" | "-Infinity" | "NaN" | null
  system?: unknown | null
  reasoning?: unknown | null
}
الردود
200 هدف application/json
{
  id: string
  type: "message"
  role: "assistant"
  model: string
  content: Array<{
    type: "text"
    text: string
  }>
  stop_reason: string | null
  usage: {
    input_tokens: number | "Infinity" | "-Infinity" | "NaN"
    output_tokens: number | "Infinity" | "-Infinity" | "NaN"
  }
}
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
مثال SDK
ai.proxy
import { CadCam } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

// AiProxyInput
const result = await client.ai.proxy({
  model: "",
  messages: null,
  max_tokens: 0,
  temperature: 0,
  system: null,
  reasoning: null
})
curl
بوست /api/ai/proxy
curl --request POST "${CADCAMFUN_URL}/api/ai/proxy" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

/api/ai/oauth

بريد /api/ai/oauth/authorize # ai.oauthAuthorize

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  provider: "openai" | "xai"
}
الردود
200 هدف application/json
{
  attemptId: string
  url: string
  instructions: string
  method: "auto" | "code" | "auto-code"
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.oauthAuthorize
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/oauth/authorize`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
POST /api/ai/oauth/authorize
curl --request POST "${CADCAMFUN_URL}/api/ai/oauth/authorize" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه
بريد /api/ai/oauth/complete # ai.oauthComplete

يتطلب Authorization: Bearer <token>.

نص الطلب · مطلوب · application/json
{
  provider: "openai" | "xai"
  attemptId: string
  code?: string | null
}
الردود
200 هدف application/json
{
  providers: {
    [key: string]: "configured" | "missing"
  }
  configured: boolean
  tools?: Array<{
    id: string
    description: string
  }> | null
  host: "nikcli" | "direct"
}
400 BadRequestEncoded application/json
BadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 InternalErrorEncoded application/json
InternalErrorEncoded
جلب المثال
ai.oauthComplete
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/ai/oauth/complete`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
curl
POST /api/ai/oauth/Complete
curl --request POST "${CADCAMFUN_URL}/api/ai/oauth/complete" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
جربه

المخططات

يمكن الوصول إلى المخططات المسماة من معلمات هذه المجموعة وأجسامها واستجاباتها. أ ? يمثل حقلاً اختياريًا؛ | null يضع علامة على الحقل الذي قد يكون موجودًا بقيمة فارغة.

AiBadRequestEncoded
{
  _tag: "AiBadRequest"
  error: string
}
AiFailureEncoded
{
  _tag: "AiFailure"
  error: string
}
AiNotFoundEncoded
{
  _tag: "AiNotFound"
  error: string
}
BadRequestEncoded
{
  _tag: "BadRequest"
  message: string
}
ConflictEncoded
{
  _tag: "Conflict"
  message: string
}
GcodeActionErrorEncoded
{
  _tag: "GcodeActionError"
  success: false
  error: string
  action?: string | null
  processedAt?: string | null
}
GcodeActionFailureEncoded
{
  _tag: "GcodeActionFailure"
  success: false
  error: string
  action: string
  processedAt: string
}
InternalErrorEncoded
{
  _tag: "InternalError"
  message: string
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

استدعاء هذه المجموعة

معرفات العملية لها النموذج ai.<name>. وعد SDK الذي تم إنشاؤه (@cadcamfun/api/sdk) يعرض معظمهم client.<namespace>.<method>(input)، أين input هو كائن مسطح واحد من معلمات المسار وحقول النص؛ يُظهر مثال SDK لكل بطاقة الملحق الدقيق ونوع الإدخال. لا يتم إنشاء التحميلات متعددة الأجزاء والاستجابات الثنائية أو استجابات JavaScript وخطافات الويب الأولية؛ تظهر تلك البطاقات fetch بدلاً من ذلك.

أخطاء من Promise SDK
import { CadCam, ClientError } from "@cadcamfun/api/sdk"

const client = CadCam.make({
  baseUrl: process.env.CADCAMFUN_URL!,
  headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})

try {
  await client.projects.list()
} catch (error) {
  if (error instanceof ClientError) {
    // Transport | UnexpectedStatus | UnsupportedContentType | MalformedResponse | SseEventTooLarge
  } else {
    // a declared error body: switch on error._tag
  }
}

استكشاف الأخطاء وإصلاحها

أعراضالسبب المحتمليصلح
401 في كل طلبرمز مميز من إطلاق سابق، أو مفقود Bearer بادئةيرسل Authorization: Bearer <token> بالرمز المميز الذي بدأت به السايدكار.
400 قبل أن يحدث أي شيءالنص أو المعلمة لا يتطابقان مع المخططقارن الحمولة بمخطط الطلب الموجود على البطاقة.
403 أو 404 لسجل يمكنك رؤيته في مكان آخرحساب التمثيل يختلفأرسل الحق x-session-tokenأو استخدم ملف التعريف المحلي الذي يملك السجل.
409حالة متعارضة، مثل اسم مكرر أو رأس فرع قديمأعد قراءة المورد وأعد المحاولة باستخدام البيانات الحالية.
جربه يقول "تم حظره بواسطة CORS"يتم تقديم المستندات من أصل غير استرجاعيقم بتشغيل المستندات محليًا أو انسخ الطلب كـ curly.
رفض اتصالتم إعادة تشغيل السايدكار في منفذ جديدقراءة المنفذ من الجديد ready سطر.