Skip to content

REST API Reference

All REST endpoints return JSON with Content-Type: application/json. Authentication is via API key unless noted otherwise.

Base URL

http://localhost:7337

Authentication

Pass your API key in one of two ways:

X-Seepient-API-Key: sk_seepient_...
Authorization: Bearer sk_seepient_...

See Authentication for key generation and scopes.


Health Check

GET /v1/health

Returns server status. No authentication required.

Example

bash
curl http://localhost:7337/v1/health

Response

json
{
  "status": "ok",
  "version": "0.1.1",
  "uptime": 3600
}
FieldTypeDescription
statusstringAlways "ok" when the server is running
versionstringSeepient Agent package version
uptimenumberSeconds since server started

List Models

GET /v1/models

Returns all available models from your configured inference providers (OpenAI, Anthropic, GLM). Seepient Agent does not host these models — it forwards requests to the provider APIs. Requires a valid API key.

Example

bash
curl http://localhost:7337/v1/models \
  -H "X-Seepient-API-Key: sk_seepient_..."

Response

json
{
  "models": {
    "openai": ["gpt-5.4", "gpt-5.4-pro", "gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.3-instant", "gpt-5.3-codex", "o3", "o3-mini"],
    "anthropic": ["claude-sonnet-4-6-20260320", "claude-opus-4-6-20260320", "claude-haiku-4-5-20251001"],
    "glm": ["opus", "sonnet", "haiku"],
    "openai-compatible": ["(user-configured)"]
  }
}
FieldTypeDescription
modelsobjectMap of provider names to model ID arrays

List Skills

GET /v1/skills

Returns metadata for all registered skills. Requires a valid API key.

Example

bash
curl http://localhost:7337/v1/skills \
  -H "X-Seepient-API-Key: sk_seepient_..."

Response

json
{
  "skills": [
    {
      "name": "code-review",
      "description": "Review code for quality, security, and best practices",
      "tags": ["code", "review", "quality"]
    },
    {
      "name": "summarize",
      "description": "Summarize text or documents concisely",
      "tags": ["text", "summary"]
    }
  ]
}
FieldTypeDescription
skillsarrayArray of skill metadata objects
skills[].namestringSkill identifier
skills[].descriptionstringHuman-readable description
skills[].tagsstring[]Tags for categorization

List Sessions

GET /v1/sessions

Returns session metadata (no message bodies) for the caller's API key.

Example

bash
curl -H "Authorization: Bearer YOUR_KEY" http://localhost:7337/v1/sessions

Response

json
{
  "sessions": [
    { "id": "abc123", "createdAt": 1700000000000, "updatedAt": 1700000600000, "messageCount": 6 }
  ]
}

Chat

POST /v1/chat

Execute a one-shot agent interaction. Requires API key with agent:run scope.

Request body

FieldTypeRequiredDefaultDescription
messagestringYes--The user prompt
modelstringNoProvider defaultModel ID to use
providerstringNoServer defaultProvider: openai, anthropic, glm, openai-compatible
toolsstring[]No[]Tool names or group names to enable
maxStepsnumberNo10Maximum agent loop iterations
skillsstring[]No[]Skill names to activate

Example

bash
curl -X POST http://localhost:7337/v1/chat \
  -H "Content-Type: application/json" \
  -H "X-Seepient-API-Key: sk_seepient_..." \
  -d '{
    "message": "What files are in the current directory?",
    "provider": "anthropic",
    "tools": ["execute_shell_command"],
    "maxSteps": 5
  }'

Success response (200)

json
{
  "text": "The current directory contains the following files:\n- README.md\n- package.json\n- src/",
  "toolCalls": [
    {
      "id": "call_abc123",
      "name": "execute_shell_command",
      "arguments": { "command": "ls" },
      "result": "README.md\npackage.json\nsrc/"
    }
  ],
  "usage": {
    "promptTokens": 245,
    "completionTokens": 87,
    "totalTokens": 332,
    "cost": 0.0032
  },
  "finishReason": "stop"
}

Error responses

StatusCodeWhen
400BAD_REQUESTMissing or invalid message field
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENKey lacks agent:run scope
500GENERATION_ERRORText generation failed (retryable)
502PROVIDER_ERRORLLM provider failure (retryable)

Response fields

FieldTypeDescription
textstringThe generated text response
toolCallsarrayTool invocations made during generation
toolCalls[].idstringUnique call identifier
toolCalls[].namestringTool name that was invoked
toolCalls[].argumentsobjectArguments passed to the tool
toolCalls[].resultstringTool execution result
usageobjectToken usage and cost breakdown
usage.promptTokensnumberTokens in the prompt
usage.completionTokensnumberTokens in the completion
usage.totalTokensnumberTotal tokens consumed
usage.costnumberEstimated cost in USD
finishReasonstring"stop", "tool_calls", "length", or "error"

Get Session

GET /v1/sessions/:id

Retrieve a session by its ID. Requires API key with agent:read scope.

Example

bash
curl http://localhost:7337/v1/sessions/550e8400-e29b-41d4-a716-446655440000 \
  -H "X-Seepient-API-Key: sk_seepient_..."

Success response (200)

json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "messages": [
    {
      "id": "msg_001",
      "role": "user",
      "content": "What is closures in JavaScript?",
      "timestamp": 1712505600000
    },
    {
      "id": "msg_002",
      "role": "assistant",
      "content": "A closure is a function that has access to...",
      "timestamp": 1712505602000
    }
  ],
  "createdAt": 1712505600000,
  "updatedAt": 1712505602000,
  "provider": "anthropic",
  "model": "claude-sonnet-4-6-20260320"
}

Error responses

StatusCodeWhen
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENKey lacks agent:read scope
404NOT_FOUNDSession expired or does not exist

Response fields

FieldTypeDescription
idstringSession UUID
messagesarrayOrdered message history
messages[].idstringMessage UUID
messages[].rolestring"user" or "assistant"
messages[].contentstringMessage text content
messages[].timestampnumberUnix timestamp in milliseconds
createdAtnumberSession creation timestamp (ms)
updatedAtnumberLast update timestamp (ms)
providerstringLLM provider used
modelstringModel ID used

Error format

All errors follow a consistent JSON structure:

json
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Missing or invalid API key"
  }
}

Retryable errors

PROVIDER_ERROR and GENERATION_ERROR are retryable. Implement exponential backoff with a maximum of 3 retries.

Released under the Business Source License 1.1.