OpenAI-Compatible Endpoint¶
EpsimoAI provides an OpenAI-compatible API at /public/openai/v1/chat/completions. This allows you to use any tool or SDK that supports the OpenAI API format — including the official OpenAI Python SDK, Typebot, Zapier, and other no-code platforms — to interact with your EpsimoAI assistants.
How It Works¶
The endpoint mimics OpenAI's /v1/chat/completions interface. The per-assistant public token acts as the API key and identifies which assistant handles the request. No separate assistant_id or model selection is needed — the backend resolves the assistant from the token.
Step 1: Configure Your Assistant for Public Access¶
Before using the OpenAI-compatible endpoint, configure your assistant with a public token.
Via the Frontend¶
- Go to https://chat.epsimoagents.com
- Navigate to your assistant's settings
- Set Access Mode to
public_token - Set Public Token to a secret string (e.g.,
pubkey_mybot_abc123) - Save
Via the API¶
curl -X PATCH https://backend.epsimoagents.com/assistants/<assistant-id> \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{
"config": {
"configurable": {
"type==agent/access_mode": "public_token",
"type==agent/public_token": "pubkey_mybot_abc123"
}
}
}'
See Public Assistants for full details on access modes.
Step 2: Call the Endpoint¶
Endpoint¶
POST https://backend.epsimoagents.com/public/openai/v1/chat/completions
Headers¶
| Header | Value |
|---|---|
Authorization |
Bearer <your-public-token> |
Content-Type |
application/json |
Request Body¶
Standard OpenAI chat completions format:
{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Hello, what can you help me with?"}
],
"stream": false
}
Note: The
modelfield is accepted for compatibility but ignored — the assistant uses whatever model is configured in its settings.
Calling with curl¶
Non-streaming¶
curl https://backend.epsimoagents.com/public/openai/v1/chat/completions \
-H "Authorization: Bearer pubkey_mybot_abc123" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "What is EpsimoAI?"}],
"stream": false
}'
Response:
{
"id": "chatcmpl-...",
"object": "chat.completion",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "EpsimoAI is..."
},
"finish_reason": "stop"
}
]
}
Streaming¶
curl -N https://backend.epsimoagents.com/public/openai/v1/chat/completions \
-H "Authorization: Bearer pubkey_mybot_abc123" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Tell me a story"}],
"stream": true
}'
Streaming response (SSE format):
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"Once"},"finish_reason":null}]}
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" upon"},"finish_reason":null}]}
data: [DONE]
Configuring in Typebot¶
Typebot natively supports OpenAI-compatible APIs. To connect your EpsimoAI assistant:
- In your Typebot flow, add an OpenAI block (or "AI" block)
- Configure the connection:
- Base URL:
https://backend.epsimoagents.com/public/openai/v1 - API Key:
pubkey_mybot_abc123(your assistant's public token) - Set the model to any value (e.g.,
gpt-4o) — it will be ignored by EpsimoAI - Configure your messages as usual in Typebot
Typebot will automatically append /chat/completions to the Base URL and send requests in the standard OpenAI format.
Using the OpenAI Python SDK¶
Point the official OpenAI Python SDK at EpsimoAI by overriding the base_url:
from openai import OpenAI
client = OpenAI(
api_key="pubkey_mybot_abc123",
base_url="https://backend.epsimoagents.com/public/openai/v1",
)
# Non-streaming
response = client.chat.completions.create(
model="gpt-4o", # ignored by EpsimoAI, but required by the SDK
messages=[
{"role": "user", "content": "Hello! What can you do?"}
],
)
print(response.choices[0].message.content)
Streaming with the Python SDK¶
from openai import OpenAI
client = OpenAI(
api_key="pubkey_mybot_abc123",
base_url="https://backend.epsimoagents.com/public/openai/v1",
)
stream = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Explain quantum computing simply"}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
print()
Multi-turn Conversations¶
Pass the full conversation history each time:
messages = [{"role": "user", "content": "My name is Alice"}]
response = client.chat.completions.create(model="gpt-4o", messages=messages)
assistant_reply = response.choices[0].message.content
messages.append({"role": "assistant", "content": assistant_reply})
messages.append({"role": "user", "content": "What's my name?"})
response = client.chat.completions.create(model="gpt-4o", messages=messages)
print(response.choices[0].message.content) # "Your name is Alice"
Using the OpenAI Node.js SDK¶
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "pubkey_mybot_abc123",
baseURL: "https://backend.epsimoagents.com/public/openai/v1",
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello from Node.js!" }],
});
console.log(response.choices[0].message.content);
Differences from the Real OpenAI API¶
| Feature | OpenAI | EpsimoAI |
|---|---|---|
model parameter |
Selects the model | Ignored (assistant config determines model) |
temperature, top_p |
Supported | Passed through if underlying model supports them |
functions / tools |
Supported | Not supported via this endpoint |
n (multiple completions) |
Supported | Not supported |
| Token usage in response | Always present | May not be present |
| Rate limits | Per-API-key | No built-in rate limiting |
Troubleshooting¶
| Error | Cause | Fix |
|---|---|---|
401 Missing authentication token |
No Authorization header |
Add Authorization: Bearer <token> |
401 Invalid token |
Token doesn't match any assistant | Check the token value matches config |
403 Not configured for public access |
access_mode is authenticated |
Set access_mode to public_token |
404 Assistant not found |
No assistant has this token | Verify token is set in assistant config |
Related Documentation¶
- Authentication Guide — Full auth reference
- Public Assistants — All access modes explained
- CLI Recipes — Bash automation examples
- API Reference — Full endpoint documentation