Create a chat completion
Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes.
Request
A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
Frequency penalty (-2.0 to 2.0)
Number of top log probabilities to return (0-20)
Maximum tokens (deprecated, use max_completion_tokens)
Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
Presence penalty (-2.0 to 2.0)
Stop sequences (up to 4)
Sampling temperature (0-2)
Nucleus sampling parameter (0-1)
Debug options for inspecting request transformations (streaming only)
Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.