When to use it
Use the RunInfra SDK
You want scoped RunInfra keys, pipeline IDs, typed errors, request IDs, replay-safe retries, streaming helpers, deployment-gated audio/image helpers, and webhook verification in one client.
Use the OpenAI SDK
You already have OpenAI-compatible code and only need to swap
base_url, API key, and model ID.Install
Base URL and pipeline ID
Use a workspace-scoped key when possible. It reaches every verified deployment in your workspace and selects the target withmodel.
Use a pipeline-scoped key or pipelineId when you want one client locked to one optimized pipeline.
Supported operations
| Modality | SDK operation | OpenAI-compatible route | Notes |
|---|---|---|---|
| LLM and vision-language | chat.completions.create() | POST /v1/chat/completions | Streaming, tools, structured output. |
| LLM and vision-language | responses.create() | POST /v1/responses | Chat-completions compatibility adapter for supported Responses-style input. |
| Embeddings | embeddings.create() | POST /v1/embeddings | Batched vector response. Sent once by the SDK even when you provide an idempotency key. |
| Text to speech | audio.speech.create() | POST /v1/audio/speech | Returns binary audio. Configure the deployment-supported voice or reference-audio mode. Sent once by the SDK even when you provide an idempotency key. |
| Speech to text | audio.transcriptions.create() | POST /v1/audio/transcriptions | Multipart audio upload. Sent once by the SDK even when you provide an idempotency key. |
| Voice pipeline | voice.pipeline.create() | Native /pipeline helper | Pipeline-scoped helper for co-located audio-to-response deployments. Not an OpenAI-compatible route. |
| Rerank | rerank.create() | Native POST /v1/rerank or POST /v1/{pipelineId}/rerank helper | Reranker helper for verified TEI text deployments and compatible vLLM vision rerank deployments. Flat workspace /v1/rerank requests are replay-safe with an idempotency key; pipeline-scoped rerank snippets are sent once. |
| Image generation | images.generate() | POST /v1/images/generations | Returns OpenAI-shaped image data from verified image deployments. Sent once by the SDK even when you provide an idempotency key. |
| Discovery | models.list() / models.retrieve() | GET /v1/models / GET /v1/models/{model} | Free model discovery for verified active deployments. |
| Webhooks | TypeScript webhooks.verifySignature() / constructEvent(), Python webhooks.verify_signature() / construct_event() | Local helper only | Delivery routes are not public yet. Verification helpers are available now. |
Streaming chat
responses.create() or chat.completions.create() with an idempotency key when you need automatic replay-safe retries.
Responses adapter
RunInfra/v1/responses is a chat-completions compatibility adapter. The gateway converts supported input and instructions fields into chat messages, forwards the request through the chat-completions serving path, then wraps the result in a Responses-shaped envelope. It does not implement full OpenAI Responses state, include, reasoning, tool, conversation-item, or background-job semantics.
Idempotency headers
responses.create(), non-streaming chat.completions.create(), and flat workspace rerank.create() calls are currently auto-retry replay-safe when you provide an idempotency key. Audio, embeddings, image generation, streaming, and voice-pipeline requests are sent once even when you provide an idempotency key. Pipeline-scoped rerank requests are also sent once. Keep SDK maxRetries / max_retries at 0 for any cost-sensitive operation outside the replay-safe chat, Responses, and flat rerank helpers.
Audio and images
- Text to speech
- Speech to text
- Images
- Rerank
TypeScript
Errors and retries
SDK errors carrystatus, type, and requestId when the gateway provides one. Gateway errors expose requestId, type, code, and param when the API returns OpenAI-style code and param metadata.
Automatic retries are limited to transient failures and replay-safe requests. Safe GET requests can retry transient failures. Charge-bearing POST inference requests retry only when an idempotency key is present and the helper is known replay-safe. Only responses.create(), non-streaming chat.completions.create(), and flat workspace rerank.create() are currently auto-retry replay-safe.
The SDK does not blindly retry streaming requests, embeddings, image generation, pipeline-scoped rerank, binary TTS responses, multipart ASR uploads, or binary voice-pipeline requests. ASR file must be non-empty before the SDK builds a multipart upload.
Do not rely on Idempotency-Key to deduplicate audio, image, embedding, pipeline-scoped rerank, streaming, or voice-pipeline requests. For those operations, use X-Client-Request-Id for tracing and design client retries so a repeated request may run again.
Webhook verification
Public webhook delivery is not enabled yet, but local verification helpers are available so your handlers can be written before delivery is turned on.Next steps
OpenAI compatibility
Use the OpenAI SDK against the same gateway.
Authentication
Create scoped keys and understand workspace versus pipeline access.
API reference
Endpoint-by-endpoint parameters and response fields.
Rate limits
Per-key limits and retry headers.