Arachne

API Reference

Complete Arachne gateway and portal API reference

Arachne exposes three API surfaces: the Gateway for LLM inference, the Portal API for tenant self-service, and the Admin API for system-wide operations.

Gateway API

The gateway is OpenAI-compatible. Any client that works with the OpenAI API works with Arachne.

POST /v1/chat/completions

Send a chat completion request through the gateway. The agent, model, and provider are resolved from the API key.

Authentication: Bearer token or x-api-key header with your Arachne API key.

Request Body:

{
  "messages": [
    { "role": "user", "content": "What is Arachne?" }
  ],
  "stream": true,
  "conversation_id": "conv_abc123",
  "partition_id": "user_42"
}
FieldTypeRequiredDescription
messagesarrayYesArray of chat messages (role + content)
streambooleanNoEnable server-sent event streaming (default: false)
conversation_idstringNoConversation thread ID for memory continuity
partition_idstringNoPartition key for data isolation within a tenant
temperaturenumberNoSampling temperature (passed through to provider)
max_tokensnumberNoMaximum tokens in the response
toolsarrayNoTool/function definitions for function calling
tool_choicestring | objectNoTool selection strategy

Response (non-streaming):

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Arachne is an AI runtime..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 89,
    "total_tokens": 113
  },
  "rag_sources": [
    {
      "chunk_id": "chunk_001",
      "content": "Arachne is a multi-tenant AI gateway...",
      "similarity": 0.92,
      "knowledge_base": "product-docs"
    }
  ]
}

RAG Sources: When the agent has an attached knowledge base, the response includes a rag_sources array with the retrieved chunks, their similarity scores, and the source knowledge base. This enables citation and transparency in RAG-powered responses.

Streaming Response: When stream: true, the response is delivered as server-sent events in OpenAI-compatible format:

data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":"Arachne"},"index":0}]}

data: {"id":"chatcmpl-abc","choices":[{"delta":{"content":" is"},"index":0}]}

data: [DONE]

Portal API

The portal API powers the self-service UI. All endpoints require a Portal JWT token obtained via login.

Base path: /v1/portal

Authentication: Authorization: Bearer <portal_jwt>

Authentication

MethodEndpointDescription
POST/auth/signupCreate a new account and tenant
POST/auth/loginAuthenticate and receive a JWT
POST/auth/switch-tenantSwitch active tenant context

Agents

MethodEndpointDescription
GET/agentsList all agents in the current tenant
POST/agentsCreate a new agent
GET/agents/:idGet agent details
PUT/agents/:idUpdate an agent
DELETE/agents/:idDelete an agent

Knowledge Bases

MethodEndpointDescription
GET/knowledge-basesList knowledge bases
POST/knowledge-basesCreate a knowledge base with file upload
GET/knowledge-bases/:idGet knowledge base details and chunks
DELETE/knowledge-bases/:idDelete a knowledge base

API Keys

MethodEndpointDescription
GET/api-keysList API keys (masked)
POST/api-keysGenerate a new API key
DELETE/api-keys/:idRevoke an API key

Members

MethodEndpointDescription
GET/membersList tenant members
POST/invitesSend an invite
DELETE/members/:idRemove a member

Settings

MethodEndpointDescription
GET/settingsGet tenant settings
PUT/settingsUpdate tenant settings
GET/settings/providersGet provider configurations
PUT/settings/providersUpdate provider configurations

Admin API

The admin API is for system operators managing the Arachne instance. All endpoints require an Admin JWT.

Admin dashboard

Base path: /v1/admin

Authentication: Authorization: Bearer <admin_jwt>

MethodEndpointDescription
GET/tenantsList all tenants
POST/tenantsCreate a tenant
GET/tenants/:idGet tenant details
PUT/tenants/:idUpdate tenant settings
GET/providersList global provider configurations
POST/providersCreate a provider configuration
PUT/providers/:idUpdate a provider configuration
DELETE/providers/:idDelete a provider configuration
GET/analytics/summarySystem-wide analytics summary
GET/analytics/timeseriesSystem-wide request timeseries

Error Responses

All APIs return errors in a consistent format:

{
  "error": {
    "code": "invalid_api_key",
    "message": "The provided API key is invalid or has been revoked."
  }
}

Common HTTP status codes:

StatusMeaning
400Bad request — invalid parameters
401Unauthorized — missing or invalid credentials
403Forbidden — insufficient permissions
404Not found
429Rate limited
502Upstream provider error