Skip to content

Get started#

Shadow AI Capture provides centralized visibility into AI usage that occurs outside OptScale AI. It supports telemetry collection from Bifrost and LiteLLM gateways managed by your team, as well as from Claude Code and Codex installations.

Use Shadow AI Capture to:

  • Monitor external AI usage: Track requests sent through AI gateways and coding tools without routing them through OptScale AI.
  • Track AI consumption and costs: View token usage, estimated spend, and model usage across connected sources.
  • Identify AI usage by users or teams: Use available gateway keys and caller information to understand who is using AI resources and attribute usage to the appropriate owners.
  • Analyze AI requests: Inspect captured traces to investigate model usage, latency, request status, and other available telemetry.
  • Discover external AI providers and models: Identify providers and models used through connected gateways and coding tools.

External gateways and coding tools continue to handle AI requests independently. Shadow AI Capture receives their exported telemetry without changing how requests are routed or processed.

Captured data can include provider and model information, token usage, latency, spend, gateway keys, and caller details. The availability of prompt and response text depends on the sender configuration.

Key concepts#

  • Source — A connection that receives telemetry from an external gateway or coding tool. A gateway source represents one gateway deployment; a Claude Code or Codex source can represent multiple installations using the same Installation ID and Shadow AI key.
  • Installation ID — A source identifier included in telemetry exports. It cannot be changed after source creation.
  • Shadow AI key — The source credential used to authorize telemetry exports. It is different from a gateway key.
  • Gateway Key — A key or caller identifier reported by the sender, used to distinguish and attribute usage within a source. Its representation depends on the sender.

How data is exported#

Shadow AI Capture uses OpenTelemetry to receive telemetry from connected senders. Supported senders export data using OTLP over HTTP with protobuf encoding. gRPC and LiteLLM's http/json protocol are not supported.

Depending on the sender, telemetry is exported to different endpoints:

  • Bifrost and LiteLLM: Send OpenTelemetry traces to the source's Traces endpoint.
  • Claude Code and Codex: Send OpenTelemetry events to the source's Logs endpoint.

Each export includes the source's Shadow AI key and Installation ID.

The solution generates the commands and configuration values for the selected sender and source, including the endpoint, headers, and environment variables. Follow the on-screen instructions to apply them to your sender.

For instructions on connecting and verifying a source, see How to start capturing AI usage.

Roles and allowed actions#

The following OptScale AI roles can perform these actions:

  • Connect, rename, or disconnect a source; change Capture; view the Shadow AI key: Owner, Administrator, AI Platform Engineer.
  • Assign gateway key owners and set limits: Owner, Administrator, AI Governance & FinOps Manager.
  • Change the source's Key assigned to: Owner, Administrator.

How to start capturing AI usage#

Connect an external gateway or coding tool to collect its AI usage in OptScale AI. Each source uses one Installation ID and one Shadow AI key.

Create a source#

  1. Open Config → Shadow AI Capture and click Connect Source above the Connected Sources table.
  2. Enter an Installation ID. It must:

    • Be 1–255 characters long.
    • Contain only letters and digits.
    • Be unique among your organization's connected sources.

    Leading and trailing spaces are removed.

    Warning

    The Installation ID cannot be edited after the source is created.

  3. Optionally, enter a Name. The Installation ID becomes the name when this field is empty.

  4. Click Save. The new source appears in the Connected Sources table.
  5. Configure a sender.

Configure a sender#

After creating a source, configure a sender to export telemetry data to OptScale AI.

  1. Open Config → Shadow AI Capture.
  2. In the Connected Sources table, click the source name.
  3. On the source details page, click How to Connect in the upper-right corner.
  4. In the How to Connect window, select a sender.
  5. Follow the on-screen instructions to configure the sender. The required commands and configuration values are generated for the selected sender and source. Copy and paste them into the appropriate fields, configuration files, or terminal as instructed.

How to Connect dialog with Bifrost sender instructions and generated OTLP endpoint

Note

The generated configuration includes the source-specific connection details. Users with permission to view the Shadow AI key see its actual value; other users see a placeholder.

Verify captured usage#

After configuring a sender (don't forget to restart it):

  1. Send a test request through the configured sender.
  2. Open Config → Shadow AI Capture → Connected Sources → click the source.
  3. Wait at least 30 seconds after sending the test request to give the sender time to collect and export OpenTelemetry data. Then click Refresh and verify that data appears in Providers and Gateway Keys. Exports may arrive in batches. If the data is still missing, see Troubleshooting.
  4. Once the data appears, click View Traces in Providers or Gateway Keys to open Analytics → Traces with the corresponding provider or gateway key filters applied.
  5. Verify the request's sender, provider, model, token usage, and status.

Troubleshooting#

No captured data on the source details page

  • Check the sender logs for telemetry export errors.
  • Verify that the sender is configured to export telemetry using the endpoint, protocol, and headers provided in Config → Shadow AI Capture → Connected Sources → click the required source → How to Connect.
  • Ensure that the source's Installation ID and Shadow AI key match the generated configuration.
  • Confirm that the sender is running with the latest configuration. Restart it if necessary.

Certificate errors

  • Verify that the sender trusts the OptScale AI deployment's TLS certificate.
  • Update the sender's trusted certificates if necessary, then retry the request.

Configuration changes are not applied

  • Restart the sender or start a new session to apply the updated configuration.
  • Compare the active configuration with the values generated in Config → Shadow AI Capture → Connected Sources → click the required source → How to Connect.

Shadow AI key is not visible

  • Check whether your role has permission to view the Shadow AI key.
  • Contact an administrator if the generated configuration contains a placeholder instead of the actual key.

Monitor captured activity#

View capture statistics and sources#

Open Config → Shadow AI Capture and use the date-range selector in the upper-right corner.

Shadow AI Capture summary metrics and Connected Sources table

The summary shows spend, requests, tokens, average provider latency, and idle sources for the selected period. Current-state counters show connected sources, sources with capture switched off (see Capture column of the Connected Sources table), reported gateway keys, and keys without an owner.

The Connected Sources table lists each source's Installation ID, providers, usage, latency, gateway keys, capture setting, creation time, and available actions. Select a source to open its details.

Statistics use data received when the page loads. Select Refresh in the upper-right corner of the page to reload the source list and statistics.

View source connection details#

The source details page provides information about the source connection, capture status, authentication credentials, and ownership settings. It also allows managing selected connection settings.

To view this information, go to Config → Shadow AI Capture and select a source in the Connected Sources table. The Connection Details section displays:

  • Name — The source name, which can be edited.
  • Capture — Whether incoming telemetry data is being saved. Capture can be enabled or disabled.
  • Shadow AI key — The credential used to authenticate telemetry exports from the sender. The key can be viewed, copied, or regenerated.
  • Key assigned to — The employee or agent assigned as the fallback owner for requests associated with gateway keys that have no assigned owner. This setting can be changed.
  • Last capture — When OptScale AI last received data from the sender.
  • Connected — When the source was created.
  • Traces endpoint and Logs endpoint — Endpoints used by the sender to export telemetry.
  • Installation ID — The unique source identifier, which cannot be changed after creation.

Source Connection Details with Capture, endpoints, Installation ID, key, and fallback owner

The First seen value in the Connected Sources table corresponds to the source creation time. For providers and gateway keys, First seen indicates when each item first appeared in captured data.

For instructions on changing Capture settings, regenerating the Shadow AI key, and disconnecting sources, see Manage source connections.

Review connected providers#

Connected provider information helps track which AI providers are used across external gateways and coding tools, monitor model usage and costs, and identify opportunities for cost optimization. It also provides visibility into provider-level limits, pricing, and cost allocation.

There are several ways to view connected providers in OptScale AI, depending on the required level of detail:

  1. View all connected providers. Go to Config → Providers → Connected Sources. This tab lists all providers discovered through Shadow AI Capture.

    Connected Sources tab listing providers discovered through Shadow AI Capture

    Click a provider to open its details page, where you can review model usage statistics, configure limits and model pricing, and view cost center allocation in the Distribution tab.

  2. View providers by source. Go to Config → Shadow AI Capture. In the Connected Sources table, the Providers column displays the providers discovered for each source.

  3. View detailed provider usage for a source. Go to Config → Shadow AI Capture and click a source in the Connected Sources table. On the source details page, the Providers section displays usage statistics for each discovered provider.

Discovered provider names use <Installation ID>/<provider>, where the sender supplies the provider portion. Names cannot be edited. Credentials, base URLs, routing, and models remain configured in the external sender.

A discovered provider cannot be converted into a directly managed provider. Create a separate provider under Config → Providers → Providers when requests must be routed through OptScale AI. For model pricing and cost distribution procedures, see Manage connected providers.

Review gateway keys#

Open Config → Shadow AI Capture → Connected Sources → click the source → Gateway Keys. Gateway keys appear after their first capture:

  • Bifrost and LiteLLM — Keys reported by the gateway.
  • Claude Code — One key per person, identified by account ID or email.
  • Codex — One key per person when email is reported, or one key per machine when an API key is used.

Gateway Keys table with caller, team, ownership, limits, and first-seen details

A gateway key is unique within its source. The same Key ID on two sources represents two separate keys.

The table provides information about gateway key usage, including caller and team details, assigned ownership, usage limits, and when each key was first detected. Caller and team information is reported by the sender and is not directly linked to OptScale AI accounts or teams.

For ownership configuration, see Assign gateway key owners.

Open requests in Traces#

Traces provides detailed information about captured AI requests, including model usage, token consumption, costs, request statuses, and latency. This information helps investigate AI activity, identify usage patterns, and troubleshoot failed requests.

There are several ways to access captured requests in Analytics → Traces, depending on the required level of detail:

  1. View requests across all providers of a source. Go to Config → Shadow AI Capture → Connected Sources → click the source. On the source details page, click View Traces next to the Providers table heading.

  2. View requests for a specific provider. On the same page, find the provider in the Providers table and click the View Traces icon next to its name.

  3. View requests by gateway key. In the Gateway Keys section of the source details page, click View Traces next to the table heading to view requests across the source's gateway keys, or click the View Traces icon next to a specific key to view its requests.

Each action opens Analytics → Traces with the corresponding provider or gateway key filters applied.

For more information about searching requests, filtering by status, refreshing data, and viewing request details, see Investigate captured requests in Traces.

See also#