GlossarySecurity & ComplianceUpdated 2026-03-16

Wrapped Keys

Proxy API keys that route provider SDK traffic through a cost tracking layer. The original provider key never leaves the server, while the wrapped key provides per-key attribution, budget enforcement, and policy controls without requiring application code changes beyond a base URL swap.

Definition

What is Wrapped Keys?

A wrapped key is a proxy-issued API credential that acts as a transparent stand-in for a real LLM provider API key. When your application authenticates with a wrapped key, the request is routed through a proxy layer (such as CostHawk) that substitutes the wrapped key with the real provider key before forwarding to the upstream API. The provider sees a valid API key and processes the request normally; your application sees a standard API response. The proxy layer sits transparently in between, logging usage metadata — token counts, model, latency, cost — and enforcing policies like budget caps and model restrictions. The term "wrapped" reflects the architecture: the real provider key is wrapped inside the proxy's security boundary. It is encrypted at rest, never exposed to client applications, never included in logs, and accessible only to the proxy's forwarding module. The wrapped key is a reference — a pointer that maps to the real key within the proxy's database — rather than a derivation or transformation of the real key. This means a compromised wrapped key cannot be reverse-engineered to recover the provider key, and revoking a wrapped key does not affect the provider key or any other wrapped keys backed by the same provider key.

Impact

Why It Matters for AI Costs

Wrapped keys solve three fundamental problems that plague organizations managing AI API costs at scale: cost attribution, security isolation, and policy enforcement.

Problem 1: Cost attribution without key sprawl. To track costs per team or per service using provider-native keys, you must create a separate provider key (and often a separate organization or project) for each attribution boundary. For an organization with 8 teams and 15 services, that is potentially 120+ provider keys (8 teams × 15 services), each requiring separate billing configuration. Wrapped keys decouple attribution from provider-level key management: you create a handful of provider keys (one per provider, or one per billing entity) and generate unlimited wrapped keys on top of them. Each wrapped key gets its own cost tracking, budget, and usage dashboard. CostHawk customers typically reduce their provider key count by 80% while increasing their attribution granularity by 5–10x.

Problem 2: Key security. In a traditional setup, real provider API keys must be distributed to every application that calls the AI API. Each distribution point is a potential leak vector: environment variables, CI/CD secrets, developer machines, configuration files. If any one of these points is compromised, the attacker gains direct access to your provider account. With wrapped keys, the real provider key never leaves the proxy server. Applications only ever see the wrapped key, which is worthless without the proxy — it cannot be used to call the provider directly. If a wrapped key is compromised, you revoke it in the proxy dashboard and issue a replacement. The provider key remains unchanged, and all other wrapped keys continue to work. The blast radius of a compromise is reduced from "entire provider account" to "one team's cost attribution."

Problem 3: Centralized policy enforcement. Without a proxy layer, policy enforcement (budget caps, model restrictions, rate limits) must be implemented in each application independently. This means duplicated logic, inconsistent enforcement, and no central control plane. Wrapped keys centralize policy enforcement at the proxy layer: every request, regardless of which application sends it, passes through the same policy engine. A change to a budget cap takes effect immediately across all applications using that wrapped key — no code deployments, no configuration changes, no cross-team coordination required.

The financial impact is measurable. CostHawk customers deploying wrapped keys for the first time typically discover 15–25% of unattributed or misattributed spend, identify 10–20% of spend going to development and testing environments, and achieve full per-team and per-service cost visibility within their first week. The operational overhead is minimal: wrapped keys require only a base URL change and a key swap in each consuming application.

What Are Wrapped Keys?

Wrapped keys are proxy-issued API credentials that serve as intermediaries between your application and an LLM provider's API. They are called "wrapped" because the real provider key is wrapped inside the proxy's security layer — your application never sees, stores, or transmits the real key. Instead, it uses a wrapped key that the proxy translates into the real key at request time.

A wrapped key looks similar to a standard API key but with a distinct prefix that identifies it as a proxy key:

// Real OpenAI key (stays on the proxy server, encrypted)
sk-proj-abc123def456...

// CostHawk wrapped keys (distributed to applications)
ch_engineering_prod_sk_7f8a9b...   → Engineering team, production
ch_engineering_dev_sk_2c3d4e...    → Engineering team, development
ch_product_prod_sk_9e0f1a...       → Product team, production
ch_data_science_sk_4b5c6d...       → Data science team

All four wrapped keys map to the same underlying OpenAI key, but each has its own identity in CostHawk's system. When ch_engineering_prod_sk_7f8a9b is used to make a request, CostHawk logs the request against the engineering team's production cost center. When ch_data_science_sk_4b5c6d is used, it is logged against the data science team. The provider sees the same API key for both requests; CostHawk sees two distinct attribution streams.

Wrapped keys are not encrypted or derived versions of the provider key — they are entirely separate credentials generated by the proxy. There is no mathematical relationship between a wrapped key and the provider key it maps to. This is an important security property: possessing a wrapped key gives you no information about the real provider key, and brute-forcing the provider key from a wrapped key is computationally infeasible.

The concept is analogous to virtual credit card numbers in consumer finance. A virtual card number routes transactions through the card issuer to your real card, adding a layer of control (spending limits, merchant restrictions) and security (the real card number is never exposed to merchants). Wrapped keys provide the same benefits for API credentials: control, attribution, and security without changing the underlying provider relationship.

How Wrapped Keys Work

The lifecycle of a request using a wrapped key involves five steps, all of which happen transparently from the application's perspective.

Step 1: Application sends request with wrapped key. Your application uses the provider's standard SDK, with two configuration changes: the API key is set to the wrapped key, and the base URL is set to the proxy endpoint.

import Anthropic from "@anthropic-ai/sdk"

const client = new Anthropic({
  apiKey: "ch_engineering_prod_sk_7f8a9b...",
  baseURL: "https://proxy.costhawk.com"  // CostHawk proxy
})

const response = await client.messages.create({
  model: "claude-3-5-sonnet-20241022",
  max_tokens: 1024,
  messages: [
    { role: "user", content: "Explain load balancing for LLM APIs." }
  ]
})

The SDK does not know it is talking to a proxy. It constructs a standard HTTP request and sends it to the proxy URL.

Step 2: Proxy authenticates and looks up the wrapped key. The proxy receives the request, extracts the wrapped key from the Authorization header, and looks it up in its database. The lookup returns: the real provider API key (encrypted, decrypted only in memory for the forwarding step), the owning team and project, the key's policies (budget cap, model allowlist, rate limit), and the current period's usage (spend, request count).

Step 3: Proxy applies policies. Before forwarding, the proxy evaluates the request against the key's policies:

  • Budget check: Estimate the request cost and verify it will not exceed the key's remaining budget. A GPT-4o request with 2,000 input tokens costs approximately $0.005 — is the key's daily budget still above $0.005?
  • Model check: Is the requested model on the key's allowlist? If the key is restricted to GPT-4o mini and the request targets GPT-4o, return a 403 Forbidden error.
  • Rate limit check: Has the key exceeded its configured RPM or TPM limit?

If any policy is violated, the proxy returns an appropriate error response without forwarding the request to the provider. No provider tokens are consumed and no cost is incurred.

Step 4: Proxy forwards to provider. The proxy constructs a new HTTP request to the provider's real API endpoint, substituting the wrapped key with the decrypted real provider key. The request body and headers are forwarded as-is (with the key substitution). For streaming requests, the proxy establishes an SSE connection to the provider.

Step 5: Proxy relays response and logs usage. The provider's response flows back through the proxy to the application. The proxy extracts usage metadata from the response (input tokens, output tokens, model, latency) and asynchronously writes a usage record attributed to the wrapped key. For streaming responses, the proxy forwards each chunk in real time while accumulating the token count. The usage record is available in the CostHawk dashboard within seconds.

Total overhead: 5–15ms of additional latency per request, entirely in steps 2 and 3. Steps 4 and 5 add no latency because the provider response is streamed directly to the application while logging happens asynchronously.

Wrapped Keys vs Direct API Keys

Understanding the tradeoffs between wrapped keys and direct API keys helps you decide which approach is right for each use case.

CharacteristicDirect API KeyWrapped Key (CostHawk)
Setup complexityNone — use provider key directlyMinimal — swap API key + base URL
Cost attributionPer-organization or per-project at provider levelPer-key, per-team, per-service, per-environment
Budget enforcementMonthly limits at provider level onlyPer-key daily/monthly caps with hard enforcement
Model restrictionsNone — any key can access any modelPer-key model allowlists
Rate limitingProvider-imposed per-account limitsCustom per-key limits on top of provider limits
Key securityReal key distributed to all applicationsReal key stays on proxy; apps see only wrapped key
Blast radius of compromiseFull provider account accessOnly the compromised wrapped key's scope
Key rotation impactMust update every consuming applicationUpdate once in proxy; no app changes needed
Cross-provider analyticsCheck each provider dashboard separatelyUnified dashboard across all providers
Real-time cost trackingDelayed (hours to days)Per-request, within seconds
Latency overheadNone5–15ms per request
DependencyProvider onlyProvider + proxy service

The tradeoff is clear: wrapped keys add a small latency overhead (5–15ms) and a dependency on the proxy service, but in return provide dramatically better cost visibility, security, and operational control. For development and experimentation, direct keys are often sufficient. For production workloads with real cost accountability requirements, wrapped keys are the standard approach.

The dependency on the proxy service is the most common objection to wrapped keys. If the proxy goes down, your LLM-powered features go down. This risk is mitigated by proxy redundancy (CostHawk runs across multiple availability zones) and client-side circuit breakers that fall back to direct provider access if the proxy is unresponsive. The fallback sacrifices cost tracking during the failover period but maintains application availability.

One often-overlooked benefit of wrapped keys is vendor flexibility. Because your applications reference wrapped keys (not provider keys), you can change the underlying provider without updating any application code. If you decide to switch from OpenAI to Anthropic for a particular workload, update the provider key mapping in CostHawk's dashboard. All applications using the relevant wrapped keys immediately route to the new provider. This decoupling of application identity from provider identity provides significant operational agility.

Cost Tracking with Wrapped Keys

Wrapped keys transform AI cost tracking from a monthly billing reconciliation exercise into a real-time, granular, actionable data stream. Every request through a wrapped key generates a cost record that can be sliced along multiple dimensions.

Per-key cost tracking. The most granular view: every wrapped key has its own running cost total. If you issue separate wrapped keys for each service, you can see that ch_chatbot_prod_sk_... has spent $3,247.18 this month while ch_code_review_prod_sk_... has spent $1,892.44. This is the foundation for all higher-level cost analytics.

Per-project aggregation. Group wrapped keys by project or product line to see total cost at the business level. The "Customer Support AI" project includes the chatbot service, the ticket classifier, and the sentiment analyzer — their combined wrapped key costs show the true cost of the project: $7,841/month, not the $4,200 that the chatbot team thought they were spending.

Per-team chargebacks. Tag wrapped keys with team identifiers and generate monthly chargeback reports. Engineering: $12,400. Product: $8,200. Data Science: $15,600. Research: $3,800. Total: $40,000 — which matches the provider invoice, confirming that all costs are attributed. Without wrapped keys, this reconciliation is guesswork.

Per-model cost breakdown. Within each wrapped key, see which models are consuming the budget. The data science team's wrapped key shows: 60% of spend on Claude 3.5 Sonnet (evaluation and generation tasks), 25% on GPT-4o (comparison benchmarks), and 15% on GPT-4o mini (preprocessing). This breakdown reveals optimization opportunities: could the preprocessing step use an even cheaper model?

Environment cost separation. With separate wrapped keys for dev, staging, and production, you can see that development accounts for 28% of total spend. Of that 28%: 40% comes from a single developer running large-scale experiments with Claude 3 Opus, 30% from integration test suites that call the real API instead of mocking, and 30% from legitimate development usage. The first two categories are immediate optimization targets — switch the experiments to a cheaper model and mock API calls in integration tests.

Time-series analysis. CostHawk stores timestamped cost records for every request, enabling time-series analysis at any granularity: hourly, daily, weekly, or monthly. This reveals patterns like: weekend traffic is 30% lower (can you scale down batch jobs?), a new feature launch on March 3 increased the chatbot's daily cost by $200 (expected?), and monthly costs have grown 12% month-over-month for the past three months (is this aligned with user growth?).

Anomaly detection. Per-key cost baselines enable statistical anomaly detection. CostHawk compares each key's current-period spend against its rolling 7-day and 30-day averages. A key that suddenly spends 3x its normal daily rate triggers an alert. This catches: runaway scripts (infinite loops calling the API), prompt injection attacks (malicious inputs that trigger expensive processing), configuration errors (wrong model selected, causing 10x cost increase), and organic traffic spikes that may need investigation.

Setting Up Wrapped Keys

Setting up CostHawk wrapped keys takes under 10 minutes per provider and requires only two code changes per consuming application. Here is the complete setup guide.

Step 1: Create a CostHawk account. Sign up at costhawk.com and complete the organization setup. CostHawk uses Clerk for authentication — you can sign up with email, Google, or GitHub.

Step 2: Add your provider API keys. Navigate to Dashboard → Integrations and click Add Provider Key. Select the provider (OpenAI, Anthropic, Google), paste your API key, and give it a label (e.g., "OpenAI Production" or "Anthropic Team Account"). CostHawk encrypts the key with AES-256-CBC using a unique initialization vector and stores it in the secure database. The raw key is never displayed again after initial entry — you will interact with it only through wrapped keys.

Step 3: Generate wrapped keys. For each provider key, generate one or more wrapped keys. Each wrapped key needs:

  • Label: A human-readable identifier (e.g., "Engineering - Chatbot - Production")
  • Tags: Metadata for grouping in analytics (team: engineering, service: chatbot, env: production)
  • Budget cap (optional): Maximum daily or monthly spend ($100/day for dev keys, $5,000/day for production)
  • Model allowlist (optional): Restrict which models this key can access (e.g., gpt-4o-mini only for dev keys)
  • Rate limit (optional): Maximum RPM for this specific key

CostHawk generates a wrapped key with a ch_ prefix: ch_eng_chatbot_prod_sk_7f8a9b...

Step 4: Update your application code. In each consuming application, make two changes:

// OpenAI SDK example
import OpenAI from "openai"

// Before: direct provider key
const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY // sk-proj-abc...
})

// After: wrapped key through CostHawk proxy
const client = new OpenAI({
  apiKey: process.env.COSTHAWK_WRAPPED_KEY,  // ch_eng_chatbot_prod_sk_...
  baseURL: "https://proxy.costhawk.com/v1"
})

// Everything else stays the same — same SDK, same methods, same parameters
const response = await client.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Hello!" }]
})
// Anthropic SDK example
import Anthropic from "@anthropic-ai/sdk"

const client = new Anthropic({
  apiKey: process.env.COSTHAWK_WRAPPED_KEY,
  baseURL: "https://proxy.costhawk.com"
})

// Same API surface — messages.create, streaming, tool use — all work identically
const response = await client.messages.create({
  model: "claude-3-5-sonnet-20241022",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello!" }]
})

Step 5: Deploy and verify. Deploy the code changes. Within seconds, requests begin appearing in the CostHawk dashboard, attributed to your wrapped key. Verify that: requests are being logged with correct token counts, the cost computation matches your expectations, the latency overhead is within the expected 5–15ms range, and any configured budget caps or model restrictions are being enforced correctly.

Step 6: Roll out to all services. Repeat Step 4 for each service that calls an AI API. Create separate wrapped keys for each service, team, and environment to maximize attribution granularity. A typical rollout takes 1–2 days for an organization with 10–15 services.

Wrapped Key Security Model

The security model of wrapped keys is designed around the principle that the real provider API key should have the minimum possible exposure. Here is how each layer of the security model works.

Provider key isolation. The real provider API key exists in exactly one place: CostHawk's encrypted database. It is encrypted with AES-256-CBC using a unique initialization vector (IV) per key. The encryption key is stored separately from the encrypted data (in an environment variable on the proxy server, not in the database). The raw provider key is decrypted only in memory, only for the duration of a single request forwarding operation, and is never written to logs, API responses, error messages, or monitoring systems. Even CostHawk's own support team cannot access the decrypted provider key — the architecture enforces this through separation of the encryption key from the encrypted data.

Wrapped key authentication. When a request arrives with a wrapped key, the proxy validates it against the database. The validation checks: (1) the wrapped key exists and is not revoked, (2) the wrapped key is not expired, (3) the wrapped key's associated provider key is still active. If any check fails, the request is rejected with a 401 Unauthorized response. The wrapped key itself is stored as a salted hash in the database — even a database breach would not reveal usable wrapped keys.

Blast radius containment. If a wrapped key is compromised, the attacker can make requests through the proxy using that key's identity and budget. However, they cannot: access the real provider key, use models outside the key's allowlist, exceed the key's budget cap, or affect other wrapped keys. The damage is contained to the compromised key's scope. Revoking the wrapped key immediately stops all access — the attacker must go through the proxy, and the proxy rejects revoked keys. Compare this to a compromised direct provider key, where the attacker has full access to every model at any volume until the key is rotated at the provider level.

Network security. All traffic between applications and the CostHawk proxy uses TLS 1.3. All traffic between the proxy and upstream providers uses TLS 1.2 or higher (dictated by the provider). Certificate pinning is available for enterprise deployments that require it. The proxy does not accept plaintext HTTP connections.

Audit trail. Every administrative action on wrapped keys is logged in an immutable audit trail: key creation (who, when, with what policies), policy changes (who changed the budget cap from $100 to $500, and when), key revocation (who, when, reason), and usage anomalies (automated flags for unusual patterns). This audit trail supports compliance requirements and provides forensic data for security investigations. The audit log is append-only and cannot be modified or deleted by any user, including administrators.

Defense in depth. The wrapped key security model implements defense in depth — multiple independent security layers that each provide protection even if another layer fails:

LayerProtectionWhat It Prevents
Encryption at restAES-256-CBC with unique IVDatabase breach exposing raw keys
Key isolationProvider key never leaves proxyKey leakage through application logs or code
Budget capsPer-key spending limitsUnlimited spend from compromised keys
Model restrictionsPer-key model allowlistsCompromised key accessing expensive models
Rate limitsPer-key RPM/TPM capsHigh-volume abuse from compromised keys
Audit loggingImmutable action logUndetected unauthorized administrative changes
TLS in transitTLS 1.3 for all connectionsMan-in-the-middle interception of keys or data

No single layer is sufficient on its own, but together they create a security posture that significantly exceeds what is possible with direct provider key management. The proxy architecture makes this layered security practical — implementing the same controls in every consuming application would require massive code duplication and constant maintenance.

FAQ

Frequently Asked Questions

Are wrapped keys compatible with all LLM provider SDKs?+
Yes, wrapped keys are compatible with any SDK or HTTP client that allows you to customize the base URL and API key. This includes all official provider SDKs: OpenAI's Python and Node.js SDK (set base_url or baseURL), Anthropic's Python and TypeScript SDK (set base_url or baseURL), Google's Generative AI SDK (configure endpoint), and all popular open-source libraries like LangChain, LlamaIndex, and Vercel AI SDK. The proxy accepts requests in the same format as the upstream provider and returns responses in the same format, so no code changes are needed beyond the base URL and API key configuration. For HTTP clients making raw requests (fetch, axios, curl), simply change the URL and Authorization header. Streaming, function calling, tool use, vision inputs, and all other provider features work identically through the proxy.
What happens if I exceed a wrapped key's budget cap?+
When a wrapped key's spend reaches its configured budget cap, the proxy immediately begins rejecting new requests with a 429 Too Many Requests response and a descriptive error message: "Budget limit exceeded for this key. Daily limit: $100.00, current spend: $100.02." The rejection happens at the proxy layer before the request reaches the provider, so no additional provider tokens are consumed. In-flight requests that were forwarded before the cap was reached will complete normally — the cap is checked at request initiation, not at response completion, so a request that pushes spend $0.02 over the cap will not be cancelled mid-stream. Your application should handle this 429 response gracefully, either by surfacing a user-facing message or by falling back to an alternative key with remaining budget. CostHawk sends an alert when a key reaches 80% of its budget, giving you time to increase the cap or investigate unexpected spend before requests start being rejected.
Can I use the same wrapped key across multiple applications?+
Technically yes, but it is not recommended. Using the same wrapped key across multiple applications collapses their cost data into a single attribution stream, which defeats the purpose of per-service cost tracking. If three services share one wrapped key and the key's monthly spend is $5,000, you cannot determine which service is responsible for which portion of that cost. Instead, generate a unique wrapped key for each application. CostHawk has no limit on the number of wrapped keys per provider key, so there is no cost or technical penalty for creating granular keys. The only overhead is organizational: you need a naming convention and a process for creating keys when new services are deployed. A convention like ch_{team}_{service}_{environment}_sk_... scales well and makes dashboards self-documenting. The one exception is when multiple instances of the same service (horizontal scaling) share a key — this is fine because all instances represent the same cost center.
How do wrapped keys handle provider key rotation?+
This is one of the most compelling operational benefits of wrapped keys. When you rotate the underlying provider key, you update it in CostHawk's dashboard — one change, one place. All wrapped keys that reference that provider key immediately begin using the new key on their next request. No consuming applications need to be updated, no deployments need to be triggered, no configuration files need to change. The wrapped keys themselves do not change; only the provider key they map to is updated. Compare this to rotating a direct provider key: you must update the key in every secrets manager, trigger redeployments of every service, and verify that every service has picked up the new key — a process that can take hours for large organizations and risks service disruptions if any service is missed. With wrapped keys, provider key rotation is a 30-second operation with zero risk of service disruption. CostHawk also tracks provider key age and can send automated reminders when a key is due for rotation based on your configured rotation schedule.
What is the performance overhead of using wrapped keys?+
Wrapped keys add 5–15 milliseconds of latency per request. This overhead comes from three operations: wrapped key validation against the database (1–3ms with connection pooling and in-memory caching of recently validated keys), policy evaluation including budget check, model allowlist check, and rate limit check (1–3ms), and HTTP request construction and forwarding (3–5ms for connection reuse, up to 10ms for cold connections). The response relay from provider to client adds negligible overhead because it is streamed in real time — each SSE chunk is forwarded as soon as it arrives. Post-request logging is asynchronous and adds zero latency to the client response. For context, a typical LLM inference takes 200–2,000ms depending on the model and output length, so a 10ms proxy overhead represents 0.5–5% of the total request duration. In user-facing applications where perceived latency matters, this overhead is imperceptible. CostHawk monitors proxy overhead separately and targets sub-20ms at the P99 level.
Can I migrate from direct API keys to wrapped keys without downtime?+
Yes, the migration can be done with zero downtime using a rolling deployment strategy. First, add your provider keys to CostHawk and generate wrapped keys for each service. Second, update each service's configuration to use the wrapped key and CostHawk base URL. Deploy the change using your normal rolling deployment process — as each instance restarts, it picks up the new configuration and begins routing through CostHawk. Instances still running the old configuration continue to call the provider directly until they are recycled. During the transition, some requests go through CostHawk (new instances) and some go directly to the provider (old instances). CostHawk's dashboard shows increasing traffic as instances roll over. Once all instances are updated, 100% of traffic flows through CostHawk. The entire migration is backward-compatible: if you need to revert, simply change the configuration back to the direct provider key and base URL. There is no lock-in. You can even run a shadow period where some services use wrapped keys and others use direct keys — CostHawk tracks the wrapped key traffic while you verify that the proxy meets your latency and reliability requirements.
How do wrapped keys work with serverless functions?+
Wrapped keys work seamlessly with serverless functions (AWS Lambda, Vercel Functions, Cloudflare Workers, Google Cloud Functions). Set the wrapped key and CostHawk base URL as environment variables in your serverless function configuration, and use them when initializing the provider SDK. The proxy handles the rest. One consideration for serverless environments is cold start latency: the first request from a new function instance includes the overhead of establishing an HTTP connection to the CostHawk proxy (~50–100ms for TLS handshake). Subsequent requests from the same instance reuse the connection and see the standard 5–15ms overhead. For latency-sensitive serverless functions, you can use connection keep-alive and SDK instance reuse across invocations to minimize cold start impact. CostHawk's proxy supports HTTP keep-alive and connection pooling, so warm function instances maintain persistent connections. For Vercel and Cloudflare Workers, the CostHawk proxy is deployed at edge locations to minimize geographic latency between your function and the proxy.
What data does CostHawk log when I use wrapped keys?+
By default, CostHawk logs only metadata — not the content of your prompts or responses. The default log record for each request includes: timestamp, wrapped key ID, provider, model name, input token count, output token count, computed cost (based on current model pricing), latency (time to first byte and total duration), HTTP status code, and any custom tags associated with the wrapped key. This metadata is sufficient for comprehensive cost tracking, anomaly detection, and budget enforcement without exposing sensitive prompt content. Full request and response body logging is available as an opt-in feature for teams that need it for debugging, evaluation, or compliance purposes. When enabled, request and response bodies are encrypted at rest with the same AES-256-CBC encryption used for provider keys, and access is controlled by role-based permissions. Data retention is configurable: 7 days, 30 days, 90 days, or custom. Most CostHawk customers keep the default metadata-only logging, which provides all the cost visibility they need while minimizing data handling obligations.

Related Terms

AI Cost Glossary

Put this knowledge to work. Track your AI spend in one place.

CostHawk gives engineering teams real-time visibility into every token, every model, and every dollar across your AI stack.