When to use this runbook
Use when an agent needs to discover currently available Salad AI Gateway models or send one OpenAI-compatible chat completion using an existing organization-specific AI Gateway key.When not to use it
Do not use this runbook to create an account, organization, credit balance, or API key; operate a self-hosted Container Engine model; run an unapproved load test; or automatically repeat a request whose outcome or charge is uncertain.Required inputs
SALAD_AI_GATEWAY_API_KEY, containing the organization-specific AI Gateway key and supplied only through a secret environment variable. Do not substitute the user-levelSALAD_API_KEYused with theSalad-Api-Keyheader.- The intended prompt or messages, expected output, and authorization to send their content to the selected model.
- An exact model ID or enough approved capability/cost criteria to select one from the live model list.
- Whether streaming is required and a caller-defined attempt and elapsed-time budget.
- Any tool definitions or image inputs. Treat prompts, conversation history, tool arguments/results, images, and model output as potentially sensitive.
Authoritative sources
This repository does not currently contain an OpenAPI specification for Salad AI Gateway. Do not infer unsupported
request fields, response fields, idempotency, retry guarantees, or model availability from the SaladCloud public API
specification, a different OpenAI-compatible provider, an SDK type alone, or an example.
Dynamic values to retrieve
- Live model IDs from
/v1/modelsimmediately before model selection. - Current response status, headers, server-provided retry guidance, and response body for the exact request.
- Published input/output rates when cost affects selection; do not treat an old copied price as current.
- Response usage metadata when the live response supplies it.
Preflight checks
- Confirm the credential is an AI Gateway key and will be sent only as a Bearer token to
ai.salad.cloud. - Confirm prompts, messages, images, tool definitions, and conversation history are authorized for processing and will not be printed in logs or returned as evidence unless explicitly requested.
- Call
GET /v1/models. If the requested model ID is absent, stop or ask the user to approve a live alternative. - Check the published rates when model cost is part of the decision.
- Use the smallest documented request that satisfies the task. Do not copy provider-specific fields without evidence that Salad AI Gateway supports them.
- Define the expected output, streaming mode, attempt budget, and stop condition before sending the billable request.
Procedure
Discover live models
Send one non-streaming request
stream to true only when the caller can consume and preserve partial
output safely. A disconnected stream can have an uncertain final outcome and charge.
Decision rules
Expected states and responses
The model-list request should return200 and a live catalog. A non-streaming chat completion should return 200 and
an OpenAI-compatible response containing the generated choice. Streaming returns a sequence of events rather than one
complete JSON response.
An accepted or partially streamed request is billable work, not an idempotent resource mutation. The service exposes no
read endpoint that can reconcile whether an uncertain chat completion finished after the client disconnected.
The key and pay-per-token access conditions are checked at request admission. Requests already admitted can complete and
are billed even if the key is revoked or regenerated, or organization credits run out during generation. Do not use key
deletion or rotation as cancellation, and do not assume these events make an uncertain completion safe to retry.
Retry behavior
RetryGET /v1/models only for plausible transient transport, 429, or server failures within the declared budget.
Honor Retry-After when present. Do not blindly retry authentication, authorization, validation, or model-not-found
responses.
Do not automatically retry POST /v1/chat/completions after an uncertain transport failure, timeout, server failure, or
partial stream. A retry can produce a different answer and another charge. A new attempt requires either clear evidence
that the prior request was rejected before processing or explicit caller acceptance of duplicate billable work.