# Keep model costs in check with LangSmith LLM Gateway <!-- ref: @content/youtube/langchain/keep-model-costs-in-check-with-langsmith-llm-gateway tags: [LLM gateway, token cost control, spending limits, API key management, model provider routing, audit and usage] version: 2 updated_at: 2026-11-24T06:14:46.116Z --> **[Watch on YouTube](https://www.youtube.com/watch?v=VBZgp1sHosE)** # Keep model costs in check with LangSmith LLM Gateway *Synthesized from Jacob Lee on LangChain, 2026-08-14.* Jacob Lee, presenting on the LangChain channel, walks through the LangSmith LLM Gateway in a short screen-recorded walkthrough of its key creation, provider routing, spending limits and usage views. ## Core Thesis Jacob Lee argues that when many teams hold their own model API keys, token spend becomes impossible to attribute until the bill arrives. The LangSmith LLM Gateway is meant to sit in front of all providers as one access point, so cost and speed limits are applied before a request is sent rather than discovered afterward. ## Key Insights - **One control point.** The gateway sits between the organization and providers such as OpenAI, Anthropic, Fireworks and Together, so every team's requests pass through one place where access and spend can be managed and revoked. - **Minimal code change.** Applications keep the same SDK; only the base URL and API key change. The demo's run request was made live from the browser and returned a response from GPT-4o in a few seconds. - **Spend limits at several scopes.** Limits can be set for a single API key, a user, a workspace, or the whole organization. The demo used an artificially low 1-cent organization-wide limit to show the behavior. - **Blocked, not billed.** Once the limit was reached, requests failed with an error stating the request was blocked by the gateway policy due to a spending limit, and the organization was not billed for them. Turning the limit off let the same queries pass again. - **Audit by key, team and app.** The usage view shows requests by key and user, with the model, token count and cost per request, so a finance question about which key or app drove spend can be answered from the gateway rather than from separate provider dashboards. - **Provider credentials stay in the gateway.** Provider accounts are added to the gateway, which authenticates with them for authorized requests. ## Actionable Takeaways 1. Create a gateway API key for each consumer and add the provider credentials to the gateway rather than distributing provider keys to teams. 2. Set spending limits centrally at the key, user, workspace or organization level instead of relying on each team to cap its own usage. 3. Point existing SDK clients at the gateway base URL and the new key, then check traces in LangSmith. 4. Use the usage breakdown by model, key and token count to answer cost questions per team or agent. ## Notable Quotes > "One access point to all providers with cost and speed limits applied before sending a request" — Jacob Lee > "I just used a different base URL and a different API key, without changing my application's request or response handling." — Jacob Lee > "You don't need to trust an individual team or individual project to set their own spending limits." — Jacob Lee --- *Related: `@content/youtube/david-ondrej/tailscale-clearly-explained-beginners-guide` · `@content/youtube/aie/why-your-ai-agent-needs-a-wallet-usdc-and-nanopayments-harshal-bhangale-circle`* --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*