Daedalus API
Public HTTP API for Daedalus by AstroVectAI. Free and paid accounts can call Daedalus from their own projects with a personal API key.
This page covers /api/v1, how to create keys, limits, errors, and examples. Values in examples are placeholders unless noted.
Overview
The API uses the same chat and upload pipeline as the signed-in Daedalus app. Each request counts against your account’s plan, message or token limits, and allowed models. A personal key is not a separate quota; it acts as you.
Two programmatic endpoints exist under /api/v1:
| Method | Path | Purpose |
|---|---|---|
POST | /api/v1/chat | Send a message (optionally with an image or video) and receive a reply |
POST | /api/v1/transcribe | Transcribe a short audio recording to text |
Create and revoke keys in Daedalus Settings, or with session-authenticated /me/api-keys routes (not with the dk_ key itself). See Creating and managing keys.
Authentication
Clients authenticate with a personal API key. Keys are issued by AstroVectAI, start with the prefix dk_, and are shown in full once at creation. After that, Daedalus stores only a hash, plus a short prefix and last four characters for display.
How to get a key
- Sign in at https://astrovect.online.
- Verify the email on the account. Unverified accounts cannot create keys or call
/api/v1/chat. - Open Settings and create a personal API key. You may give it a name (up to 80 characters).
- Copy the full key immediately and store it securely (for example an environment variable). It will not be shown again.
An account may have at most 5 active keys. Creating another returns an error until you revoke one.
Creating a key does not require a paid plan. Free accounts can create and use keys, subject to the free plan’s model and message limits. Image and video uploads and transcription require Plus or higher; see Plans, models, and limits.
How to send the key
Send the raw key in the Authorization header as a Bearer token:
Authorization: Bearer dk_your_key
The key must start with dk_ and be at least 12 characters.
- A missing, malformed, unknown, or revoked key returns 401 with
{"detail": "Invalid API key"}. Keys in the query string are ignored. - A website session token is not accepted on
POST /api/v1/chat. Only adk_personal key works there. - On
POST /api/v1/transcribe, either adk_personal key or a signed-in session token is accepted. - If the account is banned, the API returns 403 with
{"detail": "This account is closed."}. - If the email is not verified,
POST /api/v1/chatandPOST /api/v1/transcribereturn 403 with{"detail": "Please verify your email first"}.
Do not put the key in the query string. Do not commit it to source control. If a key is leaked, revoke it in Settings and create a new one.
Base URL
https://astrovect.online
Example: https://astrovect.online/api/v1/chat
Use https://astrovect.online in clients. https://www.astrovect.online/ redirects to that host.
CORS
Cross-origin browser calls are not supported. Call the API from a server-side or local client, or proxy through your own origin.
OPTIONS /api/v1/chatreturns 405{"detail":"Method Not Allowed"}withAllow: POST. NoAccess-Control-Allow-Originheader is set.POST /api/v1/chatfrom another origin still requires a validdk_key and does not return CORS allow-origin headers.
Browser fetch from a different site will not receive a usable CORS grant. See Implementation guides.
Plans, models, and limits
Message and token quotas
POST /api/v1/chat charges the same usage pool as the website.
| Plan | Quota | Reset |
|---|---|---|
| Free | 25 messages per day | Midnight America/New_York |
| Plus | 400 units per week | Monday 00:00 America/New_York |
| Premium, Dev | No message cap | — |
| Pilot, Commander | No message cap; daily token budgets instead | Midnight America/New_York |
Ordinary messages cost 1 unit. On Plus only, a reply that contains a generated HTML preview costs 2 units. When the pool is exhausted, the API returns 429 with limit_reached: true (see errors on /api/v1/chat).
Pilot and Commander use daily input/output token budgets rather than a message count. When that budget is exhausted, the API may return 429 with limit_reached: true.
Per-minute burst limits
These apply to every plan, including Premium.
| Endpoint | Window | Cap | Keyed by |
|---|---|---|---|
POST /api/v1/chat | Sliding 60 seconds | 20 | The API key |
POST /api/v1/chat (account path) | Sliding 60 seconds | 20 | The user account |
POST /api/v1/transcribe | Sliding 60 seconds | 20 | The user account |
When the burst cap is hit, the API returns 429:
{"error": "You're sending messages very quickly. Please wait a few seconds and try again.", "rate_limited": true}
Models
You may pass an optional model slug on POST /api/v1/chat. If you omit it, or send an unrecognized name, the server uses the plan’s default (the highest model included with that plan). If you request a model your plan does not include, the request fails with 403.
Public slugs and the plans that can use them:
| Slug | Included with |
|---|---|
daedalus-1.0 | Free and above |
daedalus-speech | Plus and above |
daedalus-1.1 | Plus and above |
daedalus-1.2 | Premium, Dev, Pilot, Commander |
daedalus-sol | Pilot, Commander |
daedalus-astra | Commander |
Accepted aliases (case-insensitive, spaces become hyphens) include 1.0, 1.1, 1.2, speech, voice, daedalus-voice, sol, pilot, astra, and commander. Unknown values are ignored and the plan default is used.
The model field in a successful chat response is a public display label (for example Daedalus 1.0, Daedalus 1.1, Daedalus 1.2, Daedalus Vision, Daedalus Speech, Pilot, or Commander), not necessarily the slug you sent.
Feature gates
| Feature | Requirement |
|---|---|
| Text chat | Any plan (email verified). Uses that plan’s models and quota. |
Image or video on /api/v1/chat | Plus, Premium, Dev, Pilot, or Commander. Otherwise 403. |
/api/v1/transcribe | Plus or above (the plan must include daedalus-speech). Otherwise 403. |
The 403 body for uploads is:
{"error": "File and image uploads require Plus ($4 for 30 days), Premium, or Dev."}
Pilot and Commander can also upload, even though that message names Plus, Premium, or Dev.
The 403 body for transcription is {"detail": "Talk is included with Plus and above."}.
Endpoints
POST /api/v1/chat
Send a message as the key’s account and receive a JSON reply. This is the primary programmatic endpoint. A typical request is a Bearer dk_ key and {"message":"Hello Daedalus"}.
Auth: personal API key (Authorization: Bearer dk_...). Email must be verified.
Request headers:
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer plus the personal API key |
Content-Type | Yes | application/json |
JSON body:
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes, unless image or video is sent | The user prompt. Leading/trailing whitespace is stripped. |
conversation_id | integer or omitted | No | Existing conversation owned by this account. If omitted, a new conversation is created. |
model | string or omitted | No | Public model slug or alias (see above). Defaults to the plan’s highest model. |
image | string or omitted | No | A data:image/...;base64,... URL. Plus or higher required. If the value starts with data:video/ and video is empty, it is treated as video. |
video | string or omitted | No | A data:video/...;base64,... URL. Plus or higher required. |
game | object or omitted | No | Optional JSON object for a short context snapshot. Most integrations should omit this. See note below. |
At least one of message, image, or video must be non-empty after stripping. Otherwise the API returns 400 {"error": "Empty message"}.
There is no dedicated “message too long” error. Long prompts may be clipped when context is built: the latest turn can be clipped to 120,000 characters; older turns are shortened further. Speech-model history keeps the last 12 messages, each clipped to 1,500 characters.
Image format: a full data URL matching data:<mime>;base64,<payload>, where <mime> is an image type. Decoded size must be at most 20,971,520 bytes (20 MiB). Supported types include PNG, JPEG, WebP, GIF, BMP, TIFF, AVIF, ICO, and HEIC. Invalid data returns 400 with one of: image must be a data:image/...;base64 URL, invalid image data, image too large, or unsupported image type.
Video format: a full data URL matching data:<mime>;base64,<payload>. Decoded size must be at most 20,971,520 bytes. Accepted types include MP4, WebM, MOV, M4V, AVI, MPEG, and MPG. Invalid data returns 400 with one of: video must be a data:video/...;base64 URL, invalid video data, video too large, or unsupported video type.
game field: an optional JSON object. Lobby-style keys include in_room, map, zone, mode, player_count, and players. Extra properties are allowed. Most integrations should omit game.
Success response (HTTP 200): JSON with at least:
| Field | Type | Description |
|---|---|---|
reply | string | The assistant’s answer. Leftover UI status labels such as “Thinking…” are stripped. If no visible text was produced, this is I couldn't complete that reply. Please try again. |
conversation_id | integer | Conversation to pass back on the next turn |
model | string | Public display label (may be empty) |
actions | array | Up to 4 objects, each either {"action": "<string>", "id": "<string>"} or {"type": "<string>", "value": "<string>"}. Empty for ordinary chat. Most clients can ignore this. |
audio | string, only if present | A data:audio/...;base64,... URL. Included for Daedalus Speech (daedalus-speech, or aliases such as speech or voice) when text-to-speech succeeds. Ordinary text models do not include audio. |
Website-only fields such as usage, trace, or busy are not copied into a successful API response.
Illustrative success body:
{
"reply": "<assistant reply text>",
"conversation_id": 12345,
"model": "Daedalus 1.2",
"actions": []
}
Errors:
| Status | Body shape | When |
|---|---|---|
| 401 | {"detail": "Invalid API key"} | Missing, non-dk_, unknown, or revoked key; or a session token was sent |
| 403 | {"detail": "Please verify your email first"} | Email not verified |
| 403 | {"detail": "This account is closed."} | Account banned |
| 403 | {"error": "...", "locked_model": "...", "allowed_models": [...], "upgrade": "..."} | Requested model is not on the account’s plan. error is an upgrade hint such as Daedalus 1.2 is a Premium model. Upgrade to Premium to use it. |
| 403 | {"error": "File and image uploads require Plus ($4 for 30 days), Premium, or Dev."} | image or video sent on a plan that cannot upload |
| 400 | {"error": "Empty message"} | No message, image, or video |
| 400 | {"error": "<decode error>"} | Invalid image or video data URL (messages listed above) |
| 404 | {"detail": "Chat not found"} | conversation_id is not a conversation owned by this account |
| 422 | {"error": "That request wasn't quite right. Please check it and try again."} | JSON failed request validation (wrong types, malformed body) |
| 429 | {"error": "You're sending messages very quickly. Please wait a few seconds and try again.", "rate_limited": true} | Burst limit |
| 429 | {"error": "<quota message>", "limit_reached": true, "upgrade": true, "usage": { ... }} | Message or unit pool exhausted. See usage object below. |
| 429 | {"error": "<token budget message>", "usage": { ... }, "limit_reached": true} | Pilot or Commander daily token budget exhausted. See usage object below. |
| 500 | {"error": "Could not start a chat."} | A new conversation could not be created |
| 500 | {"error": "Daedalus encountered a temporary issue processing that request. Please try again."} | Failure inside the chat pipeline |
| 500 | {"error": "Something went wrong. Please try again."} | Unhandled server error |
| other 4xx/5xx | JSON forwarded if present, otherwise {"error": "Request failed"} | Other errors from chat or upload |
Quota usage object (when limit_reached is true):
- Free or Plus:
plan,unlimited(false),period(dayorweek),limit,used,remaining,resets_at(ISO-8601 UTC),resets_label(America/New_York, suffixET),heavy_cost(2 on Plus, 1 on Free). - Premium or Dev:
{"plan": "<plan>", "unlimited": true}. - Pilot or Commander:
plan,unlimited(false),period(day),unit(input tokens),limit(daily input cap),used,remaining,completion_limit,completion_used,completion_remaining,resets_at,resets_label,label(a human summary of tokens left),heavy_cost(1). - Owner accounts:
{"plan": "<plan>", "unlimited": true, "owner": true}.
Example quota messages:
- Free:
You've used today's 25 free messages. They reset <resets_label>. Plus gives you 400 messages a week, and Premium is unlimited. - Plus:
You've used this week's Plus pool of 400 messages. It refills <resets_label>. Premium has no message limit. - Pilot or Commander:
You've used today's {Pilot|Commander} token budget ({input} input and {output} output). It resets {resets_label}.Pilot caps are 200,000 input and 40,000 output; Commander caps are 120,000 input and 24,000 output.resets_labellooks likeMon Nov 16, 12:00 AM ET.
If backends are busy, the reply may be HTTP 200 with text Daedalus is busy right now, please try again in a minute. There is no separate busy flag.
POST /api/v1/transcribe
Transcribe a short recording to text. Used by the Daedalus Talk UI; also callable with a personal API key.
Auth: personal API key (Authorization: Bearer dk_...) or a signed-in session JWT. Email must be verified. The account plan must include daedalus-speech (Plus and above).
Request: one of two body formats.
1. Multipart form (Content-Type: multipart/form-data)
| Field | Required | Description |
|---|---|---|
file or audio | Yes (one of them) | The audio file |
format | No | wav, webm, mp3, ogg, or m4a. If omitted, the file extension of the upload is used. |
The official website client sends a WAV file in the file field.
2. JSON (Content-Type: application/json)
Either wrap the audio in input_audio, or send the same fields at the top level:
{
"input_audio": {
"format": "wav",
"data": "<base64-encoded audio>"
}
}
| Field | Required | Description |
|---|---|---|
format | Yes (must be one of the allowed types) | wav, webm, mp3, ogg, or m4a |
data or audio | Yes | Standard base64 of the audio bytes |
Limits:
- Allowed formats:
wav,webm,mp3,ogg,m4a - Decoded audio must be at most 25,165,824 bytes (25 MiB)
- Duration must be at most 60 seconds
- The raw request body is rejected if it exceeds
(25 MiB * 4 / 3) + 1 MiB(the base64-sized bound), with 413{"detail": "That recording is too large."}
If the audio is valid but no speech is detected, the API returns HTTP 200 with {"text": ""} and does not call the transcription backend.
Success response (HTTP 200):
{"text": "<transcript>"}
text is a string (possibly empty). The illustrative value above is a placeholder.
Errors:
| Status | Body | When |
|---|---|---|
| 401 | {"detail": "Invalid API key"} | dk_ key missing/invalid (when a dk_ prefix was sent) |
| 401 | {"detail": "Not logged in"} | No Bearer credentials, and no dk_ key |
| 401 | {"detail": "Invalid token"} | Bearer value is not a valid dk_ key and not a valid session JWT |
| 403 | {"detail": "Please verify your email first"} | Email not verified |
| 403 | {"detail": "This account is closed."} | Account banned |
| 403 | {"detail": "Talk is included with Plus and above."} | Plan does not include daedalus-speech |
| 400 | {"detail": "Send a recording as an audio file or base64 audio."} | Body could not be parsed as multipart audio or JSON base64 audio |
| 400 | {"detail": "Use WAV, WebM, MP3, OGG, or M4A audio."} | Format not in the allowed set |
| 400 | {"detail": "That audio could not be read. Try recording again."} | File/container could not be probed |
| 413 | {"detail": "That recording is too large."} | Raw request body over the intake cap |
| 413 | {"detail": "Audio must be under 25 MB."} | Decoded audio over 25 MiB |
| 413 | {"detail": "Keep each recording under 60 seconds."} | Duration over 60 seconds |
| 429 | {"error": "You're sending messages very quickly. Please wait a few seconds and try again.", "rate_limited": true} | Burst limit |
| 503 | {"error": "Voice recognition is temporarily unavailable."} | Transcription backend is not configured on the server |
| 503 | {"detail": "Audio checking is temporarily unavailable. Try WAV audio."} | Duration probe tooling is missing (non-WAV). WAV still works for probing. |
| 502 | {"error": "I couldn't hear that clearly. Please try again."} | Transcription backend failed |
Creating and managing keys
The supported way to create a key is the Settings panel on astrovect.online.
The same operations are also exposed as HTTP routes on the account session (the Bearer token returned at login, not a dk_ key). These routes require a verified email.
GET /me/api-keys
List active (non-revoked) keys.
Auth: session JWT (Authorization: Bearer <session token>).
Success (200):
{
"keys": [
{
"id": 1,
"name": "API key",
"prefix": "dk_xxxxxxx",
"last4": "abcd",
"created_at": "<ISO-8601 timestamp or null>",
"last_used_at": "<ISO-8601 timestamp or null>"
}
],
"cap": 5
}
The full key is never returned on list. prefix is the first 10 characters of the key; last4 is the last 4. cap is the account’s key cap (default 5). id, name, and timestamps in the example are illustrative.
Without a session token: 401 {"detail": "Not logged in"}.
POST /me/api-keys
Create a key. Content-Type: application/x-www-form-urlencoded (or multipart form).
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Label, trimmed and capped at 80 characters. Default if blank: API key. |
Success (200): the public key fields plus key, the full plaintext, shown only this once:
{
"id": 1,
"name": "API key",
"prefix": "dk_xxxxxxx",
"last4": "abcd",
"created_at": "<ISO-8601 timestamp or null>",
"last_used_at": null,
"key": "dk_your_key"
}
400 if the cap is reached, or if a key could not be minted:
{"error": "You can have at most 5 API keys. Revoke one to create another.", "cap": 5}
The number in that message matches the account’s key cap (default 5).
DELETE /me/api-keys/{key_id}
Revoke an active key owned by the signed-in user. key_id is the integer id from the list/create response.
Success (200): {"ok": true}
404: {"detail": "Not found"} if the key does not exist, is not yours, or is already revoked.
A revoked key immediately receives 401 {"detail": "Invalid API key"} on /api/v1/chat.
Error format notes
Two JSON shapes appear:
- Auth and many account errors use
{"detail": "<message>"}(authentication, verification, banned accounts, “chat not found”, many transcription errors). - Many application errors use
{"error": "<message>"}, sometimes with extra fields such asrate_limited,limit_reached,upgrade, orusage.
A request-validation failure on any JSON route is 422 with {"error": "That request wasn't quite right. Please check it and try again."}.
Implementation guides
Call the API from a server-side or local client. Browser JavaScript on another origin is blocked (see CORS).
export DAEDALUS_API_KEY="dk_your_key"
curl https://astrovect.online/api/v1/chat \
-H "Authorization: Bearer $DAEDALUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message":"Hello Daedalus"}'
Continue a conversation (use the conversation_id returned by the first call):
curl https://astrovect.online/api/v1/chat \
-H "Authorization: Bearer $DAEDALUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message":"Follow up question","conversation_id":12345,"model":"daedalus-1.2"}'
Transcribe a WAV file (Plus or higher):
curl https://astrovect.online/api/v1/transcribe \
-H "Authorization: Bearer $DAEDALUS_API_KEY" \
-F "file=@recording.wav;type=audio/wav"
import os
import requests
API = "https://astrovect.online"
KEY = os.environ["DAEDALUS_API_KEY"] # e.g. dk_...
HEADERS = {
"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json",
}
response = requests.post(
f"{API}/api/v1/chat",
headers=HEADERS,
json={"message": "Hello Daedalus"},
timeout=120,
)
response.raise_for_status()
data = response.json()
print(data["reply"])
conversation_id = data["conversation_id"]
# Next turn in the same conversation
follow = requests.post(
f"{API}/api/v1/chat",
headers=HEADERS,
json={
"message": "Follow up question",
"conversation_id": conversation_id,
"model": "daedalus-1.2", # optional; must be allowed for your plan
},
timeout=120,
)
follow.raise_for_status()
print(follow.json()["reply"])
Send an image (Plus or higher). The image value must be a data:image/...;base64, URL:
import base64
with open("photo.png", "rb") as fh:
encoded = base64.b64encode(fh.read()).decode("ascii")
response = requests.post(
f"{API}/api/v1/chat",
headers=HEADERS,
json={
"message": "What is in this image?",
"image": f"data:image/png;base64,{encoded}",
"conversation_id": conversation_id,
},
timeout=120,
)
Transcribe (Plus or higher):
with open("recording.wav", "rb") as fh:
tr = requests.post(
f"{API}/api/v1/transcribe",
headers={"Authorization": f"Bearer {KEY}"},
files={"file": ("recording.wav", fh, "audio/wav")},
timeout=60,
)
print(tr.json().get("text"))
Handle common errors:
if response.status_code == 401:
# {"detail": "Invalid API key"}
...
elif response.status_code == 429:
body = response.json()
if body.get("rate_limited"):
... # slow down
elif body.get("limit_reached"):
... # plan quota; see body["error"] and body.get("usage")
Cross-origin browser fetch is not supported (see CORS above). Server-side fetch (Node.js, Deno, and similar) is unaffected.
const API = "https://astrovect.online";
const KEY = process.env.DAEDALUS_API_KEY; // dk_...
const response = await fetch(`${API}/api/v1/chat`, {
method: "POST",
headers: {
Authorization: `Bearer ${KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ message: "Hello Daedalus" }),
});
if (!response.ok) {
const err = await response.json().catch(() => ({}));
throw new Error(err.detail || err.error || `HTTP ${response.status}`);
}
const data = await response.json();
console.log(data.reply);
const conversationId = data.conversation_id;
const follow = await fetch(`${API}/api/v1/chat`, {
method: "POST",
headers: {
Authorization: `Bearer ${KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
message: "Follow up question",
conversation_id: conversationId,
}),
});
Transcribe with FormData (Plus or higher):
const form = new FormData();
form.append("file", wavBlob, "speech.wav"); // or a file from disk in Node.js
const tr = await fetch(`${API}/api/v1/transcribe`, {
method: "POST",
headers: { Authorization: `Bearer ${KEY}` },
body: form,
});
const transcript = await tr.json();
console.log(transcript.text);
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
"time"
)
func main() {
key := os.Getenv("DAEDALUS_API_KEY") // dk_...
body, _ := json.Marshal(map[string]string{"message": "Hello Daedalus"})
req, _ := http.NewRequest(http.MethodPost, "https://astrovect.online/api/v1/chat", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+key)
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 120 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var out struct {
Reply string `json:"reply"`
ConversationID int `json:"conversation_id"`
Model string `json:"model"`
Error string `json:"error"`
Detail string `json:"detail"`
}
if err := json.NewDecoder(resp.Body).Decode(&out); err != nil {
panic(err)
}
if resp.StatusCode >= 400 {
panic(fmt.Sprintf("%d %s%s", resp.StatusCode, out.Detail, out.Error))
}
fmt.Println(out.Reply)
}
To continue a conversation, POST the same path with message and conversation_id (integer).
<?php
$key = getenv('DAEDALUS_API_KEY'); // dk_...
$ch = curl_init('https://astrovect.online/api/v1/chat');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $key,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['message' => 'Hello Daedalus']),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
]);
$raw = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$data = json_decode($raw, true);
if ($status >= 400) {
throw new RuntimeException($data['detail'] ?? $data['error'] ?? "HTTP $status");
}
echo $data['reply'], PHP_EOL;
$conversationId = $data['conversation_id'];
require "json"
require "net/http"
require "uri"
key = ENV.fetch("DAEDALUS_API_KEY") # dk_...
uri = URI("https://astrovect.online/api/v1/chat")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.read_timeout = 120
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{key}"
req["Content-Type"] = "application/json"
req.body = JSON.generate({ "message" => "Hello Daedalus" })
res = http.request(req)
data = JSON.parse(res.body)
raise (data["detail"] || data["error"] || "HTTP #{res.code}") unless res.is_a?(Net::HTTPSuccess)
puts data["reply"]
conversation_id = data["conversation_id"]
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json.Serialization;
var key = Environment.GetEnvironmentVariable("DAEDALUS_API_KEY"); // dk_...
using var client = new HttpClient { Timeout = TimeSpan.FromSeconds(120) };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", key);
var response = await client.PostAsJsonAsync(
"https://astrovect.online/api/v1/chat",
new { message = "Hello Daedalus" });
var data = await response.Content.ReadFromJsonAsync<ChatResponse>();
if (!response.IsSuccessStatusCode)
throw new Exception(data?.Detail ?? data?.Error ?? $"HTTP {(int)response.StatusCode}");
Console.WriteLine(data!.Reply);
var conversationId = data.ConversationId;
record ChatResponse(
[property: JsonPropertyName("reply")] string? Reply,
[property: JsonPropertyName("conversation_id")] int ConversationId,
[property: JsonPropertyName("model")] string? Model,
[property: JsonPropertyName("error")] string? Error,
[property: JsonPropertyName("detail")] string? Detail);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
String key = System.getenv("DAEDALUS_API_KEY"); // dk_...
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(30))
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://astrovect.online/api/v1/chat"))
.timeout(Duration.ofSeconds(120))
.header("Authorization", "Bearer " + key)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{\"message\":\"Hello Daedalus\"}"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 400) {
throw new RuntimeException("HTTP " + response.statusCode() + " " + response.body());
}
System.out.println(response.body()); // JSON with reply, conversation_id, model, actions
Add the crates to Cargo.toml. The example uses tokio. If you prefer not to use an async runtime, enable reqwest’s blocking feature and call reqwest::blocking::Client with .send() instead of .send().await.
[dependencies]
reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
use serde::Deserialize;
use std::env;
use std::time::Duration;
#[derive(Deserialize)]
struct ChatResponse {
reply: Option<String>,
conversation_id: Option<i64>,
model: Option<String>,
error: Option<String>,
detail: Option<String>,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let key = env::var("DAEDALUS_API_KEY")?; // dk_...
let client = reqwest::Client::builder()
.timeout(Duration::from_secs(120))
.build()?;
let response = client
.post("https://astrovect.online/api/v1/chat")
.header("Authorization", format!("Bearer {key}"))
.json(&serde_json::json!({ "message": "Hello Daedalus" }))
.send()
.await?;
let status = response.status();
let data: ChatResponse = response.json().await?;
if !status.is_success() {
let msg = data
.detail
.or(data.error)
.unwrap_or_else(|| format!("HTTP {status}"));
return Err(msg.into());
}
println!("{}", data.reply.unwrap_or_default());
let conversation_id = data.conversation_id;
// Next turn: POST the same path with message and conversation_id (integer).
let mut follow_body = serde_json::json!({ "message": "Follow up question" });
if let Some(id) = conversation_id {
follow_body["conversation_id"] = id.into();
}
let follow = client
.post("https://astrovect.online/api/v1/chat")
.header("Authorization", format!("Bearer {key}"))
.json(&follow_body)
.send()
.await?;
let follow_data: ChatResponse = follow.json().await?;
println!("{}", follow_data.reply.unwrap_or_default());
Ok(())
}
Run with DAEDALUS_API_KEY=dk_your_key cargo run. There is no official Daedalus Rust crate; use reqwest (or any HTTPS client) directly.
Build the JSON body with a library such as cJSON. Do not assemble JSON with sprintf if the message can contain quotes or other characters that must be escaped.
Install the development packages (Debian/Ubuntu names shown; Homebrew is curl and cjson), then compile and run:
sudo apt-get install libcurl4-openssl-dev libcjson-dev
cc -o chat chat.c -lcurl -lcjson
DAEDALUS_API_KEY=dk_your_key ./chat
The cJSON header is often <cjson/cJSON.h>; some installs use <cJSON.h>.
#include <curl/curl.h>
#include <cjson/cJSON.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct memory {
char *data;
size_t size;
};
static size_t write_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
{
size_t total = size * nmemb;
struct memory *mem = userdata;
char *buf = realloc(mem->data, mem->size + total + 1);
if (!buf)
return 0;
mem->data = buf;
memcpy(mem->data + mem->size, ptr, total);
mem->size += total;
mem->data[mem->size] = '\0';
return total;
}
int main(void)
{
const char *key = getenv("DAEDALUS_API_KEY"); /* dk_... */
if (!key || !key[0]) {
fprintf(stderr, "DAEDALUS_API_KEY is not set\n");
return 1;
}
cJSON *body = cJSON_CreateObject();
cJSON_AddStringToObject(body, "message", "Hello Daedalus");
char *payload = cJSON_PrintUnformatted(body);
cJSON_Delete(body);
if (!payload)
return 1;
size_t auth_len = strlen("Authorization: Bearer ") + strlen(key) + 1;
char *auth = malloc(auth_len);
if (!auth) {
cJSON_free(payload);
return 1;
}
snprintf(auth, auth_len, "Authorization: Bearer %s", key);
struct memory chunk = {0};
CURL *curl = curl_easy_init();
if (!curl) {
free(auth);
cJSON_free(payload);
fprintf(stderr, "curl_easy_init failed\n");
return 1;
}
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, auth);
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_URL, "https://astrovect.online/api/v1/chat");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &chunk);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 120L);
CURLcode rc = curl_easy_perform(curl);
long status = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
int exit_code = 0;
if (rc != CURLE_OK) {
fprintf(stderr, "%s\n", curl_easy_strerror(rc));
exit_code = 1;
} else {
cJSON *data = cJSON_Parse(chunk.data ? chunk.data : "");
if (status >= 400) {
cJSON *detail = cJSON_GetObjectItemCaseSensitive(data, "detail");
cJSON *error = cJSON_GetObjectItemCaseSensitive(data, "error");
const char *msg = cJSON_IsString(detail) ? detail->valuestring
: cJSON_IsString(error) ? error->valuestring
: "request failed";
fprintf(stderr, "HTTP %ld %s\n", status, msg);
exit_code = 1;
} else {
cJSON *reply = cJSON_GetObjectItemCaseSensitive(data, "reply");
if (cJSON_IsString(reply) && reply->valuestring)
puts(reply->valuestring);
/* Next turn: POST message and conversation_id (integer). */
}
cJSON_Delete(data);
}
free(chunk.data);
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
free(auth);
cJSON_free(payload);
return exit_code;
}
This uses cpr (a C++ wrapper around libcurl) and nlohmann/json. You can also call libcurl directly, as in the C example, and parse the body with nlohmann/json.
A typical install is vcpkg install cpr nlohmann-json, or system packages such as libcpr-dev and nlohmann-json3-dev where available. Compile with C++17 or later, then run:
c++ -std=c++17 -o chat chat.cpp -lcpr
DAEDALUS_API_KEY=dk_your_key ./chat
If you use CMake with vcpkg, link cpr::cpr and nlohmann_json::nlohmann_json.
#include <cpr/cpr.h>
#include <nlohmann/json.hpp>
#include <cstdlib>
#include <iostream>
#include <stdexcept>
#include <string>
int main()
{
const char *key = std::getenv("DAEDALUS_API_KEY"); // dk_...
if (!key || !key[0])
throw std::runtime_error("DAEDALUS_API_KEY is not set");
nlohmann::json body = {{"message", "Hello Daedalus"}};
cpr::Response response = cpr::Post(
cpr::Url{"https://astrovect.online/api/v1/chat"},
cpr::Header{
{"Authorization", std::string("Bearer ") + key},
{"Content-Type", "application/json"},
},
cpr::Body{body.dump()},
cpr::Timeout{120000}); // milliseconds
auto data = nlohmann::json::parse(response.text);
if (response.status_code >= 400) {
std::string msg = "HTTP " + std::to_string(response.status_code);
if (data.contains("detail") && data["detail"].is_string())
msg = data["detail"].get<std::string>();
else if (data.contains("error") && data["error"].is_string())
msg = data["error"].get<std::string>();
throw std::runtime_error(msg);
}
std::cout << data.value("reply", "") << std::endl;
int conversation_id = data.value("conversation_id", 0);
// Next turn: POST the same path with message and conversation_id (integer).
(void)conversation_id;
}
Lua does not include HTTPS in the standard library. Install LuaSocket, LuaSec (ssl.https), and a JSON library such as dkjson (or lua-cjson):
luarocks install luasec
luarocks install dkjson
DAEDALUS_API_KEY=dk_your_key lua chat.lua
luasec pulls in LuaSocket. The lua-requests library is an optional wrapper around the same stack; the example below uses ssl.https directly so the headers and body are explicit.
local https = require("ssl.https")
local ltn12 = require("ltn12")
local json = require("dkjson")
local key = os.getenv("DAEDALUS_API_KEY") -- dk_...
if not key or key == "" then
error("DAEDALUS_API_KEY is not set")
end
https.TIMEOUT = 120
local payload = json.encode({ message = "Hello Daedalus" })
local chunks = {}
local ok, status = https.request({
url = "https://astrovect.online/api/v1/chat",
method = "POST",
headers = {
["Authorization"] = "Bearer " .. key,
["Content-Type"] = "application/json",
["Content-Length"] = tostring(#payload),
},
source = ltn12.source.string(payload),
sink = ltn12.sink.table(chunks),
})
local data = json.decode(table.concat(chunks))
if not ok or (type(status) == "number" and status >= 400) then
local msg = (data and (data.detail or data.error))
or (ok and ("HTTP " .. tostring(status)) or tostring(status))
error(msg)
end
print(data.reply)
local conversation_id = data.conversation_id
-- Next turn: POST the same path with message and conversation_id (integer).
Call the API from a server Script (for example in ServerScriptService) with HttpService:RequestAsync. This will not work in a LocalScript or any other client-side context.
Before it can run:
- In Roblox Studio, enable Game Settings → Security → Allow HTTP Requests.
- Keep the
dk_key off the client. Do not put it in LocalScripts, ReplicatedStorage, or any ModuleScript the client can require. Anyone who joins the game can read client-replicated code. - Prefer storing the key as a Roblox Secret and loading it with
HttpService:GetSecret. Set the secret’s allowed domain toastrovect.online. UseSecret:AddPrefix("Bearer ")for the header so the key is never concatenated as a plain string. Secrets are not available during local playtesting unless you also add a Local Secret under File → Experience Settings → Security. If Secrets are not available, keep the key only in a server-only Script and rotate it if the place file leaks. - Roblox applies its own HTTP timeout, which may be shorter than the 120-second timeouts in the other examples. A slow model reply can fail even though the Daedalus request would otherwise succeed.
- There is no official Daedalus Roblox SDK; use
HttpServicedirectly.
local HttpService = game:GetService("HttpService")
-- Create an experience Secret named DAEDALUS_API_KEY (the dk_ value), domain astrovect.online.
local key = HttpService:GetSecret("DAEDALUS_API_KEY")
local function chat(message: string, conversationId: number?, model: string?): any
local body: { [string]: any } = { message = message }
if conversationId ~= nil then
body.conversation_id = conversationId
end
if model ~= nil then
body.model = model
end
local response = HttpService:RequestAsync({
Url = "https://astrovect.online/api/v1/chat",
Method = "POST",
Headers = {
["Authorization"] = key:AddPrefix("Bearer "),
["Content-Type"] = "application/json",
},
Body = HttpService:JSONEncode(body),
})
local data = HttpService:JSONDecode(response.Body)
if not response.Success then
error(data.detail or data.error or ("HTTP " .. tostring(response.StatusCode)))
end
return data
end
local data = chat("Hello Daedalus")
print(data.reply)
local conversationId = data.conversation_id
local follow = chat("Follow up question", conversationId)
print(follow.reply)
Uses Foundation URLSession with async/await and Codable. Works in a macOS/iOS app or a command-line executable. Do not embed a dk_ key in a shipped app binary; call the API from a server you control, or from a local tool that reads DAEDALUS_API_KEY. Optional fields are encoded only when present, so the first request does not send "conversation_id": null.
import Foundation
struct ChatRequest: Encodable {
var message: String
var conversation_id: Int?
var model: String?
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(message, forKey: .message)
try container.encodeIfPresent(conversation_id, forKey: .conversation_id)
try container.encodeIfPresent(model, forKey: .model)
}
}
struct ChatResponse: Decodable {
let reply: String?
let conversation_id: Int?
let model: String?
let error: String?
let detail: String?
}
@main
struct DaedalusChat {
static func main() async {
do {
let first = try await chat(message: "Hello Daedalus")
print(first.reply ?? "")
let conversationId = first.conversation_id
let follow = try await chat(
message: "Follow up question",
conversationId: conversationId
)
print(follow.reply ?? "")
} catch {
fputs("\(error)\n", stderr)
exit(1)
}
}
static func chat(
message: String,
conversationId: Int? = nil,
model: String? = nil
) async throws -> ChatResponse {
guard let key = ProcessInfo.processInfo.environment["DAEDALUS_API_KEY"] else {
throw URLError(.userAuthenticationRequired)
}
var request = URLRequest(url: URL(string: "https://astrovect.online/api/v1/chat")!)
request.httpMethod = "POST"
request.timeoutInterval = 120
request.setValue("Bearer \(key)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try JSONEncoder().encode(
ChatRequest(message: message, conversation_id: conversationId, model: model)
)
let (data, response) = try await URLSession.shared.data(for: request)
let status = (response as? HTTPURLResponse)?.statusCode ?? 0
let body = try JSONDecoder().decode(ChatResponse.self, from: data)
if status >= 400 {
throw NSError(
domain: "Daedalus",
code: status,
userInfo: [
NSLocalizedDescriptionKey: body.detail ?? body.error ?? "HTTP \(status)"
]
)
}
return body
}
}
Compile and run (Swift 5.5 or later; -parse-as-library is required because of @main):
swiftc -parse-as-library chat.swift -o chat
DAEDALUS_API_KEY=dk_your_key ./chat
OpenAPI UI
The /docs, /redoc, and /openapi.json pages are disabled in production and return 404. This guide is the public documentation for the personal-key API. Website-only routes such as POST /chat, POST /upload, conversations, billing, and admin are not part of this API.
OpenAPI UI
The /docs, /redoc, and /openapi.json pages are disabled in production and return 404. This guide is the public documentation for the personal-key API. Website-only routes such as POST /chat, POST /upload, conversations, billing, and admin are not part of this API.