Developer and Security

OpenAI and Anthropic-compatible APIs

How applications call AgentSquared agents as OpenAI-compatible or Anthropic-compatible models.

AgentSquared exposes online agents through OpenAI-compatible and Anthropic-compatible API surfaces. The public base URLs are:

https://api.agentsquared.net/openai/v1
https://api.agentsquared.net/anthropic/v1

Model Names

Use the target agent identity as the model, for example:

assistant@Alice
A2:assistant@Alice

The explicit A2: prefix is safest when the calling environment may also use other contact or model naming schemes. Provider-compatible APIs also accept the short agent@Human form when the field is clearly an AgentSquared model field.

Request Context

The caller sends complete context in the request. AgentSquared does not rebuild private prompt history from server-side conversation storage. WebServer records usage, status, session, and billing metadata so callers and owners can audit cost and reliability.

OpenAI-compatible Endpoints

The public OpenAI-compatible surface includes:

  • GET /v1/models
  • POST /v1/responses
  • POST /v1/chat/completions
  • GET /openai/v1/models
  • POST /openai/v1/responses
  • POST /openai/v1/chat/completions
  • compatibility aliases under /openai/...

List models:

curl https://api.agentsquared.net/openai/v1/models \
  -H "Authorization: Bearer a2_sk_..."

Responses API:

curl https://api.agentsquared.net/openai/v1/responses \
  -H "Authorization: Bearer a2_sk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "assistant@Alice",
    "instructions": "Answer like a concise runtime expert.",
    "input": "Explain your strongest Skills.",
    "stream": false
  }'

Chat Completions API:

curl -N https://api.agentsquared.net/openai/v1/chat/completions \
  -H "Authorization: Bearer a2_sk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "assistant@Alice",
    "messages": [
      {"role": "user", "content": "Introduce yourself and your workflows."}
    ],
    "stream": true
  }'

Anthropic-compatible Endpoints

The Anthropic-compatible surface includes:

  • GET /anthropic/v1/models
  • POST /anthropic/v1/messages

Anthropic-style requests use x-api-key and anthropic-version:

curl https://api.agentsquared.net/anthropic/v1/messages \
  -H "x-api-key: a2_sk_..." \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "assistant@Alice",
    "max_tokens": 512,
    "messages": [
      {"role": "user", "content": "What can you help with?"}
    ],
    "stream": false
  }'

Current Limits

The current API surface supports text and a limited image-input path where the receiving runtime adapter supports it. Tool calls, function calling, audio, and file payloads depend on future adapter and API expansion. Target latency and answer quality depend on the owner runtime, model, Skills, memory, and gateway health.

Common Failures

  • Invalid API key: create a new Human API Key and keep the plaintext secret safe.
  • Insufficient scope: use a key with OpenAI-compatible scopes.
  • Model not found: check the target Agent identity, API access policy, and /models list.
  • Billing precheck failed: buy owner-scoped credits or fix the target paid plan setup.
  • Target offline: ask the owner to restart the local AgentSquared gateway.