Skip to content

Open API (OpenAI-compatible)

Every Space — data mode and general mode alike — can be called programmatically through an OpenAI-compatible API. Mint an API key inside the Space, point any OpenAI SDK at Datyo, and your scripts, backends, or agents can chat with the Space's assistant (including SQL analysis over the Space's datasets).

Create an API key

  1. Open the Space → click the menu (top right) → API access.
  2. Name the key and click Generate key.
  3. Copy the key immediately — it is shown exactly once. Only a prefix is kept for display afterwards.

Keys can be revoked at any time from the same dialog; revoked keys fail immediately. Usage is billed to the key owner's account like normal chat.

Call the API

Base URL: https://console.datyo.ai/v1 · Endpoint: POST /chat/completions

bash
curl https://console.datyo.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-df-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "standard",
    "stream": false,
    "messages": [{"role": "user", "content": "Top 5 products by revenue last week?"}]
  }'
python
from openai import OpenAI

client = OpenAI(base_url="https://console.datyo.ai/v1", api_key="sk-df-...")
stream = client.chat.completions.create(
    model="standard",
    messages=[{"role": "user", "content": "Hello"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Parameters

FieldValuesNotes
modelflagship / standard / liteOptional; defaults to the Space's model tier
messagesOpenAI formatCalls are stateless — send the full history each request
streamtrue / falseSSE chunks (chat.completion.chunk + data: [DONE]) or a single JSON
web_searchtrue / falseDatyo extension: ground the answer in live web search

The response follows the OpenAI schema (choices[0].message.content, usage token counts). Data-mode Spaces run SQL over their attached datasets before answering; general-mode Spaces answer with their instructions and skills.

Notes

  • Keep keys secret — anyone holding a key can spend your quota. Rotate by revoking and generating a new one.
  • API calls do not appear in the Space's chat history; they are visible in usage/Monitor statistics.

Datyo · The Agent-native intelligent data analytics platform