client.prompts.render(slug, **options) resolves a prompt for the client’s project_id and env in a single request. Set format — on the client or per call — to get a result shaped for that provider; omit it to get the neutral result. It is the primary runtime method.
format, label, subject, variables, fallback, and on_unknown_role: label picks the label to resolve for this call (defaulting to the client’s env — env is a label value), format overrides the client default, subject (a stable id) pins a weighted release to a variant, and fallback is served on a transient network or 5xx failure. The return shape is fixed by the call’s format, not by the network outcome. Authored developer blocks render as-is; the SDK maps them per provider (OpenAI keeps developer, Anthropic folds them into system). on_unknown_role ("drop" default, "warn", or "error") sets how a message with an unrecognized role is handled during provider conversion — see Unknown roles.
Shaped result
With aformat, render returns a dict you can spread straight into a provider request. format="openai" returns {"messages", "config", "metadata"}; format="anthropic" returns {"system", "messages", "config", "metadata"} — the authored system and developer instructions are folded into a top-level system string, which Anthropic takes as a separate request field. When the prompt authors tools, the result also carries provider-shaped tools and tool_choice.
Spread the result into the request, and pass the whole result to
turn().headers(prompt) for the provenance headers:
Neutral result and converters
Omitformat (on both the client and the call) to get the neutral RenderedPrompt dataclass: messages, tools, tool_choice, prompt_id, version, version_id, release_id, variant_name, content_hash, label, slug, and block_render_record. The version’s model config is exposed as model_config_ — the trailing underscore avoids Pydantic’s reserved model_config attribute. This is the path for a provider the shaper does not cover (Vercel AI, LangChain) or for driving one prompt through more than one provider.
The to11ai_sdk.gateway module converts a neutral result into a provider’s request shape:
gateway_auth_headers and gateway_prompt_headers are also importable from the main to11ai_sdk entry. With a format, render applies the message conversion for you, so most apps never call the converters directly.
Unknown roles
The message converters recognizesystem, user, assistant, developer, and tool. A message whose role is anything else is handled by the on_unknown_role policy — set it per call, on create_client, or on the converter directly:
render() this matters mainly when you convert your own message arrays (assembled conversation history, messages from another source). on_unknown_role="error" on render() is a way to assert that invariant explicitly.