Skip to content

Import from the OpenAI dashboard

Do the shared setup first: an ingest key, pip install metergraphrelay, and a .env holding METERGRAPH_APP_TOKEN.

This path needs no observability tool at all. If your application calls OpenAI with store=True, OpenAI keeps the completion server side, and the relay reads it back. It is the same storage OpenAI’s own dashboard and evals features use.

Stored chat completions, listed through OpenAI’s List Chat Completions API. Only completions created with store=True exist to be read, and an API key only ever sees the completions made with that key.

Credentials The OPENAI_API_KEY your application uses
Prerequisite store=True on the calls you want to import
.env
METERGRAPH_APP_TOKEN=<your ingest key>
OPENAI_API_KEY=sk-...

If your calls do not set store=True yet, add it:

app/llm.py
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "..."}],
store=True,
)
  1. metergraphrelay pull openai -n 100 --route my-app/support-bot --output openai.jsonl
    Flag Meaning
    -n, --count How many of the most recent stored completions to read. Defaults to 10
    --route The route every row lands on. Defaults to openai/backfill
    --include-content Copy the prompt and response text. Off by default
    --output Where to write the JSONL. Defaults to ./traces.jsonl
    --stdout Echo each row as it is written

    There are no time selectors here. The relay reads the most recent stored completions in descending order, so -n is the only bound.

    Add --include-content only if the prompt and response text may be copied. This is the one import path where content is opt in rather than automatic.

  2. head -n 2 openai.jsonl
    metergraphrelay push openai.jsonl

    metergraphrelay sync openai runs both steps in one command and takes the same flags. It is a convenience, not a scheduled mode.

  3. Open Traces in Metergraph. Every row carries the route you passed, because OpenAI stores no workflow name for the relay to read. One pull is one route.

Every other source can run hourly from cron, holding a checkpoint on the Metergraph side. OpenAI cannot. The server’s list of sources that may take a sync lease is portkey, langfuse, braintrust, phoenix and langsmith (app/src/metergraph_app/import_identity.py:30), and OpenAI is deliberately not on it.

That means OpenAI rows carry no import identity and are not deduplicated. Two pulls over overlapping stored completions import the same call twice. Track what you have loaded, or use -n deliberately.

If you want ongoing capture of OpenAI traffic, instrument the application instead: see OpenAI.

Field Where it comes from
Route Whatever you pass with --route, or openai/backfill
Timestamp The completion’s created time
Provider Always openai
Model The completion’s model
Endpoint Always chat.completions
Input and output tokens The completion’s prompt_tokens and completion_tokens
Status Always success. A stored completion is one that succeeded
Request id The completion’s id
Tags The completion’s metadata object
Content Only with --include-content. The request messages and the first choice’s reply

Cost is not carried. Metergraph prices these rows from its own catalog.

  • Cache, cache write and reasoning token buckets. The stored completion exposes only the prompt and completion totals.
  • Latency. Nothing in stored completions records it.
  • Trace, span and session ids. Each row stands alone, so imported OpenAI calls do not assemble into traces.
  • Failed calls. Only successful completions are stored, so a failed call and the input tokens it spent are invisible on this path.
  • Function attribution, streaming detail, outcomes and repository identity, as on every import path.
Symptom Likely cause What to do
No stored completions found The calls were not made with store=True, or were made with a different key Add store=True and use that application’s key
Content columns are empty --include-content was not passed Pass it, if the content may be copied
Every route is openai/backfill No --route was passed Pass one. OpenAI stores no workflow name
Rows counted twice Two pulls covered the same completions This path does not deduplicate