Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.zgi.cn/llms.txt

Use this file to discover all available pages before exploring further.

Authentication

All API requests need to carry the API Key in the header:
Authorization: Bearer YOUR_API_KEY
API Keys can be created and managed in Workspace Settings → API Key Management.

Base URL

EnvironmentBase URL
Cloud SaaShttps://api.zgi.cn/v1
Private deploymenthttp://YOUR_HOST:2678/v1

Core endpoint

  • POST /v1/chat/completions: Send conversation request, support knowledge base retrieval and streaming output
  • GET /v1/models: Get the list of available models
  • POST /v1/workflows/{workflow_id}/run: triggers the execution of the specified workflow
  • POST /v1/knowledge-bases/{kb_id}/documents: Upload documents to the knowledge base
  • POST /v1/knowledge-bases/{kb_id}/search: Query knowledge base search results

Dialog request example

curl -X POST https://api.zgi.cn/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zgi-default",
    "messages": [
      { "role": "system", "content": "You are a contract review assistant" },
      { "role": "user", "content": "What are the payment terms in this contract?" }
    ],
    "knowledge_base_id": "kb_xxxxxx",
    "stream": true,
    "temperature": 0.7
  }'

Request parameters

ParametersTypeRequiredDescription
modelstringrequiredModel ID to use
messagesarrayrequiredarray of conversation messages
knowledge_base_idstringOptionalThe associated knowledge base ID
streambooleanOptionalWhether to enable streaming output
temperaturefloatoptionalsampling temperature (0-2)

SDK

# Python
pip install zgi-sdk

# JavaScript / TypeScript
npm install @zgi/sdk
from zgi import ZGIClient

client = ZGIClient(api_key="YOUR_API_KEY")

# Query knowledge base
result = client.knowledge.query(
    knowledge_base_id="kb_xxxxxx",
    question="How many days is the payment cycle in this contract?"
)
print(result.answer)
print(result.citations)  # [{"source": "contract.pdf", "page": 4, "text": "..."}]

# trigger workflow
run = client.workflows.run(
    workflow_id="wf_xxxxxx",
    inputs={"document_url": "https://..."}
)