SPB Git

Repository Public

models.md 6.2 KB 135 lines markdown

1# Models and providers23> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.45Every SDK run eventually resolves a model and a transport. Most applications should keep that setup straightforward: choose models explicitly, use the standard OpenAI path by default, and reach for provider or transport overrides only when the workflow actually needs them.67## Start with explicit model selection89In production, prefer explicit model choice over whichever runtime default your SDK release happens to ship with.1011- Set `model` on an agent when that specialist consistently needs a different quality, latency, or cost profile.12- Set a run-level default when one workflow should override several agents at once.13- Set `OPENAI_DEFAULT_MODEL` when you want a process-wide fallback for agents that omit `model`.1415Set models per agent and per run1617```javascript18import { Agent, Runner } from "@openai/agents";1920const fastAgent = new Agent({21  name: "Fast support agent",22  instructions: "Handle routine support questions.",23  model: "gpt-5.6-terra",24});2526const generalAgent = new Agent({27  name: "General support agent",28  instructions: "Handle support questions carefully.",29});3031const runner = new Runner({32  model: "gpt-6-astra",33});3435await runner.run(fastAgent, "Summarize ticket 123.");36const result = await runner.run(37  generalAgent,38  "Investigate the billing issue on account 456."39);4041console.log(result.finalOutput);42```4344```python45import asyncio4647from agents import Agent, RunConfig, Runner4849fast_agent = Agent(50    name="Fast support agent",51    instructions="Handle routine support questions.",52    model="gpt-5.6-terra",53)5455general_agent = Agent(56    name="General support agent",57    instructions="Handle support questions carefully.",58)596061async def main() -> None:62    await Runner.run(fast_agent, "Summarize ticket 123.")6364    result = await Runner.run(65        general_agent,66        "Investigate the billing issue on account 456.",67        run_config=RunConfig(model="gpt-6-astra"),68    )69    print(result.final_output)707172if __name__ == "__main__":73    asyncio.run(main())74```757677For most new SDK workflows, start with [`gpt-6-astra`](https://developers.openai.com/api/docs/models/gpt-6-astra) and move to a smaller variant only when latency or cost matters enough to justify it. Use the platform-wide [Model guidance](https://developers.openai.com/api/docs/guides/latest-model) page for current model-selection advice.7879## Choose the simplest default strategy8081| If you need                                    | Start with                | Why                                                                                  |82| ---------------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------ |83| One explicit model per specialist              | Set `model` on each agent | The workflow stays readable in code and traces                                       |84| One fallback across a whole process            | `OPENAI_DEFAULT_MODEL`    | Agents that omit `model` still resolve predictably                                   |85| One workflow-level override                    | A run-level default       | You can swap models for a script, worker, or environment without editing every agent |86| Different model sizes across the same workflow | Mix per-agent models      | A fast triage agent and a slower deep specialist can coexist cleanly                 |8788If your team cares about the exact default, don't rely on the SDK fallback. Set it yourself.8990## Providers and transport9192| Need                                                    | Start with                                                        |93| ------------------------------------------------------- | ----------------------------------------------------------------- |94| Standard SDK runs on OpenAI                             | The default OpenAI provider path                                  |95| Many repeated Responses model round trips over a socket | Responses WebSocket transport in the SDK                          |96| Non-OpenAI models or a mixed-provider stack             | The provider or adapter surface in the language-specific SDK docs |9798Two distinctions matter:99100- The Responses WebSocket transport still uses the normal text-and-tools agent loop. It's separate from the voice session path.101- Live audio sessions over WebRTC or WebSocket are for low-latency voice or image interactions. Use [Voice agents](https://developers.openai.com/api/docs/guides/voice-agents) and the [live audio API guide](https://developers.openai.com/api/docs/guides/realtime) for that path.102103Exact provider configuration, provider lifecycle management, and transport helper APIs remain language-specific material. Keep those details in the SDK docs instead of duplicating them here.104105## Model settings, prompts, and feature support106107Model choice is only part of the runtime contract.108109- Use `modelSettings` in TypeScript or `model_settings` in Python for tuning such as reasoning effort, verbosity, and tool behavior.110- Use `prompt` when you want a stored prompt configuration to control the run instead of embedding the full system prompt in code.111- Some SDK features depend on the OpenAI Responses path rather than older compatibility surfaces, so check the SDK docs when you need advanced tool-loading or transport features.112113Keep the model contract close to the agent definition when it's intrinsic to that specialist. Move it to a workflow-level default only when a group of agents should share the same runtime choice.114115## Next steps116117Once the runtime contract is clear, continue with the guide that matches the rest of the workflow design.118119120121  [Agent definitions122123124125        Keep model choices aligned with the responsibilities of each specialist.](https://developers.openai.com/api/docs/guides/agents/define-agents)126  [Running agents127128129130        See how transport and model choices affect the runtime loop.](https://developers.openai.com/api/docs/guides/agents/running-agents)131  [External models132133134135        Compare broader provider options when a mixed-model stack matters.](https://developers.openai.com/api/docs/guides/external-models)
Files main
Menu

Theme