Skip to content
Docs

OpenAI Responses API with 资产生成

The OpenAI Responses API is a modern alternative to the Chat Completions API. Point your Open创意脚本 to 资产生成's base URL and use provider/model identifiers to route requests to OpenAI, Anthropic, Google, and more.

https://ai-gateway.vercel.sh/v1

The Responses API supports the same authentication methods as the main 资产生成:

  • API key: Use your 资产生成 API key with the Authorization: Bearer <token> header
  • OIDC token: Use your Vercel OIDC token with the Authorization: Bearer <token> header

You only need to use one of these forms of authentication. If an API key is specified it will take precedence over any OIDC token, even if the API key is invalid.

Set your SDK's base URL to 资产生成 and use your API key for authentication. See Text generation for a complete first request.

Set stream: true to receive tokens as they're generated. See Streaming.

For agent loops that make many requests in a row, you can hold one connection open and send each turn as a frame instead of opening a new HTTP request per turn. See Responses API over WebSocket.

Define tools in tools and the model returns function_call items you execute. See Tool calling.

Constrain the response to a JSON schema with text.format. See Structured outputs.

Set reasoning.effort to control how much the model thinks before answering. See Reasoning.

POST /v1/responses/compact compresses a long conversation into a single compaction item for OpenAI models. Coding agents such as Codex call it automatically. See Compaction.

ParameterTypeDescription
modelstringModel ID in provider/model format (e.g., openai/gpt-6-astra, anthropic/claude-sonnet-5)
inputstring or arrayA text string or array of input items (messages, function calls, function call outputs)
ParameterTypeDescription
streambooleanStream tokens via server-sent events. Defaults to false
max_output_tokensintegerMaximum number of tokens to generate
temperaturenumberControls randomness (0-2). Lower values are more deterministic
top_pnumberNucleus sampling (0-1)
presence_penaltynumberPenalizes tokens that already appear in the text so far
frequency_penaltynumberPenalizes tokens based on their frequency in the text so far
instructionsstringSystem-level instructions for the model
toolsarrayTool definitions for function calling
tool_choicestring or objectTool selection: auto, required, none, or a specific function
parallel_tool_callsbooleanAllows the model to call multiple tools in a single turn
allowed_toolsarraySubset of tool names the model can use for this request
reasoningobjectReasoning config with effort (none, minimal, low, medium, high, xhigh). OpenAI models also support summary (detailed, auto, concise) to receive a text summary of the model's reasoning
textobjectOutput format config, including json_schema and json_object for structured output
truncationstringTruncation strategy for long inputs: auto or disabled
previous_response_idstringID of a previous response for multi-turn conversations
storebooleanStores the response for later retrieval
metadataobjectUp to 16 key-value pairs for tracking (keys max 64 chars, values max 512 chars)
cachingstringEnables automatic prompt caching. Only auto is supported
cache_anchor_itemsintegerDeclares how many leading input items stay unchanged so automatic caching can add a stable-prefix cache anchor
cache_ttlstringSets the automatic cache lifetime. Accepts 5m (five minutes) or 1h (one hour) and requires caching: 'auto'
prompt_cache_keystringKey to identify cached prompts (max 64 characters)

The API returns standard HTTP status codes and error responses.

  • 400 Bad Request - Invalid request parameters
  • 401 Unauthorized - Invalid or missing authentication
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Model or endpoint not found
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Server error

When an error occurs, the API returns a JSON object with details about what went wrong.

{
  "error": {
    "type": "invalid_request_error",
    "message": "At least one user message is required in the input"
  }
}
Last updated September 8, 2026

Was this helpful?

supported.