opendunes
Management
Copy page ▾

Trace destinations

POST /v1/observability/destinations adds a destination: a monitoring tool of yours that receives a copy of every request, as a trace; five routes add, list, read, change and remove them.

Request

Send them with a management keyManagement keyThe key that runs your account through the API: the balance, the usage history, your keys, guardrails, observability. It never calls a model.More on API keys →: set OPENDUNES_MANAGEMENT_KEY to it for these calls. An API keyAPI keyThe key you create and send with every request that calls a model.More on API keys → gets a 401. The Observability guide adds one from start to end.

RouteDoes
POST /v1/observability/destinationsadds a destination
GET /v1/observability/destinationslists your destinations
GET /v1/observability/destinations/{id}answers one
PATCH /v1/observability/destinations/{id}changes one
DELETE /v1/observability/destinations/{id}removes one; its traces stop

Add

PATCH takes the same fields but type; the config it sends is merged into the one kept.

FieldNeededYou send
nameyesa name of your own, up to 200 characters
typeyesthe tool, below; at most 5 destinations of one type
configyesthe tool's settings, each a string, below. Every type also takes headers, sent with each trace. An address must be https and public
enablednofalse to stop sending without removing it; absent, true
privacy_modenotrue to leave the prompt and the answer out of each trace
sampling_ratenothe share of requests sent, from 0.0001 to 1; absent, 1, every request
api_key_hashesnoonly the requests of these keys, each by its hash; absent, every key
filter_rulesnoonly the requests that match: {"groups": [{"logic": "and", "rules": [{"field": ..., "operator": ..., "value": ...}]}]}
broadcast_generation_costnotrue to put the request's charge in the trace
broadcast_generation_identitynotrue to put who sent it in the trace
broadcast_generation_request_contextnotrue to put the request's context in the trace
regionsnowhere traces leave from, a list of global, europe or us; absent, ["global"]

A rule's field is model, provider, session_id, user_id, api_key_name, finish_reason, input, output, total_cost, total_tokens, prompt_tokens or completion_tokens. Its operator is equals, not_equals, contains, not_contains, regex, starts_with, ends_with, gt, lt, gte, lte, exists or not_exists.

typeconfig needsand may take
arizeapiKey, spaceKey, modelIdbaseUrl
braintrustapiKey, projectIdbaseUrl
clickhousehost, database, username, passwordtable
datadogapiKey, mlAppurl
bigqueryprojectId, serviceAccountKey, the service account's JSON keydataset, table
grafanaapiKey, instanceIdbaseUrl
langfusesecretKey, publicKeybaseUrl
langsmithapiKeyendpoint, project, workspaceId
newreliclicenseKeyregion, us or eu
opikapiKey, workspace, projectName—
otel-collectorendpoint—
posthogapiKeyendpoint
raindropwriteKeybaseUrl
rampapiKeybaseUrl
s3bucketName, accessKeyId, secretAccessKeyendpoint, region, prefix, pathTemplate, sessionToken
sentryotlpEndpoint, dsn—
snowflakeaccount, tokendatabase, schema, table, warehouse
weaveapiKey, entity, projectbaseUrl
webhookurlmethod, POST or PUT

Souk Bot sends every request to its Langfuse project, prompts left out.

import json
import os
import urllib.request

MANAGEMENT_KEY = os.environ["OPENDUNES_MANAGEMENT_KEY"]
ADDRESS = "https://opendunes.com/v1/observability/destinations"

request = urllib.request.Request(
    ADDRESS,
    data=json.dumps(
        {
            "name": "Souk Bot traces",
            "type": "langfuse",
            "config": {
                "publicKey": os.environ["LANGFUSE_PUBLIC_KEY"],
                "secretKey": os.environ["LANGFUSE_SECRET_KEY"],
            },
            "privacy_mode": True,
        }
    ).encode(),
    headers={
        "Authorization": "Bearer " + MANAGEMENT_KEY,
        "Content-Type": "application/json",
    },
)
with urllib.request.urlopen(request) as response:
    destination = json.load(response)["data"]

print(destination["id"], destination["enabled"])

List

GET /v1/observability/destinations takes its fields in the address, after ?.

FieldNeededYou send
limitnohow many one page holds, 1 to 100; absent, 50
offsetnohow many to skip, for the next page

Response

POST answers 201 Created with data, the destination; GET and PATCH on one answer 200 OK with the same. The list answers data, a list, and total_count.

FieldHolds
datathe destination, or the list
total_counton a list: how many there are in all
idthe destination's id
name · typeas you set them
configits settings, each secret shown as its first and last four characters only
enabled · privacy_mode · sampling_rate · api_key_hashes · filter_rules · regionsas you set them, or their defaults
broadcast_generation_cost · broadcast_generation_identity · broadcast_generation_request_contextas you set them
created_at · updated_atwhen it was added and last changed, in UTC

DELETE answers 200 OK with deleted, true.

What it cost

Free. Adding and running a destination is never charged; the requests it copies are charged as they always are.

Errors

error.code carries the status, and error.message says why.

StatusWhen
400name, type or config is missing, type is not one of the tools, config lacks a setting the tool needs or holds one it does not take, an address is not public https, or type is sent on a change; error.metadata.errors names the field
401the management key is missing, wrong, revoked or expired, or it is an API key
404no destination of yours has that id
409you already have 5 destinations of that type

Last modified on