Nền tảng API và SaaS doanh nghiệp

Doanh nghiệp chỉ cần gọi API để tạo hệ AI riêng với đầy đủ tính năng quản trị, phê duyệt, biên nhận và chi phí

Nền tảng API AIOS

API-first Architecture

Xây dựng hệ thống AI riêng với nền tảng API toàn diện

Nguyên AI cung cấp nền tảng API toàn diện để doanh nghiệp xây dựng hệ thống AI riêng với:

  • API tạo tenant - Thiết lập không gian riêng cho doanh nghiệp
  • API tạo thương hiệu - Cấu hình thương hiệu và định danh
  • API tạo công cụ - Xây dựng công cụ AI tùy chỉnh
  • API tạo tác nhân - Tạo tác nhân AI theo nhu cầu
  • API tạo lệnh - Gửi lệnh và nhận kết quả
  • API tạo việc - Quản lý công việc và quy trình
  • API phê duyệt - Xử lý phê duyệt và kiểm soát
  • API biên nhận - Tạo và quản lý biên nhận
  • API đo chi phí - Theo dõi và kiểm soát chi phí
Kiến trúc API AIOS

Danh mục API

Các nhóm API chính của nền tảng AIOS

Management APIs

Quản lý tenant, thương hiệu, người dùng và quyền truy cập

  • Tenant Management
  • Brand Configuration
  • User Management
  • Role & Permission

Core APIs

Lõi hệ thống AI với lệnh, việc, tác nhân và công cụ

  • Command Management
  • Job Management
  • Agent Management
  • Tool Management

Governance APIs

Phê duyệt, biên nhận, chi phí và chính sách

  • Approval Management
  • Receipt Management
  • Cost Tracking
  • Policy Management

Integration APIs

Tích hợp với hệ thống bên ngoài và connector

  • Connector Management
  • Webhook Management
  • External System
  • Data Integration

Tài liệu API

Chi tiết các endpoint và tham số API

Tenant API

POST /api/v1/tenants

Tạo tenant mới cho doanh nghiệp

Request Body:
{
  "name": "Company Name",
  "domain": "company.com",
  "industry": "finance",
  "size": "medium",
  "contact_email": "admin@company.com"
}
Response:
{
  "id": "tenant_123456",
  "name": "Company Name",
  "domain": "company.com",
  "status": "active",
  "created_at": "2026-07-09T10:00:00Z"
}

Brand API

POST /api/v1/brands

Tạo thương hiệu mới trong tenant

Request Body:
{
  "tenant_id": "tenant_123456",
  "name": "Brand Name",
  "logo_url": "https://example.com/logo.png",
  "primary_color": "#3b82f6",
  "secondary_color": "#1e3a8a"
}
Response:
{
  "id": "brand_789012",
  "tenant_id": "tenant_123456",
  "name": "Brand Name",
  "status": "active",
  "created_at": "2026-07-09T10:00:00Z"
}

Command API

POST /api/v1/commands

Gửi lệnh AI và nhận kết quả

Request Body:
{
  "tenant_id": "tenant_123456",
  "brand_id": "brand_789012",
  "text": "Analyze customer data for Q3 2026",
  "agent_id": "agent_analyst",
  "risk_level": "medium",
  "requires_approval": true
}
Response:
{
  "id": "cmd_345678",
  "status": "pending_approval",
  "job_id": "job_345678",
  "receipt_id": "rcp_345678",
  "created_at": "2026-07-09T10:00:00Z"
}

Agent API

POST /api/v1/agents

Tạo tác nhân AI mới

Request Body:
{
  "tenant_id": "tenant_123456",
  "brand_id": "brand_789012",
  "name": "Financial Analyst",
  "description": "AI agent for financial analysis",
  "capabilities": ["analysis", "reporting", "forecasting"],
  "tools": ["data_analyzer", "chart_generator"]
}
Response:
{
  "id": "agent_901234",
  "name": "Financial Analyst",
  "status": "active",
  "created_at": "2026-07-09T10:00:00Z"
}

Approval API

POST /api/v1/approvals/{approval_id}/approve

Phê duyệt yêu cầu

Request Body:
{
  "approver_id": "user_123456",
  "decision": "approved",
  "comment": "Approved for financial analysis"
}
Response:
{
  "id": "approval_567890",
  "status": "approved",
  "approved_at": "2026-07-09T10:00:00Z",
  "approved_by": "user_123456"
}

Receipt API

GET /api/v1/receipts/{receipt_id}

Lấy thông tin biên nhận

Response:
{
  "id": "rcp_345678",
  "command_id": "cmd_345678",
  "job_id": "job_345678",
  "status": "completed",
  "cost": 0.05,
  "created_at": "2026-07-09T10:00:00Z",
  "completed_at": "2026-07-09T10:05:00Z",
  "hash": "0x1234567890abcdef"
}

Cost API

GET /api/v1/costs/summary

Lấy báo cáo chi phí

Query Parameters:
?tenant_id=tenant_123456&start_date=2026-07-01&end_date=2026-07-31
Response:
{
  "tenant_id": "tenant_123456",
  "period": {
    "start_date": "2026-07-01",
    "end_date": "2026-07-31"
  },
  "total_cost": 1250.75,
  "total_commands": 25015,
  "average_cost_per_command": 0.05,
  "costs_by_agent": {
    "agent_901234": 850.50,
    "agent_234567": 400.25
  }
}

SDK và Libraries

Bộ phát triển cho các ngôn ngữ phổ biến

Node.js SDK

SDK cho Node.js và TypeScript

npm install @nguyenai/node-sdk

Python SDK

SDK cho Python 3.8+

pip install nguyenai-python-sdk

Go SDK

SDK cho Go 1.19+

go get github.com/nguyenai/go-sdk

Java SDK

SDK cho Java 11+

implementation 'com.nguyenai:java-sdk'

Ví dụ tích hợp

Cách tích hợp API vào các hệ thống hiện có

Node.js Example

const NguyenAI = require('@nguyenai/node-sdk');

const client = new NguyenAI({
  apiKey: 'your-api-key',
  tenantId: 'tenant_123456'
});

// Create a command
const command = await client.commands.create({
  text: 'Analyze customer data',
  agentId: 'agent_analyst',
  requiresApproval: true
});

console.log('Command created:', command.id);

Python Example

import nguyenai

client = nguyenai.Client(
    api_key='your-api-key',
    tenant_id='tenant_123456'
)

# Create a command
command = client.commands.create(
    text='Analyze customer data',
    agent_id='agent_analyst',
    requires_approval=True
)

print(f'Command created: {command.id}')

Go Example

package main

import (
    "fmt"
    "github.com/nguyenai/go-sdk"
)

func main() {
    client := nguyenai.NewClient("your-api-key", "tenant_123456")
    
    command, err := client.Commands.Create(&nguyenai.CreateCommandRequest{
        Text: "Analyze customer data",
        AgentID: "agent_analyst",
        RequiresApproval: true,
    })
    
    fmt.Printf("Command created: %s\n", command.ID)
}

Truy cập API

Cách bắt đầu với API Nguyên AI

1

Đăng ký doanh nghiệp

Đăng ký tài khoản doanh nghiệp và nhận API key

2

Tạo tenant

Sử dụng API để tạo tenant cho doanh nghiệp

3

Cấu hình thương hiệu

Thiết lập thương hiệu và cấu hình ban đầu

4

Tích hợp API

Bắt đầu tích hợp API vào hệ thống của bạn

Sẵn sàng xây dựng hệ thống AI riêng với API?

Nhận truy cập API và bắt đầu tích hợp ngay hôm nay