OpenAI Responses API with AISIX: A Multi-Provider Guide

Yilia Lin

Yilia Lin

July 28, 2026

Technology

Key Takeaways

  • AISIX AI Gateway gives applications a stable OpenAI Responses API interface while managing model aliases, provider credentials, routing, and telemetry.
  • OpenAI-backed aliases use the upstream Responses API directly, while supported non-OpenAI providers require protocol translation through gateway adapters.
  • The non-OpenAI bridge supports common text, tool calls, tool results, sampling, and streaming, but it ignores OpenAI-specific state and controls documented below.
  • A model alias decouples application releases from provider changes, but provider-specific features may still require the matching native API family.
  • AISIX supports multiple caller-facing endpoint families and makes compatibility boundaries explicit through documentation, logs, and request-level observability.

AI teams often begin with one provider SDK and one model. The application sends prompts directly to a provider, stores that provider's API key, and assumes its response format.

That coupling becomes expensive when requirements change. A team may need a second provider for availability, a private model for regulated data, or a lower-cost model for routine traffic. Even when providers offer similar capabilities, their authentication, content structures, tool formats, streaming events, and usage fields differ.

The OpenAI Responses API provides a modern caller contract for model responses and tool-enabled workflows. AISIX is API7.ai's open-source, Rust-native AI Gateway for LLM and AI-agent traffic. It can preserve the Responses API contract at the application boundary while translating supported requests to different upstream providers. The application keeps one base URL, one caller credential, and one model alias.

The important word is supported. A gateway can normalize common behavior, but it cannot make every provider-specific feature identical. Production portability depends on understanding and testing those boundaries.

Why the Responses API Changes Gateway Design

Older LLM integrations often treat a gateway as an OpenAI-compatible Chat Completions proxy. The application sends a list of messages to /v1/chat/completions, and the gateway forwards or translates them.

The Responses API covers a broader interaction model. Applications may send structured input, receive typed output items, stream events, invoke tools, and use provider features that do not map one-to-one to a chat message.

The official OpenAI Responses API reference defines the caller contract for OpenAI clients. A multi-provider gateway has to decide which parts can be forwarded unchanged, which parts can be translated, and which parts are provider-specific. AISIX documents those decisions in its dedicated Responses API endpoint guide.

From Provider Integration to a Stable Application Contract

Without a gateway, provider selection is embedded in application code:

  • The service stores an upstream API key.
  • The SDK selects a provider endpoint.
  • The application sends a provider model ID.
  • Retry, logging, and usage logic depend on that provider's response.

With a gateway, applications instead use:

  • A gateway base URL
  • A caller API key
  • A stable model alias
  • A supported caller-facing endpoint such as /v1/responses

The gateway resolves the alias, applies access policy, selects an upstream, uses a protected provider credential, and records what happened. The AISIX request lifecycle documents this separation.

flowchart LR
    A[AI application] -->|Responses API + caller key + alias| G[AISIX AI Gateway]
    G --> I[Identity and model access]
    I --> R[Alias and routing policy]
    R --> O[OpenAI adapter]
    R --> N[Non-OpenAI adapter]
    O --> P1[OpenAI upstream]
    N --> P2[Anthropic, Bedrock, Vertex AI, or another supported upstream]
    G --> T[Gateway logs, usage events, and guardrails]
    G -.->|management and reporting| C[AISIX Cloud usage and cost views, budgets, and audit history]

Chat Completions vs Responses API

Chat Completions remains useful for clients and providers that implement the familiar message-based shape. Responses API is appropriate when an application uses its newer input and output model or needs the OpenAI client surface that is evolving around it.

The choice should be based on application features and provider compatibility, not on a claim that one endpoint automatically works everywhere.

AISIX exposes several supported endpoint families, including OpenAI-compatible Chat Completions, OpenAI Responses API, and Anthropic Messages. That lets teams choose a caller contract that matches their application while keeping gateway controls consistent.

How AISIX Handles the OpenAI Responses API

Three resource types form the core request path in AISIX:

  • A caller API key authenticates the application and controls which model aliases it may use.
  • A model alias is the stable model name in the request.
  • A provider key stores the upstream credential, provider adapter, base URL, and related connection settings.

This resource model keeps application identity separate from provider identity. Rotating an OpenAI key does not require changing application credentials. Moving an alias from one provider to another does not require changing the model name in every service.

Verbatim Forwarding to OpenAI

For an OpenAI-backed model, the gateway can forward a Responses request to the upstream Responses API. This path preserves the provider's native API semantics more directly because the caller and upstream use the same API family.

Gateway controls still apply around the call. The gateway can authenticate the caller, protect the provider key, enforce model access, apply traffic policy, and emit logs and usage events.

Bridging to Non-OpenAI Providers

For a supported non-OpenAI upstream, AISIX can bridge the caller's Responses-shaped request through a provider adapter. The adapter converts portable content to the provider-facing request and returns a Responses-shaped result.

The provider-facing API may be Anthropic, Bedrock, Vertex AI, or another supported family. The application does not need to import each provider SDK, but the adapter can translate only features with a valid representation on both sides.

This is why a compatibility matrix is more useful than a generic "OpenAI compatible" label. Consult the current AISIX provider compatibility documentation before selecting an upstream.

Direct and Bridged Behavior

The upstream path determines which Responses API features survive the request:

CapabilityOpenAI-Backed AliasBridged Non-OpenAI Alias
Text input and outputForwarded to the native Responses APITranslated through the provider adapter
Function-style tool definitions, calls, and resultsNative OpenAI behaviorSupported common representation is translated
Sampling controlsNative OpenAI behaviorSupported common controls are translated
StreamingNative stream through the gatewayProvider stream is converted to Responses events
reasoningPassed throughIgnored
store and previous_response_idPassed throughIgnored
Hosted tools such as web_search, file_search, and code_interpreterPassed through when supported by OpenAI and the selected modelIgnored
text, metadata, service_tier, and other OpenAI-specific controlsPassed throughIgnored when no portable mapping exists

This table describes the AISIX endpoint behavior, not a guarantee that every model supports every feature. Model capabilities and provider compatibility still apply.

Normalizing Responses and Usage

The gateway returns the caller-facing response shape and records the resolved upstream. It can also track latency, errors, tokens, and estimated cost.

Provider-reported token counts are preferred. When an upstream or interrupted stream does not report usage, a gateway may estimate tokens locally so the request remains visible in usage records. In AISIX Cloud, those records can feed centralized usage and cost views and budget governance. Estimates are useful operationally, but they are not exact for every proprietary tokenizer and should be labeled accordingly.

Call the Responses API Through AISIX

Configure a caller API key, provider key, and model alias in AISIX before sending the request. The application then uses the AISIX URL instead of a provider URL and sends the alias instead of an upstream model ID.

curl --request POST 'https://<your-aisix-host>/v1/responses' \ --header 'Authorization: Bearer <caller-api-key>' \ --header 'Content-Type: application/json' \ --data '{ "model": "prod-assistant", "input": "Summarize why API contracts need compatibility tests." }'

The same caller request can target a different supported provider when operators change the alias configuration. Before doing that in production, replay the application's evaluation set against both paths and inspect the resolved model, output items, streaming events, tool behavior, errors, and usage.

What Is Portable Across Providers?

Provider portability is a spectrum. Common text requests are the easiest to move. Provider-specific reasoning state and multimodal details are harder.

Text and Streaming

Plain text input and output have the broadest compatibility. Streaming can also be normalized when both the caller-facing endpoint and provider adapter support it.

Streaming introduces an important reliability boundary. A routing model can retry or select another target before response bytes are sent. Once a stream has started reaching the caller, the gateway cannot transparently switch to a different provider and replay a coherent response.

Applications must therefore handle mid-stream interruption. A gateway can log the failed attempt and protect subsequent retries, but it cannot erase content already delivered.

AISIX preserves the Responses API Server-Sent Events shape on both paths. OpenAI-backed aliases can pass through upstream events, while bridged providers are encoded as Responses events. When output guardrails are enabled, AISIX buffers the stream for inspection before releasing it or returning a policy block, so teams should include that latency in their streaming tests.

Tool Definitions and Tool Calls

Tool definitions, calls, and results are portable only where both API families can represent the required fields. Basic function-style tools often translate well. Provider extensions, strict schema behavior, parallel tool semantics, or built-in provider tools may not.

Test the complete loop:

  1. The application sends tool definitions.
  2. The model returns a tool call.
  3. The application executes the tool.
  4. The tool result is sent back.
  5. The model produces a final response.

For agentic applications, gateway-level tool policy is also relevant. MCP and tool traffic may need caller-specific access, rate limits, guardrails, and audit beyond model protocol translation.

OpenAI-Specific State and Hosted Tools

The bridged path deliberately ignores fields that have no portable provider mapping. Two of the most important are store and previous_response_id.

On an OpenAI-backed path, those fields can participate in OpenAI-managed response storage and continuation. On a bridged path, they are ignored, so an application cannot assume that a provider switch will continue server-side state. Keep portable conversation context in the application and send the required input explicitly, or constrain stateful interactions to an OpenAI-backed alias.

The same boundary applies to the reasoning field and OpenAI-hosted tools such as web_search, file_search, and code_interpreter. They can pass through on an OpenAI-backed path when the selected model supports them. They are not converted into equivalent non-OpenAI services by the bridge.

Treat those fields as provider-bound capabilities. If the application requires one, either keep the alias on a compatible OpenAI model or implement the capability in the application as a portable function-style tool.

Multimodal and Structured Features

Do not infer image, document, or structured-output compatibility from a successful text request. Provider models and adapters vary, and the portable bridge contract is intentionally narrower than the full OpenAI feature surface.

Build explicit fixtures for every content type and schema the application uses. If exact provider behavior is required, use the caller-facing API family that matches that provider or keep the workload on a verified direct path.

Errors and Usage

Providers differ in status codes, error bodies, retry hints, token accounting, and rate-limit metadata. A gateway can normalize part of this surface, but applications should still handle:

  • Authentication and authorization failures
  • Model-not-found or unsupported-feature errors
  • Provider rate limits
  • AISIX Cloud budget rejection or gateway rate-limit rejection
  • Pre-stream upstream failure
  • Mid-stream interruption
  • Missing or estimated usage

Observability should retain both the gateway outcome and upstream attempt details. That makes a "successful" fallback distinguishable from a first-choice provider success.

A Safe Migration Plan

Provider portability should be introduced as an engineering migration, not a configuration toggle.

1. Inventory Application Features

List every API behavior the application uses:

  • Text generation
  • Streaming
  • Tool calling
  • Structured output
  • Images or documents
  • Reasoning controls or history
  • Conversation storage
  • Usage accounting
  • Provider-specific headers or metadata

Mark which features are business-critical and which can degrade.

2. Introduce the Gateway Boundary

Move the application to an AISIX base URL, a caller API key, and a stable model alias. Keep the first upstream provider unchanged. This isolates gateway integration issues from provider translation issues.

AISIX publishes integration guides for SDKs, application frameworks, agent frameworks, and coding tools that can target a custom endpoint.

3. Establish a Baseline

Run functional and load tests through the gateway against the original provider. Compare:

  • Output structure
  • First-token and total latency
  • Streaming event order
  • Tool call arguments
  • Error behavior
  • Token usage
  • Request logs and cost attribution

Fix baseline differences before adding a second provider.

4. Test One Provider Pair

Add one alternate target behind a separate alias. Replay a sanitized evaluation set and compare outcomes. Do not begin with automatic production fallback.

Use a matrix like this:

CapabilityPrimary ProviderAlternate ProviderExpected Behavior
Text responsePassPassEquivalent caller shape
StreamingPassPass with limitsNo switch after stream starts
Tool callsPassValidateSchema and result loop preserved
Images or documentsValidate modelValidate adapterReject or constrain the route explicitly
store or previous_response_idNative OpenAI behaviorIgnoredKeep state client-side or stay on OpenAI
Hosted toolsNative when supportedIgnoredUse portable function tools or stay on OpenAI
UsageReportedReported or estimatedMark estimates

5. Roll Out Gradually

Begin with internal callers or a small traffic segment. Observe provider errors, latency, token usage, tool success, and output quality. Add routing and failover only after the alternate path meets its acceptance criteria.

flowchart TD
    I[Inventory features] --> G[Gateway with original provider]
    G --> B[Baseline compatibility tests]
    B --> A[Add alternate provider alias]
    A --> M[Run feature matrix]
    M --> C{Criteria met?}
    C -->|No| F[Restrict features or fix adapter path]
    F --> M
    C -->|Yes| R[Canary traffic]
    R --> P[Production routing and fallback]

Production Policies Around the Responses API

Protocol translation is only one reason to put an AI Gateway in the request path.

Provider keys should stay out of application code and developer environments. Caller keys should identify applications, teams, or automation profiles and allow only approved model aliases.

Apply request and concurrency limits at the gateway to protect expensive upstream capacity. Use AISIX Cloud budgets to contain runaway usage and spend. Use input and output guardrails for sensitive data or unsafe content. Record the requested alias, resolved provider, attempts, latency, usage, and policy decisions.

These controls connect provider abstraction to enterprise operations. The distinction between an LLM Gateway and a broader AI Gateway becomes practical here: a provider facade is useful, but production traffic also needs identity, cost, security, and audit.

For multi-provider reliability, pair compatibility tests with routing and failover. Keep in mind that a fallback target is valuable only if it supports the features present in the failed request.

Common Mistakes

Assuming OpenAI-Compatible Means Responses-Compatible

Many providers implement /v1/chat/completions but not /v1/responses. A gateway adapter may bridge supported features, but a Chat Completions claim does not establish full Responses API compatibility.

Testing Only Simple Text

A successful "hello world" says nothing about tools, images, reasoning, streaming interruption, or usage accuracy. Test the application's real feature surface.

Hiding Translation Loss

If an adapter drops unsupported content or state, make that behavior explicit in documentation and tests. Silent degradation creates harder production incidents than a clear rejection.

Treating Fallback as Feature Validation

Health checks can show that an endpoint responds. They cannot prove that an alternate model preserves tool behavior, structured output, safety, or quality.

Coupling Aliases to Provider Names

An alias such as prod-support is more durable than openai-gpt-x. Name aliases after the capability or service contract the application expects.

Conclusion

AISIX can give AI applications a stable Responses API interface while providers, credentials, models, and routing policies evolve behind it. That reduces integration duplication and makes provider changes operationally manageable.

The gateway cannot remove real protocol differences. Text, streaming, tools, multimodal content, reasoning state, errors, and usage each have distinct compatibility boundaries. Teams should document those boundaries, test every intended provider path, and roll out changes gradually.

AISIX combines the caller-facing Responses API with model aliases, protected provider credentials, routing, traffic controls, guardrails, and telemetry. Use the provider compatibility matrix as the source of truth, then validate your own application feature set.

Explore AISIX AI Gateway and route your first Responses API workload through a stable model alias before introducing a second provider.

Tags:
Share article link