Learning resourcesReviewed · Langfuse

Langfuse AI Gateway: send your first request (beta quickstart)

This is a beta quickstart page for developers and teams who want to route coding-agent or SDK calls to OpenAI or Anthropic models through the Langfuse AI Gateway and see traces in Langfuse. Its main catch is that the gateway and a provider connection must already be set up for your organisation, and the gateway is still in public beta and can change. The page covers creating a gateway key, picking a model ID, setup for each of Claude Code, Claude Desktop, Codex, OpenCode, Pi, GitHub Copilot CLI, the OpenAI and Anthropic SDKs, the Vercel AI SDK and plain REST, and then finding the trace.

Researched 14 Nov 2026

In short.

This is the Langfuse documentation page for sending a first request through the Langfuse AI Gateway, which is in public beta. It is written for developers and teams who want coding agents or LLM apps to call OpenAI or Anthropic models through a Langfuse-hosted or self-hosted gateway. Its main catch is that the gateway and a provider connection must already be set up for the organisation, and the product can still change. The steps are: create a personal gateway key, export LANGFUSE_GATEWAY_KEY and LANGFUSE_GATEWAY_HOST, and pick a model ID of the form connection:model. Then point a client at the gateway's /openai or /anthropic route and use the gateway key where a provider key would normally go. The page gives setup for Claude Code, Claude Desktop, Codex, OpenCode, Pi, GitHub Copilot CLI, the OpenAI and Anthropic SDKs (Python and TypeScript), the Vercel AI SDK and a curl REST call. It says requests are recorded as traces in the organisation's ingestion project. The page provides setup examples but no execution results, so it does not establish how they behave at runtime or whether they work with current client releases. This page does not establish costs, the licence, data-handling details or the gateway's wider features.

Researched and written by an AI model and checked by a second AI model. How it works

The documentation page at [https://langfuse.com/docs/gateway/get-started/first-request.md] explains how to create a gateway key, pick a model ID, connect each listed client and find the resulting trace. It leaves admin setup, model ID rules, tracing ingestion modes, API keys, the REST API, error codes and the full guide for each client to linked pages, so anything those pages contain is unknown here. The page contains no licence, terms, pricing or publication date. It provides setup examples but no execution results establishing runtime behaviour or compatibility with current client releases.

The overview

What this resource is

The resource is a single documentation page titled Send your first request, at [https://langfuse.com/docs/gateway/get-started/first-request.md], from the Langfuse documentation. It is a getting-started guide for the Langfuse AI Gateway, which the page labels as being in public beta and says can still change. The page describes its goal as creating a personal gateway API key, connecting a coding agent, SDK or app to the gateway, and seeing the first trace.

It is documentation, not software you install. The gateway itself is a service reached over HTTPS at a regional host (EU, US, Japan or HIPAA region) or at the gateway URL of a self-hosted deployment. The page is a guide to using that service, so it is classed as a learning resource.

Overall assessment

The page is a practical, concrete quickstart. It gives copy-ready commands and config for many clients and warns explicitly about several pitfalls. Examples include leaving /v1 off the Anthropic base URL for Claude Code, unsetting ANTHROPIC_API_KEY to avoid a 401 error, and the fact that an existing ~/.copilot/providers.json overrides the Copilot environment variables.

The main caveats are these. The gateway is in beta and the page says it can still change. The page assumes the gateway and at least one provider connection are already set up for the organisation. It also says little about cost, data handling or limits. Ingestion modes, which decide what a trace records, are only linked, not explained. The page gives commands and configurations but no execution results, so their runtime behaviour and their compatibility with current client releases are not established.

Who it is for

The page suits developers and platform teams in an organisation that uses Langfuse and wants one keyed entry point for LLM calls. Those calls might come from tools such as Claude Code, Codex, OpenCode, Pi or GitHub Copilot CLI, or from application code using the OpenAI SDK, Anthropic SDK or Vercel AI SDK. It also suits people who simply want their calls traced in Langfuse without changing much application code.

It is less useful for someone who has no Langfuse organisation or whose admin has not enabled the gateway. The page tells those readers to ask an admin to follow a separate Set up the gateway page, which is not covered here. Beginners can follow the numbered steps, but they need to be comfortable with shell environment variables and with editing JSON or TOML config files.

What it lets you do

According to the page, you can create a personal gateway API key in the Langfuse UI (AI Gateway, then Gateway keys). You can list the models you can call, either in the UI (AI Gateway, Connections and Models, Models) or through the gateway's /openai/v1/models and /anthropic/v1/models endpoints. You can send requests from several coding agents and SDKs, and view the resulting trace under Tracing in the organisation's ingestion project.

Two provider-shaped routes are shown. The OpenAI route (under /openai/v1) is used for the OpenAI SDK, Codex, the Vercel AI SDK and a curl call to chat/completions. The Anthropic route (under /anthropic) is used for Claude Code, Claude Desktop, OpenCode, Pi, GitHub Copilot CLI and the Anthropic SDK. The REST example says the response is OpenAI's own response and that its headers include langfuse-trace-id, the ID of the trace the gateway recorded.

The page does not describe any other gateway features, such as routing, fallbacks, rate limits, caching or guardrails. It only links to feature pages such as API keys, models, REST API and tracing. This page does not establish whether any of those features exist beyond what is linked.

Using it

Requirements

Access: you need the AI Gateway, Member, Admin or Owner organisation role to create gateway keys. Viewers cannot create them. For CI or a shared service, the page says to ask an admin for a service account key. To see traces, you need Viewer access or above on the organisation's ingestion project.

Organisation setup: the gateway must already be set up for your organisation, and at least one provider connection must exist. If the Models page says No connections yet, the page says to ask your admin. The Claude Code, Claude Desktop, OpenCode, Pi and GitHub Copilot examples each say an ANTHROPIC provider connection is required. Codex needs an OPENAI provider connection.

Client versions stated on the page: Claude Code 2.1 or later, Codex CLI 0.157 or later, OpenCode 2.0 or later, Pi 1.5.0 or later. No versions are given for GitHub Copilot CLI, Claude Desktop or the SDKs.

Tooling: you need a shell with curl for the REST and model-list examples. Node and npm are needed to install Pi (npm install -g @earendil-works/pi-coding-agent) and for the TypeScript SDK examples. pip is needed for the Python SDKs. Supported Python or Node versions are not stated.

How it works

As the page describes it, the gateway works as a drop-in proxy. You keep using your usual client but change its base URL to the gateway host plus a provider route, and you supply the Langfuse gateway key where a provider key would normally go. The gateway then forwards the request to the provider connection your organisation configured and records a trace in Langfuse.

Authentication differs by client. The OpenAI-style route uses an Authorization: Bearer header. The Anthropic model-list example uses an x-api-key header plus an anthropic-version header. Claude Code uses ANTHROPIC_AUTH_TOKEN, which the page says is sent as Authorization: Bearer. Claude Desktop is set to the Bearer scheme.

Models are named in the form connection:model, for example openai-prod:<model>. The page says to add the connection's name as a prefix when you call a model, and points to a Model IDs page for which form to send. It does not explain how the gateway picks a provider, retries requests or handles streaming.

What a trace records depends on the organisation's ingestion mode, which the page links to but does not explain. This page does not say which fields are captured, how long data is kept or where it is stored.

Setup steps

Step 1: In the Langfuse UI, go to AI Gateway, then Gateway keys, and select Create key. Export LANGFUSE_GATEWAY_KEY and LANGFUSE_GATEWAY_HOST. The hosts given are [https://gateway.cloud.langfuse.com] (EU), [https://gateway.us.cloud.langfuse.com] (US), [https://gateway.jp.cloud.langfuse.com] (Japan) and [https://gateway.hipaa.cloud.langfuse.com] (HIPAA region). If you self-host, use your own deployment's gateway URL.

Step 2: Pick a model ID by filtering by connection on the Models tab, or call the models endpoints. The page says a successful model list also confirms that the key works.

Step 3: Point a client at the gateway. For Claude Code, run claude /logout, set ANTHROPIC_BASE_URL to the host plus /anthropic (no /v1), set ANTHROPIC_AUTH_TOKEN to the gateway key, and unset ANTHROPIC_API_KEY. Codex needs a model_providers.langfuse table in ~/.codex/config.toml with a base_url ending in /openai/v1, env_key set to LANGFUSE_GATEWAY_KEY and wire_api set to responses. OpenCode needs a provider override in opencode.json, and any stored OpenCode account connection must be removed. Pi needs a provider entry in ~/.pi/agent/models.json. GitHub Copilot CLI uses COPILOT_PROVIDER_BASE_URL, COPILOT_PROVIDER_TYPE, COPILOT_PROVIDER_API_KEY and COPILOT_MODEL. Claude Desktop is configured through Developer, then Configure Third-Party Inference. The SDK examples set the base URL and API key in code.

Step 4 (optional): Open the organisation's ingestion project in Langfuse and go to Tracing to see the request.

Several config examples hard-code the EU host. The page says to use your own region's host if it differs. The OpenCode and Claude Desktop instructions in particular rely on menu and config details that could change, and the page gives no execution results establishing that they match current client releases.

Worked example from the page

The simplest example on the page is the REST call: curl -si "$LANGFUSE_GATEWAY_HOST/openai/v1/chat/completions". It sends an Authorization: Bearer header carrying the gateway key and a JSON body containing a model ID and a user message saying Say hello. The page says the response is OpenAI's own response and that its headers include langfuse-trace-id.

For Claude Code, the page shows: claude /logout; export ANTHROPIC_BASE_URL as the gateway host plus /anthropic; export ANTHROPIC_AUTH_TOKEN as the gateway key; unset ANTHROPIC_API_KEY; then claude -p "Reply with: hello gateway". For Codex, after the config.toml change, the test is codex exec "Reply with exactly: PONG".

In the SDK examples, the model value is a <model-id> placeholder. Replace it with a connection-prefixed ID from the previous step. Apart from its short description of the REST response, the page shows no execution output, so what the examples actually return at runtime is unknown.

Assessment & evidence

Limitations and risks

Beta status: the page says the gateway is in public beta and can still change, so endpoints, UI paths, client config formats and behaviour may shift. Client requirements are tied to specific tool versions, which also change over time.

Role and setup prerequisites: to create a personal gateway key you need the AI Gateway, Member, Admin or Owner organisation role. Viewers cannot create keys. The gateway must already be set up for the organisation, with at least one provider connection of the type your client needs. To see traces you need Viewer access or above on the ingestion project. Without these roles and this setup in place, a reader cannot complete the steps. For those cases the page points to an admin and a separate admin setup page.

Data handling: prompts and responses pass through the gateway, either a Langfuse cloud host or your own self-hosted deployment, and traces are recorded in Langfuse. What is stored depends on the ingestion mode, which this page does not detail. Teams with sensitive data should read the tracing and data-handling documentation before routing real traffic. The page lists a HIPAA region host but makes no compliance claim, and none should be assumed from it.

Security-relevant steps: the Claude Desktop instructions suggest adding * to Allowed egress hosts so Claude can reach services such as GitHub. That widens the set of network destinations Claude Desktop may reach. The gateway key is a credential, and the examples put it in environment variables or config files, so treat it like any other API key.

Coverage gaps: the page only shows OpenAI and Anthropic routes. It does not establish support for other providers, streaming, tool calling or rate limits, and for errors it only points to a troubleshooting page. The Claude Code steps start with claude /logout, which logs out of any Claude subscription. If you rely on that login, be aware of this before running it.

Reasoning behind the assessment

The page is specific and actionable. It names exact environment variables, config files, header schemes and role requirements, and it warns about concrete causes of failure. That makes it a useful guide rather than marketing copy. Its subject, routing generative AI and coding-agent traffic through a gateway with tracing, is directly relevant to developers working with LLMs.

Several factors limit confidence in the page. The gateway is labelled beta and can still change, and the page contains no pricing or licence text. The page provides setup examples but no execution results, so it does not establish their runtime behaviour or whether the documented steps work with current client releases.

Alternatives

The page does not compare alternative products or tracing approaches, so their capabilities and suitability are unknown here.

Within the page, you can choose between the gateway's OpenAI route and its Anthropic route, depending on your client and provider connection. You can also list models either in the UI or through the API.

Evidence base

The source is the complete documentation page at [https://langfuse.com/docs/gateway/get-started/first-request.md]. It includes the setup steps, instructions for each client and a pointer to troubleshooting. It ends with a section aimed at AI agents that points to Langfuse's documentation search endpoint, index files, the Langfuse Agent Skill and the Langfuse CLI.

The page leaves details about model IDs, ingestion modes, API keys, roles, the REST API, error codes and the individual client guides to linked pages, so those topics rest only on the short descriptions on this page. The page contains no pricing, licence, publication date or data-retention details. It provides setup examples but no execution results establishing runtime behaviour or compatibility with current client releases.

Access & freshness

Costs

The page states no prices, quotas, free tier or billing terms for the gateway, for Langfuse itself or for the underlying model providers. What the gateway costs is unknown from this page.

Gateway fees, provider charges, who pays them, quotas and beta pricing are all unknown from this page. Check Langfuse's pricing and your provider agreements before relying on the gateway.

Rights and licence

The page contains no licence, terms of use or reuse statement for the documentation or its code snippets. Reuse rights for the page content are therefore unknown.

The page shows that a self-hosted gateway URL is possible, but it does not say under what licence or edition the gateway can be self-hosted. It does not cover terms for the hosted gateway either. Anyone who needs to copy or redistribute the content should check Langfuse's own terms and licence information.

Freshness

This description reflects the page as of 14 November 2026. The page shows no publication or last-updated date, so its age is unknown. It is explicitly labelled beta and says the product can still change.

The minimum client versions given (Claude Code 2.1, Codex CLI 0.157, OpenCode 2.0, Pi 1.5.0) reflect the page as of that date. The page gives no execution results establishing whether newer client releases still match the documented config. Compare against the live page and each client's current documentation.

Suggested next steps

Before starting, check that the gateway is set up for your organisation and that a provider connection of the right type (ANTHROPIC or OPENAI) exists. If not, the page says to ask an admin. Also confirm that your role can create gateway keys and, if you want to see traces, that you have Viewer access or above to the ingestion project.

Start with the smallest test. Create a key and call the model-list endpoint to confirm the key and host work. Then send one short prompt with curl or one SDK before changing a coding agent's configuration. Note the langfuse-trace-id and langfuse-request-id response headers for debugging.

Before routing real work, read the linked tracing page on ingestion modes to learn what is stored, and check pricing and provider billing. Decide whether granting * egress in Claude Desktop is acceptable. Keep the gateway key out of source control, and use a service account key for CI as the page advises. Check the page again for changes while the gateway remains in beta.

Evidence for this report

selected-page.txtselected · checked 2026-11-14