Search documentation
karat

+

K

User Documentation ↗
Version 3.0Beta

OpenAI Responses (Proxy)

POST /api/v2/llm/proxy/openai/v1/responses

Foundry provides a proxy endpoint that forwards requests to the OpenAI Responses API ↗. This enables the use of open-source SDKs and tooling while benefiting from Foundry capabilities such as rate limiting, data governance, and usage tracking.

Third-party applications that use this endpoint via OAuth2 must request the api:use-language-models-execute operation scope.

Headers

NameTypeDescription
AuthorizationstringBearer token for authentication.
Content-TypestringMust be application/json.
attributionoptional<string>Comma-separated RIDs for usage attribution to a project. When omitted, all usage will be attributed directly to the calling user.
traceParentoptional<string>W3C Trace Context traceparent header for tracing and observability features. When omitted, in-platform observability features will not function.
traceStateoptional<string>W3C Trace Context tracestate header for tracing and observability features. When omitted, in-platform observability features will not function.
X-Palantir-session-idoptional<string>Opaque identifier grouping requests that belong to one logical session, such as a single multi-turn conversation. Requests sharing a session identifier are routed to the same model provider backend where possible, which improves prompt cache hit rates across the session. Routing affinity is best-effort and is not guaranteed: it may be abandoned to keep a request serviceable, and it lapses after a period of inactivity. Keep the value under 256 characters.

Note that Foundry clients such as the Python SDK and OSDK in the examples below will automatically set attribution, traceParent, and traceState headers.

Request format

This endpoint has the same shape as the OpenAI Responses API. Refer to the OpenAI Responses API documentation ↗ for the full schema.

The model field should be set to the language model's resource identifier, for example ri.language-model-service..language-model.gpt-5-2, which can be found in Model Catalog.

AIP integration and data governance

This endpoint enforces 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. Usage is visible in Resource Management and is subject to rate limiting.

Examples

Bash

Copied!
1 2 3 4 5 6 7 8 curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/llm/proxy/openai/v1/responses" \ -d '{ "model": "ri.language-model-service..language-model.gpt-5-2", "input": "Hello, world" }'

Python

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 from openai import OpenAI from foundry_sdk.v2.language_models.utils import ( get_foundry_token, get_openai_base_url, get_http_client, ) def openai_responses(prompt: str) -> str: # The client returned by get_http_client will automatically propagate # attribution and tracing headers client = OpenAI( api_key=get_foundry_token(preview=True), base_url=get_openai_base_url(preview=True), http_client=get_http_client(preview=True), ) return client.responses.create( model="ri.language-model-service..language-model.gpt-5-2", input=prompt ).output_text

TypeScript

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import OpenAi from "openai"; import { PlatformClient } from "@osdk/client"; export default async function openAiResponses( platformClient: PlatformClient, prompt: string ): Promise<string> { // The PlatformClient fetch function will automatically propagate attribution // and tracing headers const client = new OpenAi({ apiKey: await platformClient.tokenProvider(), baseURL: platformClient.baseUrl + "api/v2/llm/proxy/openai/v1", fetch: platformClient.fetch, }); const response = await client.responses.create({ model: "ri.language-model-service..language-model.gpt-5-2", input: prompt, }); return response.output[0].content[0].text; }