Skip to content

Compatible APIs

bo.yu edited this page Jul 22, 2026 · 1 revision

Compatible APIs

Agent API keys

Each Agent may have multiple API keys for rotation or separate integrations. A full c4o_... secret is shown once when created; only its hash and short prefix are retained.

Revocation, expiry, disablement, deletion, or Agent unavailability invalidates future requests and Tool Sessions owned by that key.

All compatible endpoints require:

Authorization: Bearer <Agent API Key>

Supported endpoints are:

  • GET /v1/models
  • POST /v1/chat/completions
  • POST /v1/messages

agent-default and matching agent-<id> values select the Agent bound to the key. skill-<id> and the optional chat4openapi_skill_ids field may narrow that Agent's Skill catalog but cannot access another Agent. Cross-Agent selection returns 403 auth.agent_key_forbidden without revealing whether the requested Agent exists.

OpenAI-compatible request

curl -X POST http://127.0.0.1:8000/v1/chat/completions -H "Authorization: Bearer <AGENT_API_KEY>" -H "Content-Type: application/json" --data "{\"model\":\"agent-default\",\"messages\":[{\"role\":\"user\",\"content\":\"List my orders\"}]}"

Anthropic-compatible request

curl -X POST http://127.0.0.1:8000/v1/messages -H "Authorization: Bearer <AGENT_API_KEY>" -H "Content-Type: application/json" --data "{\"model\":\"agent-default\",\"max_tokens\":512,\"messages\":[{\"role\":\"user\",\"content\":\"List my orders\"}]}"

When a selected Tool needs upstream business credentials, create a Tool Session first and add:

X-Chat4Openapi-Tool-Session: <Tool Session token>

Tool calls never start an OAuth redirect or wait for Device authorization. Missing credentials return tool_authorization_required; expired or rejected credentials return tool_reauthorization_required.

Clone this wiki locally