Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

Connect to a Published Service

Call a published service from your own app, from the built-in chat, from an OpenAI-compatible chat client, or from a Model Context Protocol (MCP) client. The service endpoint stays the same when you publish a new pipeline version.


About This Task​

A service is a stable endpoint that runs the pipeline version you published in Gateway. Send queries with one of the chat APIs:

  • Chat returns one JSON response when the run finishes. Conversation history comes from a search session.
  • Chat Stream uses the same conversation model and sends the answer as Server-Sent Events (SSE) while it is generated.
  • Chat Completions uses the OpenAI Chat Completions contract, so OpenAI-compatible clients can call the service.

You can also share a prototype link for the built-in chat, turn the service on as an MCP tool, or connect a Slack bot. For Slack setup, see Connect a Service to Slack.

Prerequisites​

Get the Service Endpoint​

  1. In Haystack Enterprise Platform, click Gateway and open the service you want to call.
  2. Click Connect.
  3. Under API format, select the format you want to use. Select Completions API for OpenAI-compatible clients.
  4. In the Endpoint card, copy the URL.

Authenticate with a workspace API key as a Bearer token in the Authorization header. To create or manage keys from this page, click Manage API keys. Store API keys in a secrets manager and never expose them in client-side code.

If OAuth with DCR is enabled, a client can register itself and sign in with OAuth instead of an API key.

Test the Service in the Chat Panel​

To check how a service answers before you wire it into an app, use the Test this service panel on the Connect tab. The panel sends messages to the live service, so each test counts toward your usage.

  1. In Haystack Enterprise Platform, click Gateway and open the service.
  2. Click Connect, and open the Test this service panel.
  3. Choose a test mode:
    • Chat lets you hold a conversation. Type a message in the Message this service field, or click an example message.
    • API request sends the request for the API format you selected under API format, so you can see what your app would send and receive.
  4. Send a message. To interrupt a reply, click Stop. When the reply arrives, copy it, or click Details to open the response inspector.

The panel tests the API format you selected on the Connect tab, which affects how follow-up messages behave:

  • With Chat Stream, follow-up messages continue the same session.
  • With Completions API, your app keeps the conversation, so every message sends the full history. There is no chat history to reopen, because the service doesn't store the conversation.

The panel shows which revision the service is running. While a new revision rolls out, a test can reach either the current or the new one.

Manage Chats and Attach Files​

  • To start over, click New chat.
  • To continue an earlier conversation, open Recent chats and select a chat. A conversation that is too long to reopen in the panel is available in the service history.
  • To send a file along with a message, click Attach files, or drop files into the panel. The service must accept files, and you need permission to upload files to the workspace. With Completions API, files travel inside the request, so each file can be up to 5 MB. Larger files aren't attached.

To let someone without platform access query the service, see Use the Chat Interface.

Choose a Chat Endpoint​

To pick between the Chat, Chat Stream, and Chat Completions endpoints, see Choose a Chat Endpoint.

Record Where a Pushed Revision Came From​

When you push a revision from code, you can attach an optional source_metadata object to the request, so reviewers can see which commit and file the revision came from. For the request that pushes a revision, see the REST API reference for revisions. The platform stores the object next to the revision and returns it as source_metadata in the revision response.

The client reports these values and the platform doesn't verify them. All fields are optional, and other top-level keys are ignored:

  • git: The origin in version control. It holds repo (normalized, for example github.com/org/repo, up to 300 characters), branch (up to 255), sha (up to 64), and dirty, which is true when the working tree had uncommitted changes.
  • file: The repository-relative path of the source file, up to 1,024 characters.
  • ci: True when an automated pipeline made the push.
  • custom: A free-form JSON object for your own metadata, up to 8,192 characters when serialized. It can't contain NaN values.

The platform rejects a request when a value exceeds its limit.

The source information doesn't change the revision's config hash and never reaches the running service.

Connect OpenAI-Compatible Clients​

You can point an OpenAI-compatible chat client, such as Thunderbolt or Open WebUI, at Chat Completions and use the service as a hosted model.

Thunderbolt logo
Thunderbolt
Open WebUI logo
Open WebUI

In the client, set the base URL to the Chat Completions endpoint for your workspace and choose the model ID for the service. Authenticate with a workspace API key, or with OAuth and DCR when the client supports it and DCR is enabled. If the client can fetch models, use List Models so it can discover the workspace's services. For a walkthrough of Open WebUI, Thunderbolt, and the Vercel AI SDK, see Tutorial: Connecting OpenAI-Compatible Clients to a Service. Chat Completions doesn't support client-side tool calling, so a client can't pass its own tools to the service.

Use the Chat Interface​

Query a service in the built-in chat without calling the API yourself.

  1. In Haystack Enterprise Platform, click Gateway and open the service.
  2. On Overview, click Share prototype.
  3. Generate a link and open it. Anyone with the link can query the service in a chat page. If you can't generate a link, check that you have permission to share services in the workspace.

The Test & share card on Overview also has a Share a test link action for the same link.

To set the link expiration, require login, turn on filters, and apply your logo and colors, see Share a Service.

To create links that run the same service with different settings, such as one link per document collection, add default runtime parameters to each link. See Set Default Runtime Parameters for a Service Link.

Use the Service as an MCP Tool​

Turn on a service as an MCP tool so MCP-capable AI assistants, such as Claude Code or Cursor, can call it directly.

To turn on a service as a tool:

  1. In Haystack Enterprise Platform, click Gateway and open the service.
  2. Click Settings.
  3. In the MCP tool section, turn on Use as MCP tool.

The service is immediately available to AI assistants connected to your Gateway MCP server. To connect a client, see Use Your Services as MCP Tools.

Test the Service in Gateway​

Send a request from the browser to confirm the service responds as you expect.

  1. In Haystack Enterprise Platform, click Gateway and open the service.
  2. Click Connect.
  3. Under Try it, check the API format and response mode. For pipelines with chat or generative output, they match your selections under Endpoint. To test another combination, change either setting.
  4. Edit the sample request if needed.
  5. Click Send request. A successful run returns the service's response. If the request fails, check that a pipeline version is published to the service, that you have read permission for services, and that your quota isn't used up.

If you switch the response mode after editing the sample request, the response mode overrides any stream value in the request body. Test requests hit the live service and count against your quota.

What To Do Next​