Skip to content
Lucas Lessa
Back to news
SnowflakePublic PreviewImpact: Medium

OpenAI Responses API support in Cortex REST API

You can now call OpenAI models using the OpenAI-compatible Responses API on the Cortex REST API and Cortex AI Gateway within Snowflake's governance perimeter.

What changed

Snowflake released preview support for the Responses API endpoint on both the Cortex REST API and Cortex AI Gateway. This allows applications built around OpenAI's Responses API specification to access supported OpenAI models directly within Snowflake.

Use cases

Imagine you maintain microservices or tools designed specifically for OpenAI's Responses API specification and want to migrate execution into Snowflake without refactoring clients to the Chat Completions format. You can:

  • Point official OpenAI SDKs or compatible clients to your Snowflake account endpoint.
  • Run inference against OpenAI models while keeping queries within Snowflake's governance boundaries.
  • Centralize token monitoring and access control using Snowflake database roles.

How to use

You can configure the OpenAI SDK to use the Cortex REST API base endpoint (/api/v2/cortex/v1) or the Cortex AI Gateway (/v1/responses) using a Snowflake Programmatic Access Token (PAT) for authentication.

from openai import OpenAI

client = OpenAI(
  api_key="<SNOWFLAKE_PAT>",
  base_url="https://<account-identifier>.snowflakecomputing.com/api/v2/cortex/v1"
)

response = client.responses.create(
  model="openai-gpt-5.6-sol",
  instructions="You are a helpful assistant.",
  input="How does a snowflake get its unique pattern?",
  store=False,
)

print(response.output_text)

What happens in this code:

  1. The OpenAI client initializes with the Snowflake Cortex REST API base URL and your PAT credentials.
  2. The client.responses.create call submits the target model, system instructions, and input query.
  3. Setting store=False disables prompt persistence, and the output text is read from response.output_text.

You can also execute the call via cURL:

curl "https://<account-identifier>.snowflakecomputing.com/api/v2/cortex/v1/responses" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <SNOWFLAKE_PAT>" \
  -d '{
    "model": "openai-gpt-5.6-sol",
    "input": "How does a snowflake get its unique pattern?",
    "store": false
  }'

What happens in this code:

  1. A POST request is sent to the Cortex /responses endpoint with the PAT token in the Bearer authorization header.
  2. The JSON payload specifies the desired OpenAI model and the text input.
  3. The service evaluates the prompt and returns the output JSON directly.

Limitations and requirements

  • Stage: Public preview, enabled across all accounts.
  • Supported models: Restricted to OpenAI models only (Claude models use the /messages endpoint, and general models use /chat/completions).
  • Stateless behavior: The API does not persist conversation state; the full conversation must be passed inside input on each request.
  • Unsupported options: Neither previous_response_id nor background execution mode is supported.
  • Authorization: The executing user's default role must have either SNOWFLAKE.CORTEX_USER or SNOWFLAKE.CORTEX_REST_API_USER database role assigned.
  • Observability: Usage is not logged to AI_OBSERVABILITY_EVENTS; monitor credits and token usage through the CORTEX_REST_API_USAGE_HISTORY view in the ACCOUNT_USAGE schema.
Read the official Snowflake note

Responses API for the Cortex REST API (Preview)

Summary and explanation generated by AI from the official release note. When in doubt, the platform's official documentation prevails.

Related