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

# Connect Langfuse to CometAPI

> Use this guide to connect Langfuse to CometAPI by setting the base URL, API key, and model or provider options.

[Langfuse](https://langfuse.com/) provides LLM observability, prompt management, playgrounds, and evaluation workflows. Configure a Langfuse LLM Connection with CometAPI when you want Langfuse Playground or LLM-as-a-Judge evaluations to call CometAPI models.

## Prerequisites

* A Langfuse Cloud project or a self-hosted Langfuse instance
* A CometAPI account with an active API key — [get yours in the dashboard](https://www.cometapi.com/console/token)
* At least one CometAPI model ID selected from the [CometAPI Models page](/overview/models)

## Configure the integration

<Steps>
  <Step title="Create a Langfuse LLM connection">
    In Langfuse, open **Project Settings** → **LLM Connections**. Start the flow for adding an LLM API key.
  </Step>

  <Step title="Choose the OpenAI adapter">
    Select **OpenAI** as the provider. Langfuse uses this adapter for model providers that support the OpenAI API schema.
  </Step>

  <Step title="Enter CometAPI credentials">
    Configure the connection with these values:

    | Field            | Value                                                                   |
    | ---------------- | ----------------------------------------------------------------------- |
    | API key          | Your CometAPI API key                                                   |
    | Base URL         | `https://api.cometapi.com/v1`                                           |
    | Custom model IDs | One or more model IDs from the [CometAPI Models page](/overview/models) |

    If Langfuse exposes the base URL field under **Advanced Settings**, expand that section before saving the connection.
  </Step>

  <Step title="Test in Playground">
    In Langfuse Playground, select the CometAPI LLM connection and one of the configured model IDs. Send a short prompt to confirm that Langfuse receives a response.
  </Step>
</Steps>

## Use CometAPI for LLM-as-a-Judge

Langfuse LLM-as-a-Judge evaluators can use the same LLM connection. Select the CometAPI connection in the evaluator configuration, then choose a model ID that supports tool calling if your scoring prompt requires structured extraction.

Use provider options only when the selected CometAPI model supports those request fields. For model discovery, use the [CometAPI Models page](/overview/models) or the `/v1/models` API.

## Troubleshooting

<AccordionGroup>
  <Accordion title="The model is not visible in Langfuse">
    Add the exact CometAPI model ID to the custom model IDs list in the LLM connection. Langfuse does not discover every model automatically for custom OpenAI-compatible providers.
  </Accordion>

  <Accordion title="The request uses the wrong API path">
    Use `https://api.cometapi.com/v1` as the base URL. Langfuse appends the OpenAI-compatible path for the selected adapter.
  </Accordion>

  <Accordion title="Evaluator calls fail">
    Confirm that the selected model supports the request features used by the evaluator, such as tool calling or JSON output.
  </Accordion>
</AccordionGroup>

## Related resources

* [Langfuse LLM Connections](https://langfuse.com/docs/administration/llm-connection)
* [CometAPI quick start](/overview/quick-start)
* [CometAPI Models page](/overview/models)

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "HowTo",
        "@id": "https://apidoc.cometapi.com/integrations/langfuse#howto",
        "name": "Connect Langfuse to CometAPI",
        "description": "Use this guide to connect Langfuse to CometAPI by setting the base URL, API key, and model or provider options.",
        "step": [
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/langfuse#step-1",
            "position": 1,
            "name": "Create a Langfuse LLM connection",
            "text": "Complete the Create a Langfuse LLM connection step in the Connect Langfuse to CometAPI guide."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/langfuse#step-2",
            "position": 2,
            "name": "Choose the OpenAI adapter",
            "text": "Complete the Choose the OpenAI adapter step in the Connect Langfuse to CometAPI guide."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/langfuse#step-3",
            "position": 3,
            "name": "Enter CometAPI credentials",
            "text": "Complete the Enter CometAPI credentials step in the Connect Langfuse to CometAPI guide."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/langfuse#step-4",
            "position": 4,
            "name": "Test in Playground",
            "text": "Complete the Test in Playground step in the Connect Langfuse to CometAPI guide."
          }
        ]
      },
      {
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "CometAPI Docs",
            "item": "https://apidoc.cometapi.com/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "Integrations",
            "item": "https://apidoc.cometapi.com/integrations"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "Connect Langfuse to CometAPI",
            "item": "https://apidoc.cometapi.com/integrations/langfuse"
          }
        ]
      }
    ]
    }
    `}
</script>
