OpenAI & MCP
OpenAI-compatible API
Use your agent anywhere that accepts an OpenAI base URL — n8n, Typebot, AnyChat, the OpenAI SDKs.
Any tool that lets you set a custom OpenAI base URL can talk to your agent. It answers with its knowledge, Q&A, instructions, guardrails and actions.
| Setting | Value |
|---|---|
| Base URL | https://anytimereply.com/api/openai/v1 |
| API key | Your af_live_… key (create one) |
| Model | Your agent's ID (or its public key) |
List models
/api/openai/v1/modelsYour agents, in OpenAI's format:
{
"object": "list",
"data": [
{ "id": "3f2c9a8e-…", "object": "model", "created": 1746173662, "owned_by": "anytimereply", "name": "Support" }
]
}Chat completions
/api/openai/v1/chat/completionscurl https://anytimereply.com/api/openai/v1/chat/completions \
-H "Authorization: Bearer af_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "AGENT_ID", "user": "customer-42", "messages": [{"role": "user", "content": "Opening hours?"}]}'{
"id": "chatcmpl-5f1c…",
"object": "chat.completion",
"created": 1760865600,
"model": "AGENT_ID",
"choices": [
{ "index": 0, "message": { "role": "assistant", "content": "We're open every day from 10 am to 8 pm." }, "finish_reason": "stop" }
],
"usage": { "prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0 }
}How the request is used
Body
modelstringrequiredmessagesarrayrequiredsystem / developer messages are added to the agent's instructions as extra context (up to 3,000 characters). Text content parts are supported; images aren't.userstringstreambooleanchat.completion.chunk events, ending with data: [DONE].toolsarrayfunctions work too). See below. tool_choice: "none" disables them.Other OpenAI parameters (temperature, max_tokens…) are accepted but ignored — the agent's own settings apply. usage is always zero; credits are counted in your dashboard.
Your tools (handoff to your platform)
Tools you pass are offered to the agent. When it decides to use one — for example a transfer to human tool — the response has finish_reason: "tool_calls" and message.tool_calls for your app to run. Send the result back as usual (assistant message with the tool_calls, then a tool message) and the agent tells the customer what happened.
Through this API the agent never runs its own human handoff: the calling platform owns handoff. If you pass a tool whose name or description mentions a human/agent transfer, the agent is told to call it when a customer asks for a person or is upset.
Errors
Errors use OpenAI's format so SDKs handle them:
{ "error": { "message": "The model \"abc\" does not exist. Use one of your agent IDs as the model (GET /models lists them).", "type": "not_found_error", "code": null } }type is authentication_error (401), rate_limit_error (429), not_found_error (404), invalid_request_error (400) or server_error (500).
Settings → API keys → Connect to AnyChat & other AI tools shows the base URL and your agent IDs ready to copy.