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.
What the relay reads
Section titled “What the relay reads”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.
What you need
Section titled “What you need”| Credentials | The OPENAI_API_KEY your application uses |
| Prerequisite | store=True on the calls you want to import |
METERGRAPH_APP_TOKEN=<your ingest key>OPENAI_API_KEY=sk-...If your calls do not set store=True yet, add it:
response = client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "..."}], store=True,)Backfill
Section titled “Backfill”-
Pull the stored completions
Section titled “Pull the stored completions”metergraphrelay pull openai -n 100 --route my-app/support-bot --output openai.jsonlFlag Meaning -n,--countHow many of the most recent stored completions to read. Defaults to 10 --routeThe route every row lands on. Defaults to openai/backfill--include-contentCopy the prompt and response text. Off by default --outputWhere to write the JSONL. Defaults to ./traces.jsonl--stdoutEcho each row as it is written There are no time selectors here. The relay reads the most recent stored completions in descending order, so
-nis the only bound.Add
--include-contentonly if the prompt and response text may be copied. This is the one import path where content is opt in rather than automatic. -
Read the file, then upload it
Section titled “Read the file, then upload it”head -n 2 openai.jsonlmetergraphrelay push openai.jsonlmetergraphrelay sync openairuns both steps in one command and takes the same flags. It is a convenience, not a scheduled mode. -
Check the first rows
Section titled “Check the first rows”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.
No scheduled mode
Section titled “No scheduled mode”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.
What lands in Metergraph
Section titled “What lands in Metergraph”| 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.
What does not carry over
Section titled “What does not carry over”- 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.
Troubleshooting
Section titled “Troubleshooting”| 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 |