> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tensorcost.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenTelemetry ingest

> Send GenAI spans you already collect to TensorCost, and see what each span becomes.

If your calls are already traced with OpenTelemetry GenAI instrumentation, you can send those spans to TensorCost without the SDK. Each span becomes one observation: one call, with its model, tokens, status and attribution. TensorCost prices it.

```text theme={null}
POST https://api.tensorcost.com/api/inference-proxy/otlp/v1/traces
```

Success returns 202 with `{ "accepted": <count>, "correlation_ids": [...] }`.

## Limits to know first

| Limit | Detail |
| - | - |
| JSON only | The body must be OTLP/HTTP JSON with a `resourceSpans` array. Protobuf is not handled, and anything without `resourceSpans` returns 400. |
| Short-lived token | The endpoint takes the same 15-minute token as the proxy, not your SDK key. A stock exporter cannot do the exchange, so you must refresh the token yourself and update the exporter's header. |
| 100 spans a request | Spans past the 100th are dropped without an error. Send smaller batches. |
| Every span counts | A span with no model attribute is recorded as model `unknown`. Export only your GenAI spans. |
| Span attributes only | Resource attributes are not read. Put attribution on the span. |

## Authenticate

Exchange your SDK key for a token as described in [Calling the proxy directly](https://docs.tensorcost.com/developers/proxy.md), then send it as the bearer token.

## Send spans

```bash theme={null}
curl -X POST https://api.tensorcost.com/api/inference-proxy/otlp/v1/traces \
  -H "Authorization: Bearer $TC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "resourceSpans": [{
      "scopeSpans": [{
        "spans": [{
          "traceId": "5b8efff798038103d269b633813fc60c",
          "spanId": "eee19b7ec3c1b174",
          "name": "chat gpt-4o-mini",
          "startTimeUnixNano": "1763121600000000000",
          "endTimeUnixNano": "1763121601000000000",
          "attributes": [
            { "key": "gen_ai.system", "value": { "stringValue": "openai" } },
            { "key": "gen_ai.request.model", "value": { "stringValue": "gpt-4o-mini" } },
            { "key": "gen_ai.usage.input_tokens", "value": { "intValue": "120" } },
            { "key": "gen_ai.usage.output_tokens", "value": { "intValue": "40" } },
            { "key": "gen_ai.user.id", "value": { "stringValue": "acme" } },
            { "key": "gen_ai.feature", "value": { "stringValue": "search" } }
          ]
        }]
      }]
    }]
  }'
```

## What each span becomes

| Observation field | Read from |
| - | - |
| Model | `gen_ai.request.model`, `gen_ai.response.model` or `llm.model_name`; otherwise `unknown` |
| Provider | `gen_ai.system` or `llm.provider`, matched on Anthropic, Bedrock, Azure, Vertex or Google; anything else is `openai` |
| Operation | The span name or `gen_ai.operation.name` |
| Input and output tokens | `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`, or `llm.token_count.prompt` and `llm.token_count.completion`; 0 when absent |
| Status | `error` if `gen_ai.response.status` or `error.type` is set to anything but `success`, otherwise `success` |
| Start and end | The span's start and end times |
| Agent | `gen_ai.agent.id` or `agent.id` |
| Run | `gen_ai.workflow.id` or `workflow.id` |
| Customer | `gen_ai.user.id` or `enduser.id` |
| Feature | `gen_ai.feature` or `feature` |
| Cost | Always priced by TensorCost from the model and tokens |
| Call id | Built from the trace id and span id, so resending a span does not double count it |

The environment is the token's own, whatever the span says. Team comes from a team-bound key. A hard budget cap does not refuse a span; the response carries `X-TensorCost-Budget-Exceeded` and the span is still recorded. Fields are described in [Attribution](https://docs.tensorcost.com/developers/attribution.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.