udf chat_completions()
openrouter, key rate_limit). If no rate limit is configured, uses a default of 600 RPM.
Requirements:
pip install openai
messages(Json): A list of messages comprising the conversation so far.model(String): ID of the model to use (e.g., ‘anthropic/claude-3.5-sonnet’, ‘openai/gpt-4’).model_kwargs(Json | None): Additional OpenAI-compatible parameters.tools(Json | None): List of tools available to the model.tool_choice(Json | None): Controls which (if any) tool is called by the model.provider(Json | None): OpenRouter-specific provider preferences (e.g., {‘order’: [‘Anthropic’, ‘OpenAI’]}).transforms(Json | None): List of message transforms to apply (e.g., [‘middle-out’]).
Json: A dictionary containing the response in OpenAI format.