Availability
Native API operations are available from Tyk AI Studio 2.3.0.
Overview
The vendor-native endpoint serves SDK features that are not a singlePOST request with a model field. The gateway applies the same model checks, filters, budgets, and analytics to these operations as to a synchronous call.
Each App owns the resources that it creates. The gateway signs batch, file, response, and conversation IDs for the App and the LLM, for example
msgbatch_01Hk….t1k3f2a9c1d.9b…. Use an ID exactly as the gateway returns it.
Another App, another LLM, or a changed ID gets 404, and the request does not go to the vendor. Lists show only the resources of the calling App.
Anthropic Message Batches
The SDK methodsclient.messages.batches.create, retrieve, list, cancel, results, and delete of the Message Batches API work on the vendor-native endpoint of an Anthropic LLM.
The gateway checks each request in a batch:
- The
params.modelof each request must be an allowed model of the LLM. If not, the gateway returns403with thecustom_idof the request. - Batches need a direct grant for the LLM. A grant through a failover waterfall or a Model Router gets
403. Plugin upstream overrides do not apply to batch calls. - The request filters of the LLM run on each request. If a filter blocks one request, the gateway refuses the full batch with
400. The batch does not go to Anthropic. - The gateway refuses a body with a duplicate key with
400, for example twomodelkeys, ormessagesandMessages.- The same rule applies to a synchronous
/v1/messagescall. - Keys that differ only in case inside tool schemas or tool call inputs are allowed.
- The same rule applies to a synchronous
- The response filters run on each line of the results. A blocked line comes back as an
erroredresult with the samecustom_id. - On an LLM with response plugins, a results download returns
501. A plugin that changes response bodies cannot process a streamed results file.
anthropic-version, anthropic-beta, content-type, accept, and x-request-id headers, and only the beta query parameter. For workspaces, refer to Anthropic Workspace.
The gateway records usage and applies budgets:
- A batch create goes through the same budget check as a synchronous call.
- The gateway records the usage of a batch one time, when a client first downloads the results. If no client downloads them, a background reconciler on the gateway that created the batch records the usage.
- The gateway prices the usage at the batch tier.
- The gateway never charges a batch two times. If the database connection drops just after the gateway marks a batch as recorded, the gateway can lose its usage.
- On Edge Gateways,
listshows only the batches that the edge created. Only the edge that created a batch can delete it. Other gateways return409. - AI Studio replicas share one list.
- You cannot delete a batch that is in progress (
409). For an ended batch, the gateway records the usage first, then deletes the batch.
results_url of a batch points to the gateway, and the gateway streams the results line by line. To get an absolute URL, set PROXY_URL on AI Studio or GATEWAY_PUBLIC_URL on the Edge Gateway. Without these variables, results_url is a path such as /v1/messages/batches/{id}/results, which the Python and TypeScript SDKs resolve against their base URL.
AI Studio signs batch IDs with the signing key of the LLM. To revoke open IDs, rotate the signing key. Refer to Rotate the Native API Signing Key. Standalone Edge Gateways sign with the API key.
Anthropic Token Counting
Claude Code callsclient.messages.count_tokens before most turns. The gateway checks these calls in the same way as a synchronous call:
- The
modelmust be an allowed model (403if not). - The request filters of the LLM run on the request.
- The gateway logs the call. The call does not count against budgets.
OpenAI Responses and Conversations
For OpenAI LLMs, the vendor-native endpoint supports these SDK methods:- Responses API:
client.responses.create,retrieve,cancel,delete, andinput_items.list - Conversations API:
client.conversations.create,retrieve,update,delete, anditems
resp_67cc….t1k3f2a9c1d.9b…. The signed id and previous_response_id appear in JSON responses and in every streamed event. Use them exactly as the gateway returns them.
- A request that uses the response of another App gets
404, and the request does not go to OpenAI. This applies toprevious_response_id, to retrieve, cancel, and delete, and toresponses.input_tokensandresponses.compact. - The gateway does not accept response IDs from versions before 2.3.0 as
previous_response_id. Start a new chain. - Each Responses call must contain
model, because the gateway checks the model against the allowed models of the LLM. A call withoutmodelgets400(model field is required). This includes a call that uses the model of a stored prompt, or that names only a conversation. - The gateway removes the
OpenAI-OrganizationandOpenAI-Projectheaders from every Responses request. Responses always stay in the project of the API key of the LLM.
instructions- A string
input, or the text of each input item: messages, tool call outputs, tool call arguments, and the text of built-in items such as MCP call results, code interpreter logs, and reasoning summaries promptvariables
- On an LLM with request filters, the gateway refuses some requests with
400. This applies when the gateway cannot read the prompt fields, or to an unknown input item type. - The filters do not screen attached files.
input_fileparts, including base64 PDFs, pass without a check. The gateway sends afile_idin aninput_fileorinput_imagepart to OpenAI without a check.
usage, with cached input tokens at the cache price. For a background response (background: true), the gateway that created it records the usage one time, when the response ends:
- A background reconciler polls the response. If you delete the response, the gateway records the usage first.
- Only the gateway that created a background response can delete it, after it ends (
409if not). Any gateway can delete other responses. - The gateway does not support a resumed background stream (
retrieve(..., stream=True)) and returns400. Poll the response instead.
/v1/embeddings, /v1/completions, and /v1/moderations requests (input, prompt, and suffix). The filters cannot screen inputs in token array format. On an LLM with request filters, the gateway refuses these inputs with 400.
OpenAI Batches and Files
For OpenAI LLMs, the Batch API works on the vendor-native endpoint with these SDK methods:client.files.create(file=..., purpose="batch"),content,retrieve,list, anddelete. The gateway ignores thepurposeandorderparameters offiles.list.client.batches.create,retrieve,list, andcancel
- The upload size limit is NATIVE_API_MAX_BODY_BYTES. On an LLM with filters, the file can contain at most NATIVE_API_MAX_FILTERED_ITEMS requests.
- The
body.modelof each request must be an allowed model. If not, the gateway returns403with thecustom_id. - The request filters of the LLM run on each body. If a filter blocks one request, the gateway refuses the upload.
- The gateway refuses a line with a duplicate key, an unsupported
url, or a method other thanPOSTwith400. - The gateway accepts only
purpose="batch"uploads, in the multipart format that the OpenAI SDKs send. It refuses other multipart encodings with400. It also refuses a file name that contains a backslash or a double quote.
400 in these cases:
- The request filters changed after the upload, for example when an administrator attached or edited a guardrail.
- A client uploaded the file before v2.3.0.
- On Edge Gateways, the batch create goes to a different edge from the upload. Create the batch through the edge that received its file.
409). On Edge Gateways, only the edge that created a file or batch lists and deletes it.
Native API Settings
These environment variables apply to AI Studio and to the Edge Gateway. An unset value or0 keeps the default.
For the Edge Gateway, refer to NATIVE_API_* in the Edge Gateway environment variables.
The
aistudio_native_* metrics count these operations. Refer to Prometheus and OpenTelemetry Metrics.