Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,56 @@ def with_letta(
tool_choice=NOT_GIVEN,
)

@staticmethod
def with_synthorai(
*,
model: str = "claude-opus-5",
api_key: str | None = None,
base_url: str = "https://synthorai.io/v1",
client: openai.AsyncClient | None = None,
user: NotGivenOr[str] = NOT_GIVEN,
temperature: NotGivenOr[float] = NOT_GIVEN,
parallel_tool_calls: NotGivenOr[bool] = NOT_GIVEN,
tool_choice: ToolChoice = "auto",
reasoning_effort: NotGivenOr[ReasoningEffort] = NOT_GIVEN,
safety_identifier: NotGivenOr[str] = NOT_GIVEN,
prompt_cache_key: NotGivenOr[str] = NOT_GIVEN,
top_p: NotGivenOr[float] = NOT_GIVEN,
) -> LLM:
"""
Create a new instance of Synthorai LLM.

``api_key`` must be set to your Synthorai API key, either using the argument or by setting
the ``SYNTHORAI_API_KEY`` environmental variable.

Synthorai provides access to 122 models from multiple providers including Anthropic,
OpenAI, Google, Z.ai, Moonshot, DeepSeek, and Qwen through a unified, OpenAI-compatible API.

Get your API key at: https://synthorai.io
Learn more: https://synthorai.io/docs
"""

api_key = api_key or os.environ.get("SYNTHORAI_API_KEY")
if api_key is None:
raise ValueError(
"Synthorai API key is required, either as argument or set SYNTHORAI_API_KEY environmental variable" # noqa: E501
)

return LLM(
model=model,
api_key=api_key,
base_url=base_url,
client=client,
user=user,
temperature=temperature,
parallel_tool_calls=parallel_tool_calls,
tool_choice=tool_choice,
reasoning_effort=reasoning_effort,
safety_identifier=safety_identifier,
prompt_cache_key=prompt_cache_key,
top_p=top_p,
)

def chat(
self,
*,
Expand Down
Loading