LLM-provider compatible APIs

Foundry provides proxy endpoints for popular LLM providers, accepting requests in the same format as the providers' native APIs. This enables use of open-source SDKs and tooling while benefiting from Foundry capabilities such as rate limiting, data governance, and usage tracking.

The currently supported provider APIs and corresponding Foundry endpoints are as follows:

Beta endpoints

The xAI and Google (Gemini) endpoints are currently in beta and actively being developed. Not all features or fields may be supported yet.

Prerequisites

To use Palantir-provided language models, ensure that:

Request shapes

Authentication is sent using the following bearer token header:

Authorization: Bearer {FOUNDRY_TOKEN}

Requests to these endpoints should have the same shape as the corresponding provider endpoint. Refer to the provider’s documentation for the expected request format.

The Google streamGenerateContent proxy endpoint currently only supports the SSE response format, so you must provide the alt=sse query parameter.

Some providers, for example, Anthropic, use a non-standard authentication header. When using their SDKs, you may need to configure the authentication method to use a bearer token instead. Providers that already use bearer token authentication, such as OpenAI, require no special configuration.

Session affinity and prompt caching

For Anthropic Messages, OpenAI Chat Completions, and OpenAI Responses, you can set the optional X-Palantir-session-id header to group related requests into a session. Foundry uses this identifier to route requests to the same model provider backend where possible, which can improve prompt cache hit rates.

For Anthropic requests, set X-Palantir-session-id alongside any session identifier your Anthropic or Claude Code client already uses. The Palantir header controls Foundry's routing affinity; provider or client session identifiers do not replace it on these public endpoints.

Reuse a session identifier only for related requests that share a common prompt prefix, such as turns in the same conversation. Use different identifiers for unrelated conversations. Sharing one identifier across unrelated traffic can concentrate requests on one backend without a caching benefit.

Use an opaque identifier shorter than 256 characters. Routing affinity is best-effort: requests might move to another backend to stay available, and affinity expires after a period of inactivity. The header does not guarantee a cache hit or replace the provider's prompt caching requirements.

For example, set FOUNDRY_HOSTNAME to your Foundry hostname, FOUNDRY_TOKEN to your token, and SESSION_ID to your conversation's identifier. Save a valid Anthropic Messages request ↗ in request.json, using the model's resource identifier for the model field:

Copied!
1 2 3 4 5 6 curl --request POST \ "https://$FOUNDRY_HOSTNAME/api/v2/llm/proxy/anthropic/v1/messages" \ --header "Authorization: Bearer $FOUNDRY_TOKEN" \ --header "Content-Type: application/json" \ --header "X-Palantir-session-id: $SESSION_ID" \ --data @request.json

Keep the same SESSION_ID when sending subsequent requests in that conversation.

AIP integration and data governance

These endpoints enforce the same data governance as other AIP usage, such as zero data retention (ZDR) and georestriction requirements. We selectively enable provider API features that are compatible with these requirements.

Only models and providers that have been enabled on your enrollment will be available through these endpoints. For models served by multiple providers, requests will only be routed to enabled providers. Endpoint usage is visible in the Resource Management application, and is subject to rate limiting.