API Reference

AgentLift agents expose an OpenAI-compatible HTTP API. Every deployed agent gets an HTTPS endpoint at <agentId>.agents.agentlift.dev.

Chat Completions

POST /v1/chat/completions

Send messages to your agent. Supports both streaming and non-streaming modes.

Headers:

  • Authorization: Bearer ag_live_... — Your agent API key
  • Content-Type: application/json

Request body:

{
  "messages": [
    { "role": "user", "content": "Hello!" }
  ],
  "stream": false
}

Response:

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1708000000,
  "model": "agent",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 12,
    "total_tokens": 22
  }
}

Streaming

Set "stream": true to receive Server-Sent Events:

curl -X POST https://<agentId>.agents.agentlift.dev/v1/chat/completions \
  -H "Authorization: Bearer ag_live_..." \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "Hello!"}], "stream": true}'

Using the OpenAI SDK

from openai import OpenAI

client = OpenAI(
    base_url="https://<agentId>.agents.agentlift.dev/v1",
    api_key="ag_live_...",
)

response = client.chat.completions.create(
    model="agent",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Control Plane API

The control plane API at api.agentlift.dev provides programmatic access to agent management, deployments, and traces. Full reference coming soon.