mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-29 11:23:49 +08:00
Merge branch 'main' into fix/chat-transient-retries
This commit is contained in:
+980
-483
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -36,7 +36,7 @@ generation:
|
||||
documentation: mintlify
|
||||
preApplyUnionDiscriminators: true
|
||||
python:
|
||||
version: 0.11.3
|
||||
version: 0.11.33
|
||||
additionalDependencies:
|
||||
dev: {}
|
||||
main: {}
|
||||
|
||||
+1665
-207
File diff suppressed because it is too large
Load Diff
+1583
-189
File diff suppressed because it is too large
Load Diff
@@ -2,8 +2,8 @@ speakeasyVersion: 1.787.0
|
||||
sources:
|
||||
OpenRouter API:
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:5381277309ba2f3a4a3e0719b00425be3f93c3103717316e6625bd5caf15b277
|
||||
sourceBlobDigest: sha256:def8d29511aca594e11c3367b7013a64c8733cc8050e23deae98d9cc5df55c93
|
||||
sourceRevisionDigest: sha256:1b18bfafe3a31635470908ce53c1bb12af21a82d371f6f979bb5e8463f52afb3
|
||||
sourceBlobDigest: sha256:506597a9fce25fe757037a95da952e36f33dd702afa16c13d43c2df2d5da1ece
|
||||
tags:
|
||||
- latest
|
||||
- 1.0.0
|
||||
@@ -11,10 +11,10 @@ targets:
|
||||
open-router:
|
||||
source: OpenRouter API
|
||||
sourceNamespace: open-router-chat-completions-api
|
||||
sourceRevisionDigest: sha256:5381277309ba2f3a4a3e0719b00425be3f93c3103717316e6625bd5caf15b277
|
||||
sourceBlobDigest: sha256:def8d29511aca594e11c3367b7013a64c8733cc8050e23deae98d9cc5df55c93
|
||||
sourceRevisionDigest: sha256:1b18bfafe3a31635470908ce53c1bb12af21a82d371f6f979bb5e8463f52afb3
|
||||
sourceBlobDigest: sha256:506597a9fce25fe757037a95da952e36f33dd702afa16c13d43c2df2d5da1ece
|
||||
codeSamplesNamespace: open-router-python-code-samples
|
||||
codeSamplesRevisionDigest: sha256:18d6fc594c9338480cbc65842c3f276ad0a58f2ceda311aff3d70ea33dbd6e6d
|
||||
codeSamplesRevisionDigest: sha256:7ae639df01271894474a52b709810943afd11f8d9acde069336e9a1f8588ec56
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: 1.787.0
|
||||
|
||||
+3
-3
@@ -189,7 +189,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.byok.list()
|
||||
res = open_router.byok.list(offset=0, limit=50)
|
||||
|
||||
while res is not None:
|
||||
# Handle items
|
||||
@@ -221,10 +221,10 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.files.upload(file={
|
||||
res = open_router.stt.create_transcription_multipart(file={
|
||||
"file_name": "example.file",
|
||||
"content": open("example.file", "rb"),
|
||||
})
|
||||
}, model="openai/whisper-large-v3", language="en")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
@@ -189,7 +189,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.byok.list()
|
||||
res = open_router.byok.list(offset=0, limit=50)
|
||||
|
||||
while res is not None:
|
||||
# Handle items
|
||||
@@ -221,10 +221,10 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.files.upload(file={
|
||||
res = open_router.stt.create_transcription_multipart(file={
|
||||
"file_name": "example.file",
|
||||
"content": open("example.file", "rb"),
|
||||
})
|
||||
}, model="openai/whisper-large-v3", language="en")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
+301
-1
@@ -138,4 +138,304 @@ Based on:
|
||||
### Generated
|
||||
- [python v0.11.3] .
|
||||
### Releases
|
||||
- [PyPI v0.11.3] https://pypi.org/project/openrouter/0.11.3 - .
|
||||
- [PyPI v0.11.3] https://pypi.org/project/openrouter/0.11.3 - .
|
||||
|
||||
## 2026-07-07 14:30:37
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.4] .
|
||||
### Releases
|
||||
- [PyPI v0.11.4] https://pypi.org/project/openrouter/0.11.4 - .
|
||||
|
||||
## 2026-07-07 17:24:44
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.5] .
|
||||
### Releases
|
||||
- [PyPI v0.11.5] https://pypi.org/project/openrouter/0.11.5 - .
|
||||
|
||||
## 2026-07-07 19:09:09
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.6] .
|
||||
### Releases
|
||||
- [PyPI v0.11.6] https://pypi.org/project/openrouter/0.11.6 - .
|
||||
|
||||
## 2026-07-07 21:46:35
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.7] .
|
||||
### Releases
|
||||
- [PyPI v0.11.7] https://pypi.org/project/openrouter/0.11.7 - .
|
||||
|
||||
## 2026-07-08 03:29:04
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.8] .
|
||||
### Releases
|
||||
- [PyPI v0.11.8] https://pypi.org/project/openrouter/0.11.8 - .
|
||||
|
||||
## 2026-07-08 07:00:39
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.9] .
|
||||
### Releases
|
||||
- [PyPI v0.11.9] https://pypi.org/project/openrouter/0.11.9 - .
|
||||
|
||||
## 2026-07-08 09:31:18
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.10] .
|
||||
### Releases
|
||||
- [PyPI v0.11.10] https://pypi.org/project/openrouter/0.11.10 - .
|
||||
|
||||
## 2026-07-08 19:07:22
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.11] .
|
||||
### Releases
|
||||
- [PyPI v0.11.11] https://pypi.org/project/openrouter/0.11.11 - .
|
||||
|
||||
## 2026-07-09 10:13:53
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.12] .
|
||||
### Releases
|
||||
- [PyPI v0.11.12] https://pypi.org/project/openrouter/0.11.12 - .
|
||||
|
||||
## 2026-07-09 17:12:18
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.13] .
|
||||
### Releases
|
||||
- [PyPI v0.11.13] https://pypi.org/project/openrouter/0.11.13 - .
|
||||
|
||||
## 2026-07-09 17:28:34
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.14] .
|
||||
### Releases
|
||||
- [PyPI v0.11.14] https://pypi.org/project/openrouter/0.11.14 - .
|
||||
|
||||
## 2026-07-09 18:16:05
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.15] .
|
||||
### Releases
|
||||
- [PyPI v0.11.15] https://pypi.org/project/openrouter/0.11.15 - .
|
||||
|
||||
## 2026-07-09 19:48:43
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.16] .
|
||||
### Releases
|
||||
- [PyPI v0.11.16] https://pypi.org/project/openrouter/0.11.16 - .
|
||||
|
||||
## 2026-07-09 21:34:56
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.17] .
|
||||
### Releases
|
||||
- [PyPI v0.11.17] https://pypi.org/project/openrouter/0.11.17 - .
|
||||
|
||||
## 2026-07-10 01:18:52
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.18] .
|
||||
### Releases
|
||||
- [PyPI v0.11.18] https://pypi.org/project/openrouter/0.11.18 - .
|
||||
|
||||
## 2026-07-10 15:41:48
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.19] .
|
||||
### Releases
|
||||
- [PyPI v0.11.19] https://pypi.org/project/openrouter/0.11.19 - .
|
||||
|
||||
## 2026-07-10 20:14:59
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.20] .
|
||||
### Releases
|
||||
- [PyPI v0.11.20] https://pypi.org/project/openrouter/0.11.20 - .
|
||||
|
||||
## 2026-07-10 23:01:43
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.21] .
|
||||
### Releases
|
||||
- [PyPI v0.11.21] https://pypi.org/project/openrouter/0.11.21 - .
|
||||
|
||||
## 2026-07-11 03:19:26
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.22] .
|
||||
### Releases
|
||||
- [PyPI v0.11.22] https://pypi.org/project/openrouter/0.11.22 - .
|
||||
|
||||
## 2026-07-12 16:36:57
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.23] .
|
||||
### Releases
|
||||
- [PyPI v0.11.23] https://pypi.org/project/openrouter/0.11.23 - .
|
||||
|
||||
## 2026-07-13 17:54:57
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.24] .
|
||||
### Releases
|
||||
- [PyPI v0.11.24] https://pypi.org/project/openrouter/0.11.24 - .
|
||||
|
||||
## 2026-07-13 19:18:28
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.25] .
|
||||
### Releases
|
||||
- [PyPI v0.11.25] https://pypi.org/project/openrouter/0.11.25 - .
|
||||
|
||||
## 2026-07-13 19:27:34
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.26] .
|
||||
### Releases
|
||||
- [PyPI v0.11.26] https://pypi.org/project/openrouter/0.11.26 - .
|
||||
|
||||
## 2026-07-13 20:42:45
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.27] .
|
||||
### Releases
|
||||
- [PyPI v0.11.27] https://pypi.org/project/openrouter/0.11.27 - .
|
||||
|
||||
## 2026-07-14 05:35:17
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.28] .
|
||||
### Releases
|
||||
- [PyPI v0.11.28] https://pypi.org/project/openrouter/0.11.28 - .
|
||||
|
||||
## 2026-07-14 14:49:30
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.29] .
|
||||
### Releases
|
||||
- [PyPI v0.11.29] https://pypi.org/project/openrouter/0.11.29 - .
|
||||
|
||||
## 2026-07-14 17:49:24
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.30] .
|
||||
### Releases
|
||||
- [PyPI v0.11.30] https://pypi.org/project/openrouter/0.11.30 - .
|
||||
|
||||
## 2026-07-14 21:03:59
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.31] .
|
||||
### Releases
|
||||
- [PyPI v0.11.31] https://pypi.org/project/openrouter/0.11.31 - .
|
||||
|
||||
## 2026-07-14 21:26:36
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.32] .
|
||||
### Releases
|
||||
- [PyPI v0.11.32] https://pypi.org/project/openrouter/0.11.32 - .
|
||||
|
||||
## 2026-07-14 22:07:41
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.787.0 (2.914.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.11.33] .
|
||||
### Releases
|
||||
- [PyPI v0.11.33] https://pypi.org/project/openrouter/0.11.33 - .
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "AdditionalToolsItem"
|
||||
---
|
||||
|
||||
Additional tools made available to the model at this point in the input
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `role` | [components.AdditionalToolsItemRole](../components/additionaltoolsitemrole.mdx) | :heavy_check_mark: | N/A |
|
||||
| `tools` | List[[components.AdditionalToolsItemToolUnion](../components/additionaltoolsitemtoolunion.mdx)] | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.TypeAdditionalTools](../components/typeadditionaltools.mdx) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: "AdditionalToolsItemRole"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import AdditionalToolsItemRole
|
||||
|
||||
# Open enum: unrecognized values are captured as UnrecognizedStr
|
||||
value: AdditionalToolsItemRole = "unknown"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
This is an open enum. Unrecognized values will not fail type checks.
|
||||
|
||||
- `"unknown"`
|
||||
- `"user"`
|
||||
- `"assistant"`
|
||||
- `"system"`
|
||||
- `"critic"`
|
||||
- `"discriminator"`
|
||||
- `"developer"`
|
||||
- `"tool"`
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "AdditionalToolsItemTool"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------- | -------------------------- | -------------------------- | -------------------------- |
|
||||
| `type` | *str* | :heavy_check_mark: | N/A |
|
||||
| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: "AdditionalToolsItemToolFunction"
|
||||
---
|
||||
|
||||
Function tool definition
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||
| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A |
|
||||
| `parameters` | Dict[str, *Nullable[Any]*] | :heavy_check_mark: | N/A |
|
||||
| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `type` | [components.AdditionalToolsItemTypeFunction](../components/additionaltoolsitemtypefunction.mdx) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,168 @@
|
||||
---
|
||||
title: "AdditionalToolsItemToolUnion"
|
||||
---
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.AdditionalToolsItemToolFunction`
|
||||
|
||||
```python
|
||||
value: components.AdditionalToolsItemToolFunction = /* values here */
|
||||
```
|
||||
|
||||
### `components.PreviewWebSearchServerTool`
|
||||
|
||||
```python
|
||||
value: components.PreviewWebSearchServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.Preview20250311WebSearchServerTool`
|
||||
|
||||
```python
|
||||
value: components.Preview20250311WebSearchServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.LegacyWebSearchServerTool`
|
||||
|
||||
```python
|
||||
value: components.LegacyWebSearchServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.WebSearchServerTool`
|
||||
|
||||
```python
|
||||
value: components.WebSearchServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.FileSearchServerTool`
|
||||
|
||||
```python
|
||||
value: components.FileSearchServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.ComputerUseServerTool`
|
||||
|
||||
```python
|
||||
value: components.ComputerUseServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.CodeInterpreterServerTool`
|
||||
|
||||
```python
|
||||
value: components.CodeInterpreterServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.McpServerTool`
|
||||
|
||||
```python
|
||||
value: components.McpServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.ImageGenerationServerTool`
|
||||
|
||||
```python
|
||||
value: components.ImageGenerationServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.CodexLocalShellTool`
|
||||
|
||||
```python
|
||||
value: components.CodexLocalShellTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.ShellServerTool`
|
||||
|
||||
```python
|
||||
value: components.ShellServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.ApplyPatchServerTool`
|
||||
|
||||
```python
|
||||
value: components.ApplyPatchServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.CustomTool`
|
||||
|
||||
```python
|
||||
value: components.CustomTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.AdvisorServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
value: components.AdvisorServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.SubagentServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
value: components.SubagentServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.DatetimeServerTool`
|
||||
|
||||
```python
|
||||
value: components.DatetimeServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.FilesServerTool`
|
||||
|
||||
```python
|
||||
value: components.FilesServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.FusionServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
value: components.FusionServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.ImageGenerationServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
value: components.ImageGenerationServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.SearchModelsServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
value: components.SearchModelsServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.WebFetchServerTool`
|
||||
|
||||
```python
|
||||
value: components.WebFetchServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.WebSearchServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
value: components.WebSearchServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.ApplyPatchServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
value: components.ApplyPatchServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.BashServerTool`
|
||||
|
||||
```python
|
||||
value: components.BashServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.ShellServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
value: components.ShellServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.AdditionalToolsItemTool`
|
||||
|
||||
```python
|
||||
value: components.AdditionalToolsItemTool = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "AdditionalToolsItemTypeFunction"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import AdditionalToolsItemTypeFunction
|
||||
value: AdditionalToolsItemTypeFunction = "function"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"function"`
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "Agent"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------- | -------------------------- | -------------------------- | -------------------------- |
|
||||
| `agent_name` | *str* | :heavy_check_mark: | N/A |
|
||||
| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: "AgentMessageItem"
|
||||
---
|
||||
|
||||
A message routed between agents in a multi-agent session
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `agent` | [OptionalNullable[components.Agent]](../components/agent.mdx) | :heavy_minus_sign: | N/A | |
|
||||
| `author` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `content` | List[[components.AgentMessageItemContentUnion](../components/agentmessageitemcontentunion.mdx)] | :heavy_check_mark: | N/A | |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `recipient` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.TypeAgentMessage](../components/typeagentmessage.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \{<br/>"author": "/root/worker",<br/>"content": [<br/>\{<br/>"text": "Task complete.",<br/>"type": "input_text"<br/>}<br/>],<br/>"recipient": "/root",<br/>"type": "agent_message"<br/>} |
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: "AgentMessageItemContentInputImage"
|
||||
---
|
||||
|
||||
Image input content item
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
||||
| `detail` | [components.AgentMessageItemDetail](../components/agentmessageitemdetail.mdx) | :heavy_check_mark: | N/A |
|
||||
| `image_url` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `type` | [components.AgentMessageItemTypeInputImage](../components/agentmessageitemtypeinputimage.mdx) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
title: "AgentMessageItemContentUnion"
|
||||
---
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.InputText`
|
||||
|
||||
```python
|
||||
value: components.InputText = /* values here */
|
||||
```
|
||||
|
||||
### `components.AgentMessageItemContentInputImage`
|
||||
|
||||
```python
|
||||
value: components.AgentMessageItemContentInputImage = /* values here */
|
||||
```
|
||||
|
||||
### `components.ContentEncryptedContent`
|
||||
|
||||
```python
|
||||
value: components.ContentEncryptedContent = /* values here */
|
||||
```
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
---
|
||||
title: "Size"
|
||||
title: "AgentMessageItemDetail"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import Size
|
||||
from openrouter.components import AgentMessageItemDetail
|
||||
|
||||
# Open enum: unrecognized values are captured as UnrecognizedStr
|
||||
value: Size = "1024x1024"
|
||||
value: AgentMessageItemDetail = "auto"
|
||||
```
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ value: Size = "1024x1024"
|
||||
|
||||
This is an open enum. Unrecognized values will not fail type checks.
|
||||
|
||||
- `"1024x1024"`
|
||||
- `"1024x1536"`
|
||||
- `"1536x1024"`
|
||||
- `"auto"`
|
||||
- `"high"`
|
||||
- `"low"`
|
||||
- `"original"`
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "AgentMessageItemTypeInputImage"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import AgentMessageItemTypeInputImage
|
||||
value: AgentMessageItemTypeInputImage = "input_image"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"input_image"`
|
||||
@@ -2,7 +2,7 @@
|
||||
title: "AnthropicCacheControlDirective"
|
||||
---
|
||||
|
||||
Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
|
||||
Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
title: "AnthropicCacheCreation"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------- | --------------------------- | --------------------------- | --------------------------- |
|
||||
| `ephemeral_1h_input_tokens` | *int* | :heavy_check_mark: | N/A |
|
||||
| `ephemeral_5m_input_tokens` | *int* | :heavy_check_mark: | N/A |
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "AnthropicCitationSearchResultLocation"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cited_text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `end_block_index` | *int* | :heavy_check_mark: | N/A |
|
||||
| `search_result_index` | *int* | :heavy_check_mark: | N/A |
|
||||
| `source` | *str* | :heavy_check_mark: | N/A |
|
||||
| `start_block_index` | *int* | :heavy_check_mark: | N/A |
|
||||
| `title` | *Nullable[str]* | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.AnthropicCitationSearchResultLocationType](../components/anthropiccitationsearchresultlocationtype.mdx) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "AnthropicCitationSearchResultLocationParam"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cited_text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `end_block_index` | *int* | :heavy_check_mark: | N/A |
|
||||
| `search_result_index` | *int* | :heavy_check_mark: | N/A |
|
||||
| `source` | *str* | :heavy_check_mark: | N/A |
|
||||
| `start_block_index` | *int* | :heavy_check_mark: | N/A |
|
||||
| `title` | *Nullable[str]* | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.AnthropicCitationSearchResultLocationParamType](../components/anthropiccitationsearchresultlocationparamtype.mdx) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "AnthropicCitationSearchResultLocationParamType"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import AnthropicCitationSearchResultLocationParamType
|
||||
value: AnthropicCitationSearchResultLocationParamType = "search_result_location"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"search_result_location"`
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "AnthropicCitationSearchResultLocationType"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import AnthropicCitationSearchResultLocationType
|
||||
value: AnthropicCitationSearchResultLocationType = "search_result_location"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"search_result_location"`
|
||||
@@ -1,13 +0,0 @@
|
||||
---
|
||||
title: "AnthropicCitationWebSearchResultLocation"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cited_text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `encrypted_index` | *str* | :heavy_check_mark: | N/A |
|
||||
| `title` | *Nullable[str]* | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.AnthropicCitationWebSearchResultLocationType](../components/anthropiccitationwebsearchresultlocationtype.mdx) | :heavy_check_mark: | N/A |
|
||||
| `url` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: "AnthropicCitationWebSearchResultLocationParam"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cited_text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `encrypted_index` | *str* | :heavy_check_mark: | N/A |
|
||||
| `title` | *Nullable[str]* | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.AnthropicCitationWebSearchResultLocationParamType](../components/anthropiccitationwebsearchresultlocationparamtype.mdx) | :heavy_check_mark: | N/A |
|
||||
| `url` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "AnthropicCitationWebSearchResultLocationParamType"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import AnthropicCitationWebSearchResultLocationParamType
|
||||
value: AnthropicCitationWebSearchResultLocationParamType = "web_search_result_location"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"web_search_result_location"`
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "AnthropicCitationWebSearchResultLocationType"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import AnthropicCitationWebSearchResultLocationType
|
||||
value: AnthropicCitationWebSearchResultLocationType = "web_search_result_location"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"web_search_result_location"`
|
||||
@@ -4,11 +4,11 @@ title: "AnthropicDocumentBlockParam"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `citations` | [OptionalNullable[components.AnthropicDocumentBlockParamCitations]](../components/anthropicdocumentblockparamcitations.mdx) | :heavy_minus_sign: | N/A | |
|
||||
| `context` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `source` | [components.AnthropicDocumentBlockParamSourceUnion](../components/anthropicdocumentblockparamsourceunion.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `title` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `type` | [components.TypeDocument](../components/typedocument.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `citations` | [OptionalNullable[components.AnthropicDocumentBlockParamCitations]](../components/anthropicdocumentblockparamcitations.mdx) | :heavy_minus_sign: | N/A | |
|
||||
| `context` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `source` | [components.AnthropicDocumentBlockParamSourceUnion](../components/anthropicdocumentblockparamsourceunion.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `title` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `type` | [components.TypeDocument](../components/typedocument.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -4,8 +4,8 @@ title: "AnthropicImageBlockParam"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `source` | [components.AnthropicImageBlockParamSource](../components/anthropicimageblockparamsource.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.AnthropicImageBlockParamType](../components/anthropicimageblockparamtype.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `source` | [components.AnthropicImageBlockParamSource](../components/anthropicimageblockparamsource.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.AnthropicImageBlockParamType](../components/anthropicimageblockparamtype.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -4,11 +4,11 @@ title: "AnthropicSearchResultBlockParam"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `citations` | [Optional[components.AnthropicSearchResultBlockParamCitations]](../components/anthropicsearchresultblockparamcitations.mdx) | :heavy_minus_sign: | N/A | |
|
||||
| `content` | List[[components.AnthropicTextBlockParam](../components/anthropictextblockparam.mdx)] | :heavy_check_mark: | N/A | |
|
||||
| `source` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `title` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.AnthropicSearchResultBlockParamType](../components/anthropicsearchresultblockparamtype.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `citations` | [Optional[components.AnthropicSearchResultBlockParamCitations]](../components/anthropicsearchresultblockparamcitations.mdx) | :heavy_minus_sign: | N/A | |
|
||||
| `content` | List[[components.AnthropicTextBlockParam](../components/anthropictextblockparam.mdx)] | :heavy_check_mark: | N/A | |
|
||||
| `source` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `title` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.AnthropicSearchResultBlockParamType](../components/anthropicsearchresultblockparamtype.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -4,9 +4,9 @@ title: "AnthropicTextBlockParam"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `citations` | List[[components.Citation](../components/citation.mdx)] | :heavy_minus_sign: | N/A | |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.AnthropicTextBlockParamType](../components/anthropictextblockparamtype.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `citations` | List[[components.Citation](../components/citation.mdx)] | :heavy_minus_sign: | N/A | |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.AnthropicTextBlockParamType](../components/anthropictextblockparamtype.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -4,7 +4,9 @@ title: "BaseReasoningConfig"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium |
|
||||
| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `context` | [OptionalNullable[components.ReasoningContext]](../components/reasoningcontext.mdx) | :heavy_minus_sign: | Controls which reasoning is available to the model. `auto` uses the model default (same as omitting); `all_turns` includes reasoning from earlier turns passed in input; `current_turn` limits to the current turn only. Only supported by OpenAI GPT-5.6 and newer. | all_turns |
|
||||
| `effort` | [OptionalNullable[components.ReasoningEffort]](../components/reasoningeffort.mdx) | :heavy_minus_sign: | N/A | medium |
|
||||
| `mode` | [OptionalNullable[components.ReasoningMode]](../components/reasoningmode.mdx) | :heavy_minus_sign: | Selects the reasoning mode. `standard` is the default; `pro` engages deeper reasoning on models that support it, billed at standard token rates. Only supported by OpenAI GPT-5.6 and newer. | standard |
|
||||
| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.mdx) | :heavy_minus_sign: | N/A | auto |
|
||||
@@ -43,6 +43,7 @@ This is an open enum. Unrecognized values will not fail type checks.
|
||||
- `"crusoe"`
|
||||
- `"darkbloom"`
|
||||
- `"decart"`
|
||||
- `"deepgram"`
|
||||
- `"deepinfra"`
|
||||
- `"deepseek"`
|
||||
- `"dekallm"`
|
||||
@@ -66,6 +67,7 @@ This is an open enum. Unrecognized values will not fail type checks.
|
||||
- `"liquid"`
|
||||
- `"mancer"`
|
||||
- `"mara"`
|
||||
- `"meta"`
|
||||
- `"minimax"`
|
||||
- `"mistral"`
|
||||
- `"modelrun"`
|
||||
@@ -89,7 +91,8 @@ This is an open enum. Unrecognized values will not fail type checks.
|
||||
- `"recraft"`
|
||||
- `"reka"`
|
||||
- `"relace"`
|
||||
- `"sakana-ai"`
|
||||
- `"sail-research"`
|
||||
- `"sakana"`
|
||||
- `"sambanova"`
|
||||
- `"seed"`
|
||||
- `"siliconflow"`
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
title: "Caching"
|
||||
---
|
||||
|
||||
Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
|
||||
Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: "Category"
|
||||
---
|
||||
|
||||
The category of feedback being reported
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import Category
|
||||
|
||||
# Open enum: unrecognized values are captured as UnrecognizedStr
|
||||
value: Category = "latency"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
This is an open enum. Unrecognized values will not fail type checks.
|
||||
|
||||
- `"latency"`
|
||||
- `"incoherence"`
|
||||
- `"incorrect_response"`
|
||||
- `"formatting"`
|
||||
- `"billing"`
|
||||
- `"api_error"`
|
||||
- `"other"`
|
||||
@@ -2,7 +2,7 @@
|
||||
title: "ChatContentCacheControl"
|
||||
---
|
||||
|
||||
Cache control for the content part
|
||||
Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
@@ -7,8 +7,9 @@ Text content part
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Cache control for the content part | \{<br/>"ttl": "5m",<br/>"type": "ephemeral"<br/>} |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.ChatContentTextType](../components/chatcontenttexttype.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. | \{<br/>"ttl": "5m",<br/>"type": "ephemeral"<br/>} |
|
||||
| `prompt_cache_breakpoint` | [OptionalNullable[components.PromptCacheBreakpoint]](../components/promptcachebreakpoint.mdx) | :heavy_minus_sign: | Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. | \{<br/>"mode": "explicit"<br/>} |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.ChatContentTextType](../components/chatcontenttexttype.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: "ChatFormatJSONObjectConfig"
|
||||
---
|
||||
|
||||
JSON object response format
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
||||
| `type` | [components.ChatFormatJSONObjectConfigType](../components/chatformatjsonobjectconfigtype.mdx) | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "ChatFormatJSONObjectConfigType"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import ChatFormatJSONObjectConfigType
|
||||
value: ChatFormatJSONObjectConfigType = "json_object"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"json_object"`
|
||||
@@ -37,6 +37,12 @@ value: components.DatetimeServerTool = /* values here */
|
||||
value: components.FilesServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.FusionServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
value: components.FusionServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.ImageGenerationServerToolOpenRouter`
|
||||
|
||||
```python
|
||||
|
||||
@@ -6,6 +6,6 @@ title: "ChatFunctionToolFunction"
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Cache control for the content part | \{<br/>"ttl": "5m",<br/>"type": "ephemeral"<br/>} |
|
||||
| `cache_control` | [Optional[components.ChatContentCacheControl]](../components/chatcontentcachecontrol.mdx) | :heavy_minus_sign: | Anthropic-style cache breakpoint for the content part. Interchangeable with the OpenAI-style `prompt_cache_breakpoint` marker: OpenRouter converts between the two based on the provider serving the request. | \{<br/>"ttl": "5m",<br/>"type": "ephemeral"<br/>} |
|
||||
| `function` | [components.ChatFunctionToolFunctionFunction](../components/chatfunctiontoolfunctionfunction.mdx) | :heavy_check_mark: | Function definition for tool calling | \{<br/>"description": "Get the current weather for a location",<br/>"name": "get_weather",<br/>"parameters": \{<br/>"properties": \{<br/>"location": \{<br/>"description": "City name",<br/>"type": "string"<br/>}<br/>},<br/>"required": [<br/>"location"<br/>],<br/>"type": "object"<br/>}<br/>} |
|
||||
| `type` | [components.ChatFunctionToolType](../components/chatfunctiontooltype.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -9,7 +9,7 @@ Chat completion request parameters
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `debug` | [Optional[components.ChatDebugOptions]](../components/chatdebugoptions.mdx) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | \{<br/>"echo_upstream_body": true<br/>} |
|
||||
| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | 0 |
|
||||
| `image_config` | Dict[str, [components.ImageConfig](../components/imageconfig.mdx)] | :heavy_minus_sign: | 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. | \{<br/>"aspect_ratio": "16:9",<br/>"quality": "high"<br/>} |
|
||||
@@ -26,6 +26,8 @@ Chat completion request parameters
|
||||
| `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response. | true |
|
||||
| `plugins` | List[[components.ChatRequestPlugin](../components/chatrequestplugin.mdx)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||
| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 |
|
||||
| `prompt_cache_key` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `prompt_cache_options` | [OptionalNullable[components.PromptCacheOptions]](../components/promptcacheoptions.mdx) | :heavy_minus_sign: | Request-level prompt-cache controls. `mode: "explicit"` disables OpenAI-managed breakpoints so only blocks marked with `prompt_cache_breakpoint` are cached. Only supported by OpenAI GPT-5.6 and newer. | \{<br/>"mode": "explicit",<br/>"ttl": "30m"<br/>} |
|
||||
| `provider` | [OptionalNullable[components.ProviderPreferences]](../components/providerpreferences.mdx) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | \{<br/>"allow_fallbacks": true<br/>} |
|
||||
| `reasoning` | [Optional[components.ChatRequestReasoning]](../components/chatrequestreasoning.mdx) | :heavy_minus_sign: | Configuration options for reasoning models | \{<br/>"effort": "medium",<br/>"summary": "concise"<br/>} |
|
||||
| `reasoning_effort` | [OptionalNullable[components.ChatRequestReasoningEffort]](../components/chatrequestreasoningeffort.mdx) | :heavy_minus_sign: | Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ. | medium |
|
||||
|
||||
@@ -16,5 +16,5 @@ Token usage statistics
|
||||
| `is_byok` | *Optional[bool]* | :heavy_minus_sign: | Whether a request was made using a Bring Your Own Key configuration | |
|
||||
| `prompt_tokens` | *int* | :heavy_check_mark: | Number of tokens in the prompt | |
|
||||
| `prompt_tokens_details` | [OptionalNullable[components.ChatUsagePromptTokensDetails]](../components/chatusageprompttokensdetails.mdx) | :heavy_minus_sign: | Detailed prompt token usage | |
|
||||
| `server_tool_use_details` | [OptionalNullable[components.ServerToolUseDetails]](../components/servertoolusedetails.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | |
|
||||
| `server_tool_use_details` | [OptionalNullable[components.ServerToolUseDetails]](../components/servertoolusedetails.mdx) | :heavy_minus_sign: | Usage for server-side tool execution (e.g., web search) | \{<br/>"tool_calls_executed": 2,<br/>"tool_calls_requested": 2,<br/>"web_search_requests": 2<br/>} |
|
||||
| `total_tokens` | *int* | :heavy_check_mark: | Total number of tokens | |
|
||||
@@ -22,15 +22,15 @@ value: components.AnthropicCitationContentBlockLocationParam = /* values here */
|
||||
value: components.AnthropicCitationPageLocationParam = /* values here */
|
||||
```
|
||||
|
||||
### `components.AnthropicCitationSearchResultLocation`
|
||||
### `components.AnthropicCitationSearchResultLocationParam`
|
||||
|
||||
```python
|
||||
value: components.AnthropicCitationSearchResultLocation = /* values here */
|
||||
value: components.AnthropicCitationSearchResultLocationParam = /* values here */
|
||||
```
|
||||
|
||||
### `components.AnthropicCitationWebSearchResultLocation`
|
||||
### `components.AnthropicCitationWebSearchResultLocationParam`
|
||||
|
||||
```python
|
||||
value: components.AnthropicCitationWebSearchResultLocation = /* values here */
|
||||
value: components.AnthropicCitationWebSearchResultLocationParam = /* values here */
|
||||
```
|
||||
|
||||
|
||||
@@ -34,3 +34,4 @@ This is an open enum. Unrecognized values will not fail type checks.
|
||||
- `"empty_image_file"`
|
||||
- `"failed_to_download_image"`
|
||||
- `"image_file_not_found"`
|
||||
- `"bio_policy"`
|
||||
|
||||
@@ -7,8 +7,9 @@ A context compaction marker with encrypted summary
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
||||
| `encrypted_content` | *str* | :heavy_check_mark: | N/A |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `type` | [components.CompactionItemType](../components/compactionitemtype.mdx) | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
||||
| `encrypted_content` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `type` | [components.CompactionItemType](../components/compactionitemtype.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \{<br/>"encrypted_content": "enc_abc123...",<br/>"type": "compaction"<br/>} |
|
||||
@@ -4,8 +4,8 @@ title: "ContentCompaction"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `content` | *Nullable[str]* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.MessagesMessageParamTypeCompaction](../components/messagesmessageparamtypecompaction.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `content` | *Nullable[str]* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.MessagesMessageParamTypeCompaction](../components/messagesmessageparamtypecompaction.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: "ContentEncryptedContent"
|
||||
---
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||
| `encrypted_content` | *str* | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.TypeEncryptedContent](../components/typeencryptedcontent.mdx) | :heavy_check_mark: | N/A |
|
||||
| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
@@ -4,10 +4,10 @@ title: "ContentServerToolUse"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.TypeServerToolUse](../components/typeservertooluse.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.TypeServerToolUse](../components/typeservertooluse.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -4,10 +4,10 @@ title: "ContentToolResult"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `content` | [Optional[components.MessagesMessageParamContentUnion2]](../components/messagesmessageparamcontentunion2.mdx) | :heavy_minus_sign: | N/A | |
|
||||
| `is_error` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `tool_use_id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.TypeToolResult](../components/typetoolresult.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `content` | [Optional[components.MessagesMessageParamContentUnion2]](../components/messagesmessageparamcontentunion2.mdx) | :heavy_minus_sign: | N/A | |
|
||||
| `is_error` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `tool_use_id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.TypeToolResult](../components/typetoolresult.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -4,10 +4,10 @@ title: "ContentToolUse"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.TypeToolUse](../components/typetooluse.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `input` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | |
|
||||
| `name` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.TypeToolUse](../components/typetooluse.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -4,9 +4,9 @@ title: "ContentWebSearchToolResult"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `content` | [components.MessagesMessageParamContentUnion3](../components/messagesmessageparamcontentunion3.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `tool_use_id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.TypeWebSearchToolResult](../components/typewebsearchtoolresult.mdx) | :heavy_check_mark: | N/A | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `content` | [components.MessagesMessageParamContentUnion3](../components/messagesmessageparamcontentunion3.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `tool_use_id` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.TypeWebSearchToolResult](../components/typewebsearchtoolresult.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "ContextCompactionItem"
|
||||
---
|
||||
|
||||
A context compaction marker with an optional encrypted summary
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
||||
| `encrypted_content` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `type` | [components.ContextCompactionItemType](../components/contextcompactionitemtype.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \{<br/>"encrypted_content": "enc_abc123...",<br/>"type": "context_compaction"<br/>} |
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "ContextCompactionItemType"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import ContextCompactionItemType
|
||||
value: ContextCompactionItemType = "context_compaction"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"context_compaction"`
|
||||
@@ -4,21 +4,22 @@ title: "CreateGuardrailRequest"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [<br/>"openai/gpt-5.2",<br/>"anthropic/claude-4.5-opus-20251124",<br/>"deepseek/deepseek-r1-0528:free"<br/>] |
|
||||
| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [<br/>"openai",<br/>"anthropic",<br/>"deepseek"<br/>] |
|
||||
| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [<br/>\{<br/>"action": "block",<br/>"slug": "regex-prompt-injection"<br/>}<br/>] |
|
||||
| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [<br/>\{<br/>"action": "redact",<br/>"label": "[API_KEY]",<br/>"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"<br/>}<br/>] |
|
||||
| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage |
|
||||
| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.<br/><br/>Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false |
|
||||
| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. | false |
|
||||
| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [<br/>"openai/gpt-4o-mini"<br/>] |
|
||||
| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [<br/>"azure"<br/>] |
|
||||
| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 |
|
||||
| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail |
|
||||
| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly |
|
||||
| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers (slug or canonical_slug accepted) | [<br/>"openai/gpt-5.2",<br/>"anthropic/claude-4.5-opus-20251124",<br/>"deepseek/deepseek-r1-0528:free"<br/>] |
|
||||
| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [<br/>"openai",<br/>"anthropic",<br/>"deepseek"<br/>] |
|
||||
| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntryInput](../components/contentfilterbuiltinentryinput.mdx)] | :heavy_minus_sign: | Builtin content filters to apply. The "flag" action is only supported for "regex-prompt-injection"; PII slugs (email, phone, ssn, credit-card, ip-address, person-name, address) accept "block" or "redact" only. | [<br/>\{<br/>"action": "block",<br/>"slug": "regex-prompt-injection"<br/>}<br/>] |
|
||||
| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters to apply to request messages | [<br/>\{<br/>"action": "redact",<br/>"label": "[API_KEY]",<br/>"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"<br/>}<br/>] |
|
||||
| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | A guardrail for limiting API usage |
|
||||
| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.<br/><br/>Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false |
|
||||
| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model identifiers to exclude from routing (slug or canonical_slug accepted) | [<br/>"openai/gpt-4o-mini"<br/>] |
|
||||
| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [<br/>"azure"<br/>] |
|
||||
| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 50 |
|
||||
| `name` | *str* | :heavy_check_mark: | Name for the new guardrail | My New Guardrail |
|
||||
| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly |
|
||||
| `workspace_id` | *Optional[str]* | :heavy_minus_sign: | The workspace to create the guardrail in. Defaults to the default workspace if not provided. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
|
||||
@@ -4,6 +4,6 @@ title: "CreateGuardrailResponse"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{<br/>"allowed_models": null,<br/>"allowed_providers": [<br/>"openai",<br/>"anthropic",<br/>"google"<br/>],<br/>"content_filter_builtins": [<br/>\{<br/>"action": "redact",<br/>"label": "[EMAIL]",<br/>"slug": "email"<br/>}<br/>],<br/>"content_filters": null,<br/>"created_at": "2025-08-24T10:30:00Z",<br/>"description": "Guardrail for production environment",<br/>"enforce_zdr": null,<br/>"enforce_zdr_anthropic": true,<br/>"enforce_zdr_google": false,<br/>"enforce_zdr_openai": true,<br/>"enforce_zdr_other": false,<br/>"id": "550e8400-e29b-41d4-a716-446655440000",<br/>"ignored_models": null,<br/>"ignored_providers": null,<br/>"limit_usd": 100,<br/>"name": "Production Guardrail",<br/>"reset_interval": "monthly",<br/>"updated_at": "2025-08-24T15:45:00Z",<br/>"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"<br/>} |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{<br/>"allowed_models": null,<br/>"allowed_providers": [<br/>"openai",<br/>"anthropic",<br/>"google"<br/>],<br/>"content_filter_builtins": [<br/>\{<br/>"action": "redact",<br/>"label": "[EMAIL]",<br/>"slug": "email"<br/>}<br/>],<br/>"content_filters": null,<br/>"created_at": "2025-08-24T10:30:00Z",<br/>"description": "Guardrail for production environment",<br/>"enforce_zdr": null,<br/>"enforce_zdr_anthropic": true,<br/>"enforce_zdr_google": false,<br/>"enforce_zdr_openai": true,<br/>"enforce_zdr_other": false,<br/>"enforce_zdr_xai": false,<br/>"id": "550e8400-e29b-41d4-a716-446655440000",<br/>"ignored_models": null,<br/>"ignored_providers": null,<br/>"limit_usd": 100,<br/>"name": "Production Guardrail",<br/>"reset_interval": "monthly",<br/>"updated_at": "2025-08-24T15:45:00Z",<br/>"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"<br/>} |
|
||||
@@ -9,7 +9,7 @@ title: "CreateObservabilityDestinationRequest"
|
||||
| `api_key_hashes` | List[*str*] | :heavy_minus_sign: | Optional allowlist of OpenRouter API key hashes whose traffic is forwarded. `null` or omitted means all keys. Must contain at least one hash if provided. | null |
|
||||
| `config` | Dict[str, *Nullable[Any]*] | :heavy_check_mark: | Provider-specific configuration. The shape depends on `type` and is validated server-side. | \{<br/>"baseUrl": "https://us.cloud.langfuse.com",<br/>"publicKey": "pk-l...EfGh",<br/>"secretKey": "sk-l...AbCd"<br/>} |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Whether this destination should be enabled immediately. | true |
|
||||
| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfig]](../components/observabilityfilterrulesconfig.mdx) | :heavy_minus_sign: | Optional structured filter rules controlling which events are forwarded. | null |
|
||||
| `filter_rules` | [OptionalNullable[components.ObservabilityFilterRulesConfigNullable]](../components/observabilityfilterrulesconfignullable.mdx) | :heavy_minus_sign: | Optional structured filter rules controlling which events are forwarded. | null |
|
||||
| `name` | *str* | :heavy_check_mark: | Human-readable name for the destination. | Production Langfuse |
|
||||
| `privacy_mode` | *Optional[bool]* | :heavy_minus_sign: | When true, request/response bodies are not forwarded — only metadata. | false |
|
||||
| `sampling_rate` | *Optional[float]* | :heavy_minus_sign: | Sampling rate between 0.0001 and 1 (1 = 100%). | 1 |
|
||||
|
||||
@@ -7,13 +7,13 @@ Configuration for the openrouter:fusion server tool.
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `analysis_models` | List[*str*] | :heavy_minus_sign: | Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion. | [<br/>"~anthropic/claude-opus-latest",<br/>"~openai/gpt-latest",<br/>"~google/gemini-pro-latest"<br/>] |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `max_completion_tokens` | *Optional[int]* | :heavy_minus_sign: | Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, the provider's default applies. | 16384 |
|
||||
| `max_tool_calls` | *Optional[int]* | :heavy_minus_sign: | Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16. | 12 |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request. | ~anthropic/claude-opus-latest |
|
||||
| `reasoning` | [Optional[components.FusionServerToolConfigReasoning]](../components/fusionservertoolconfigreasoning.mdx) | :heavy_minus_sign: | Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking. | |
|
||||
| `temperature` | *Optional[float]* | :heavy_minus_sign: | Temperature forwarded to panelist inner calls. The judge always runs at temperature 0 regardless of this value. When omitted, the provider's default applies. | 0.7 |
|
||||
| `tools` | List[[components.FusionServerToolConfigTool](../components/fusionservertoolconfigtool.mdx)] | :heavy_minus_sign: | Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: "openrouter:web_search" }, { type: "openrouter:web_fetch" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only). | [<br/>\{<br/>"parameters": \{<br/>"excluded_domains": [<br/>"example.com"<br/>]<br/>},<br/>"type": "openrouter:web_search"<br/>},<br/>\{<br/>"type": "openrouter:web_fetch"<br/>}<br/>] |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `analysis_models` | List[*str*] | :heavy_minus_sign: | Slugs of models to run in parallel as the analysis panel. Each model receives the user prompt with openrouter:web_search and openrouter:web_fetch enabled, then a judge model summarizes the collective output into structured analysis JSON. Capped at 8 models to bound cost amplification. Defaults to the Quality preset from /labs/fusion. | [<br/>"~anthropic/claude-opus-latest",<br/>"~openai/gpt-latest",<br/>"~google/gemini-pro-latest"<br/>] |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `max_completion_tokens` | *Optional[int]* | :heavy_minus_sign: | Maximum number of output tokens (including reasoning tokens) each panelist and the judge model may produce per inner call. Controls the total output budget so reasoning-heavy models like GPT-5.5 do not exhaust their token allowance before producing visible text. When omitted, panelists default to 32000 and the judge to 50000. | 16384 |
|
||||
| `max_tool_calls` | *Optional[int]* | :heavy_minus_sign: | Maximum number of tool-calling steps each panelist (analysis model) and the judge model may take during their agentic web-research loop. Models with web_search/web_fetch enabled iterate until they produce a text response or hit this ceiling. Defaults to 8. Capped at 16. | 12 |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | Slug of the judge model that produces the structured analysis JSON. Defaults to the model used in the outer API request. | ~anthropic/claude-opus-latest |
|
||||
| `reasoning` | [Optional[components.FusionServerToolConfigReasoning]](../components/fusionservertoolconfigreasoning.mdx) | :heavy_minus_sign: | Reasoning configuration forwarded to panelist and judge inner calls. Use this to control reasoning effort and token budget for models that support extended thinking. | |
|
||||
| `temperature` | *Optional[float]* | :heavy_minus_sign: | Temperature forwarded to panelist inner calls. The judge always runs at temperature 0 regardless of this value. When omitted, the provider's default applies. | 0.7 |
|
||||
| `tools` | List[[components.FusionServerToolConfigTool](../components/fusionservertoolconfigtool.mdx)] | :heavy_minus_sign: | Server tools available to panelist and judge inner calls. Each entry uses the same `{ type, parameters? }` shorthand as the outer Chat Completions request. When omitted, defaults to `[{ type: "openrouter:web_search" }, { type: "openrouter:web_fetch" }]`. Pass an empty array to disable tools entirely (panelists answer from parametric knowledge only). | [<br/>\{<br/>"parameters": \{<br/>"excluded_domains": [<br/>"example.com"<br/>]<br/>},<br/>"type": "openrouter:web_search"<br/>},<br/>\{<br/>"type": "openrouter:web_fetch"<br/>}<br/>] |
|
||||
@@ -4,6 +4,6 @@ title: "GetGuardrailResponse"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{<br/>"allowed_models": null,<br/>"allowed_providers": [<br/>"openai",<br/>"anthropic",<br/>"google"<br/>],<br/>"content_filter_builtins": [<br/>\{<br/>"action": "redact",<br/>"label": "[EMAIL]",<br/>"slug": "email"<br/>}<br/>],<br/>"content_filters": null,<br/>"created_at": "2025-08-24T10:30:00Z",<br/>"description": "Guardrail for production environment",<br/>"enforce_zdr": null,<br/>"enforce_zdr_anthropic": true,<br/>"enforce_zdr_google": false,<br/>"enforce_zdr_openai": true,<br/>"enforce_zdr_other": false,<br/>"id": "550e8400-e29b-41d4-a716-446655440000",<br/>"ignored_models": null,<br/>"ignored_providers": null,<br/>"limit_usd": 100,<br/>"name": "Production Guardrail",<br/>"reset_interval": "monthly",<br/>"updated_at": "2025-08-24T15:45:00Z",<br/>"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"<br/>} |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `data` | [components.Guardrail](../components/guardrail.mdx) | :heavy_check_mark: | N/A | \{<br/>"allowed_models": null,<br/>"allowed_providers": [<br/>"openai",<br/>"anthropic",<br/>"google"<br/>],<br/>"content_filter_builtins": [<br/>\{<br/>"action": "redact",<br/>"label": "[EMAIL]",<br/>"slug": "email"<br/>}<br/>],<br/>"content_filters": null,<br/>"created_at": "2025-08-24T10:30:00Z",<br/>"description": "Guardrail for production environment",<br/>"enforce_zdr": null,<br/>"enforce_zdr_anthropic": true,<br/>"enforce_zdr_google": false,<br/>"enforce_zdr_openai": true,<br/>"enforce_zdr_other": false,<br/>"enforce_zdr_xai": false,<br/>"id": "550e8400-e29b-41d4-a716-446655440000",<br/>"ignored_models": null,<br/>"ignored_providers": null,<br/>"limit_usd": 100,<br/>"name": "Production Guardrail",<br/>"reset_interval": "monthly",<br/>"updated_at": "2025-08-24T15:45:00Z",<br/>"workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"<br/>} |
|
||||
@@ -4,24 +4,25 @@ title: "Guardrail"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs (immutable identifiers) | [<br/>"openai/gpt-5.2-20251211",<br/>"anthropic/claude-4.5-opus-20251124",<br/>"deepseek/deepseek-r1-0528:free"<br/>] |
|
||||
| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [<br/>"openai",<br/>"anthropic",<br/>"google"<br/>] |
|
||||
| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntry](../components/contentfilterbuiltinentry.mdx)] | :heavy_minus_sign: | Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector. | [<br/>\{<br/>"action": "redact",<br/>"label": "[EMAIL]",<br/>"slug": "email"<br/>}<br/>] |
|
||||
| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters applied to request messages | [<br/>\{<br/>"action": "redact",<br/>"label": "[API_KEY]",<br/>"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"<br/>}<br/>] |
|
||||
| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the guardrail was created | 2025-08-24T10:30:00Z |
|
||||
| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | Guardrail for production environment |
|
||||
| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.<br/><br/>Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false |
|
||||
| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, or Google. Falls back to enforce_zdr when not provided. | false |
|
||||
| `id` | *str* | :heavy_check_mark: | Unique identifier for the guardrail | 550e8400-e29b-41d4-a716-446655440000 |
|
||||
| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs to exclude from routing | [<br/>"openai/gpt-4o-mini-2024-07-18"<br/>] |
|
||||
| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [<br/>"azure"<br/>] |
|
||||
| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 100 |
|
||||
| `name` | *str* | :heavy_check_mark: | Name of the guardrail | Production Guardrail |
|
||||
| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly |
|
||||
| `updated_at` | *OptionalNullable[str]* | :heavy_minus_sign: | ISO 8601 timestamp of when the guardrail was last updated | 2025-08-24T15:45:00Z |
|
||||
| `workspace_id` | *str* | :heavy_check_mark: | The workspace ID this guardrail belongs to. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `allowed_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs (immutable identifiers) | [<br/>"openai/gpt-5.2-20251211",<br/>"anthropic/claude-4.5-opus-20251124",<br/>"deepseek/deepseek-r1-0528:free"<br/>] |
|
||||
| `allowed_providers` | List[*str*] | :heavy_minus_sign: | List of allowed provider IDs | [<br/>"openai",<br/>"anthropic",<br/>"google"<br/>] |
|
||||
| `content_filter_builtins` | List[[components.ContentFilterBuiltinEntry](../components/contentfilterbuiltinentry.mdx)] | :heavy_minus_sign: | Builtin content filters applied to requests. Includes PII detectors and the regex-based prompt injection detector. | [<br/>\{<br/>"action": "redact",<br/>"label": "[EMAIL]",<br/>"slug": "email"<br/>}<br/>] |
|
||||
| `content_filters` | List[[components.ContentFilterEntry](../components/contentfilterentry.mdx)] | :heavy_minus_sign: | Custom regex content filters applied to request messages | [<br/>\{<br/>"action": "redact",<br/>"label": "[API_KEY]",<br/>"pattern": "\\b(sk-[a-zA-Z0-9]\{48})\\b"<br/>}<br/>] |
|
||||
| `created_at` | *str* | :heavy_check_mark: | ISO 8601 timestamp of when the guardrail was created | 2025-08-24T10:30:00Z |
|
||||
| `description` | *OptionalNullable[str]* | :heavy_minus_sign: | Description of the guardrail | Guardrail for production environment |
|
||||
| ~~`enforce_zdr`~~ | *OptionalNullable[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.<br/><br/>Deprecated. Use enforce_zdr_anthropic, enforce_zdr_openai, enforce_zdr_google, enforce_zdr_xai, and enforce_zdr_other instead. When provided, its value is copied into any of those per-provider fields that are not explicitly specified on the request. | false |
|
||||
| `enforce_zdr_anthropic` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Anthropic models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_google` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for Google models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_openai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for OpenAI models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_other` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for models that are not from Anthropic, OpenAI, Google, or xAI. Falls back to enforce_zdr when not provided. | false |
|
||||
| `enforce_zdr_xai` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to enforce zero data retention for xAI models. Falls back to enforce_zdr when not provided. | false |
|
||||
| `id` | *str* | :heavy_check_mark: | Unique identifier for the guardrail | 550e8400-e29b-41d4-a716-446655440000 |
|
||||
| `ignored_models` | List[*str*] | :heavy_minus_sign: | Array of model canonical_slugs to exclude from routing | [<br/>"openai/gpt-4o-mini-2024-07-18"<br/>] |
|
||||
| `ignored_providers` | List[*str*] | :heavy_minus_sign: | List of provider IDs to exclude from routing | [<br/>"azure"<br/>] |
|
||||
| `limit_usd` | *OptionalNullable[float]* | :heavy_minus_sign: | Spending limit in USD | 100 |
|
||||
| `name` | *str* | :heavy_check_mark: | Name of the guardrail | Production Guardrail |
|
||||
| `reset_interval` | [OptionalNullable[components.GuardrailInterval]](../components/guardrailinterval.mdx) | :heavy_minus_sign: | Interval at which the limit resets (daily, weekly, monthly) | monthly |
|
||||
| `updated_at` | *OptionalNullable[str]* | :heavy_minus_sign: | ISO 8601 timestamp of when the guardrail was last updated | 2025-08-24T15:45:00Z |
|
||||
| `workspace_id` | *str* | :heavy_check_mark: | The workspace ID this guardrail belongs to. | 0df9e665-d932-5740-b2c7-b52af166bc11 |
|
||||
@@ -7,10 +7,10 @@ Emitted when generation completes and the final image is available
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `b64_json` | *str* | :heavy_check_mark: | Base64-encoded final image data | |
|
||||
| `created` | *int* | :heavy_check_mark: | Unix timestamp (seconds) when the image was generated | |
|
||||
| `media_type` | *Optional[str]* | :heavy_minus_sign: | Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`). | image/svg+xml |
|
||||
| `type` | [components.ImageGenCompletedEventType](../components/imagegencompletedeventtype.mdx) | :heavy_check_mark: | The event type | |
|
||||
| `usage` | [Optional[components.ImageGenerationUsage]](../components/imagegenerationusage.mdx) | :heavy_minus_sign: | Token and cost usage for the image generation request, when available | \{<br/>"completion_tokens": 4175,<br/>"cost": 0.04,<br/>"prompt_tokens": 0,<br/>"total_tokens": 4175<br/>} |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `b64_json` | *str* | :heavy_check_mark: | Base64-encoded final image data | |
|
||||
| `created` | *int* | :heavy_check_mark: | Unix timestamp (seconds) when the image was generated | |
|
||||
| `media_type` | *Optional[str]* | :heavy_minus_sign: | Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined. | image/png |
|
||||
| `type` | [components.ImageGenCompletedEventType](../components/imagegencompletedeventtype.mdx) | :heavy_check_mark: | The event type | |
|
||||
| `usage` | [Optional[components.ImageGenerationUsage]](../components/imagegenerationusage.mdx) | :heavy_minus_sign: | Token and cost usage for the image generation request, when available | \{<br/>"completion_tokens": 4175,<br/>"cost": 0.04,<br/>"prompt_tokens": 0,<br/>"total_tokens": 4175<br/>} |
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
title: "ImageGenerationProviderPreferences"
|
||||
---
|
||||
|
||||
Provider routing preferences and provider-specific passthrough configuration.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests<br/>- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.<br/>- false: use only the primary/custom provider, and return the upstream error if it's unavailable.<br/> | |
|
||||
| `ignore` | List[[components.ImageGenerationProviderPreferencesIgnore](../components/imagegenerationproviderpreferencesignore.mdx)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | [<br/>"openai",<br/>"anthropic"<br/>] |
|
||||
| `only` | List[[components.ImageGenerationProviderPreferencesOnly](../components/imagegenerationproviderpreferencesonly.mdx)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | [<br/>"openai",<br/>"anthropic"<br/>] |
|
||||
| `options` | [Optional[components.ImageGenerationProviderPreferencesOptions]](../components/imagegenerationproviderpreferencesoptions.mdx) | :heavy_minus_sign: | N/A | \{<br/>"black-forest-labs": \{<br/>"guidance": 3,<br/>"steps": 40<br/>}<br/>} |
|
||||
| `order` | List[[components.ImageGenerationProviderPreferencesOrder](../components/imagegenerationproviderpreferencesorder.mdx)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | [<br/>"openai",<br/>"anthropic"<br/>] |
|
||||
| `sort` | [OptionalNullable[components.ImageGenerationProviderPreferencesSort]](../components/imagegenerationproviderpreferencessort.mdx) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | price |
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: "ImageGenerationProviderPreferencesIgnore"
|
||||
---
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ProviderName`
|
||||
|
||||
```python
|
||||
value: components.ProviderName = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: "ImageGenerationProviderPreferencesOnly"
|
||||
---
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ProviderName`
|
||||
|
||||
```python
|
||||
value: components.ProviderName = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "ImageGenerationRequestOptions"
|
||||
title: "ImageGenerationProviderPreferencesOptions"
|
||||
---
|
||||
|
||||
Provider-specific options keyed by provider slug. Only options for the matched provider are forwarded; the rest are ignored. Unrecognized keys are silently dropped.
|
||||
@@ -40,6 +40,7 @@ Provider-specific options keyed by provider slug. Only options for the matched p
|
||||
| `crusoe` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `darkbloom` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `decart` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `deepgram` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `deepinfra` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `deepseek` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `dekallm` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
@@ -106,7 +107,8 @@ Provider-specific options keyed by provider slug. Only options for the matched p
|
||||
| `reka` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `relace` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `replicate` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sakana_ai` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sail_research` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sakana` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sambanova` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `sambanova_cloaked` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
| `seed` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: "ImageGenerationProviderPreferencesOrder"
|
||||
---
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ProviderName`
|
||||
|
||||
```python
|
||||
value: components.ProviderName = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: "ImageGenerationProviderPreferencesSort"
|
||||
---
|
||||
|
||||
The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed.
|
||||
|
||||
|
||||
## Supported Types
|
||||
|
||||
### `components.ProviderSort`
|
||||
|
||||
```python
|
||||
value: components.ProviderSort = /* values here */
|
||||
```
|
||||
|
||||
### `components.ProviderSortConfig`
|
||||
|
||||
```python
|
||||
value: components.ProviderSortConfig = /* values here */
|
||||
```
|
||||
|
||||
### `Any`
|
||||
|
||||
```python
|
||||
value: Any = /* values here */
|
||||
```
|
||||
|
||||
@@ -7,19 +7,19 @@ Image generation request input
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `aspect_ratio` | [Optional[components.ImageGenerationRequestAspectRatio]](../components/imagegenerationrequestaspectratio.mdx) | :heavy_minus_sign: | Normalized aspect ratio of the generated image. Providers clamp to their supported subset. | 16:9 |
|
||||
| `background` | [Optional[components.ImageGenerationRequestBackground]](../components/imagegenerationrequestbackground.mdx) | :heavy_minus_sign: | Background treatment. `transparent` requires an output_format that supports alpha (png or webp). | auto |
|
||||
| `input_references` | List[[components.ContentPartImage](../components/contentpartimage.mdx)] | :heavy_minus_sign: | Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs. | |
|
||||
| `model` | *str* | :heavy_check_mark: | The image generation model to use | bytedance-seed/seedream-4.5 |
|
||||
| `n` | *Optional[int]* | :heavy_minus_sign: | Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. | 1 |
|
||||
| `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 |
|
||||
| `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png |
|
||||
| `prompt` | *str* | :heavy_check_mark: | Text description of the desired image | a red panda astronaut floating in space, studio lighting |
|
||||
| `provider` | [Optional[components.ImageGenerationRequestProvider]](../components/imagegenerationrequestprovider.mdx) | :heavy_minus_sign: | Provider-specific passthrough configuration | |
|
||||
| `quality` | [Optional[components.ImageGenerationRequestQuality]](../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high |
|
||||
| `resolution` | [Optional[components.ImageGenerationRequestResolution]](../components/imagegenerationrequestresolution.mdx) | :heavy_minus_sign: | Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. | 2K |
|
||||
| `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | |
|
||||
| `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. Interchangeable with resolution + aspect_ratio; use those directly for enumerated, per-model discoverable values. Conflicting size + resolution/aspect_ratio is rejected. | 2K |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `aspect_ratio` | [Optional[components.ImageGenerationRequestAspectRatio]](../components/imagegenerationrequestaspectratio.mdx) | :heavy_minus_sign: | Normalized aspect ratio of the generated image. Providers clamp to their supported subset. | 16:9 |
|
||||
| `background` | [Optional[components.ImageGenerationRequestBackground]](../components/imagegenerationrequestbackground.mdx) | :heavy_minus_sign: | Background treatment. `transparent` requires an output_format that supports alpha (png or webp). | auto |
|
||||
| `input_references` | List[[components.ContentPartImage](../components/contentpartimage.mdx)] | :heavy_minus_sign: | Reference images to guide image-to-image generation, as base64 data URLs or HTTP(S) URLs. | |
|
||||
| `model` | *str* | :heavy_check_mark: | The image generation model to use | bytedance-seed/seedream-4.5 |
|
||||
| `n` | *Optional[int]* | :heavy_minus_sign: | Number of images to generate (1-10). Providers that only support single-image generation reject n > 1. | 1 |
|
||||
| `output_compression` | *Optional[int]* | :heavy_minus_sign: | Compression level (0-100) for webp/jpeg output. Ignored for png and by providers without a compression knob. | 100 |
|
||||
| `output_format` | [Optional[components.ImageGenerationRequestOutputFormat]](../components/imagegenerationrequestoutputformat.mdx) | :heavy_minus_sign: | Encoding of the returned image bytes. Most models produce raster formats (png, jpeg, webp). SVG is supported by vectorization models (e.g. Quiver) — the SVG markup is UTF-8 base64-encoded in `b64_json`. | png |
|
||||
| `prompt` | *str* | :heavy_check_mark: | Text description of the desired image | a red panda astronaut floating in space, studio lighting |
|
||||
| `provider` | [Optional[components.ImageGenerationProviderPreferences]](../components/imagegenerationproviderpreferences.mdx) | :heavy_minus_sign: | Provider routing preferences and provider-specific passthrough configuration. | \{<br/>"allow_fallbacks": false,<br/>"only": [<br/>"google-ai-studio"<br/>]<br/>} |
|
||||
| `quality` | [Optional[components.ImageGenerationRequestQuality]](../components/imagegenerationrequestquality.mdx) | :heavy_minus_sign: | Rendering quality. Providers without a quality knob ignore this. | high |
|
||||
| `resolution` | [Optional[components.ImageGenerationRequestResolution]](../components/imagegenerationrequestresolution.mdx) | :heavy_minus_sign: | Normalized resolution tier of the generated image. Concrete pixel dimensions are derived per-provider. | 2K |
|
||||
| `seed` | *Optional[int]* | :heavy_minus_sign: | If specified, the generation will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for all providers. | |
|
||||
| `size` | *Optional[str]* | :heavy_minus_sign: | Optional. A convenience shorthand for output dimensions — pass a tier ("2K", "4K") or explicit pixels ("2048x2048") and we normalize it to the right dimensions for the chosen provider. A tier size is equivalent to setting `resolution` and combines with `aspect_ratio`. An explicit pixel size is authoritative: a mismatched `resolution` or `aspect_ratio` alongside it is rejected with a 400. | 2K |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | If true, partial images are streamed as SSE events as they become available. Only supported by providers with native streaming (currently OpenAI). Non-streaming providers ignore this flag and return a buffered response. | |
|
||||
@@ -4,7 +4,7 @@ title: "ImageGenerationResponseData"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `b64_json` | *str* | :heavy_check_mark: | Base64-encoded image bytes | |
|
||||
| `media_type` | *Optional[str]* | :heavy_minus_sign: | Media type (MIME type) of the image. Omitted when the output is a standard raster format (PNG). Present for non-raster outputs such as SVG (`image/svg+xml`). | image/svg+xml |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `b64_json` | *str* | :heavy_check_mark: | Base64-encoded image bytes | |
|
||||
| `media_type` | *Optional[str]* | :heavy_minus_sign: | Media type (MIME type) of the image, e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`. May be omitted if the format could not be determined. | image/png |
|
||||
@@ -12,11 +12,11 @@ Image generation tool configuration
|
||||
| `background` | [Optional[components.ImageGenerationServerToolBackground]](../components/imagegenerationservertoolbackground.mdx) | :heavy_minus_sign: | N/A |
|
||||
| `input_fidelity` | [OptionalNullable[components.InputFidelity]](../components/inputfidelity.mdx) | :heavy_minus_sign: | N/A |
|
||||
| `input_image_mask` | [Optional[components.InputImageMask]](../components/inputimagemask.mdx) | :heavy_minus_sign: | N/A |
|
||||
| `model` | [Optional[components.ModelEnum]](../components/modelenum.mdx) | :heavy_minus_sign: | N/A |
|
||||
| `model` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `moderation` | [Optional[components.Moderation]](../components/moderation.mdx) | :heavy_minus_sign: | N/A |
|
||||
| `output_compression` | *Optional[int]* | :heavy_minus_sign: | N/A |
|
||||
| `output_format` | [Optional[components.ImageGenerationServerToolOutputFormat]](../components/imagegenerationservertooloutputformat.mdx) | :heavy_minus_sign: | N/A |
|
||||
| `partial_images` | *Optional[int]* | :heavy_minus_sign: | N/A |
|
||||
| `quality` | [Optional[components.ImageGenerationServerToolQuality]](../components/imagegenerationservertoolquality.mdx) | :heavy_minus_sign: | N/A |
|
||||
| `size` | [Optional[components.Size]](../components/size.mdx) | :heavy_minus_sign: | N/A |
|
||||
| `size` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `type` | [components.ImageGenerationServerToolType](../components/imagegenerationservertooltype.mdx) | :heavy_check_mark: | N/A |
|
||||
@@ -9,6 +9,7 @@ Token and cost usage for the image generation request, when available
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_creation` | [OptionalNullable[components.AnthropicCacheCreation]](../components/anthropiccachecreation.mdx) | :heavy_minus_sign: | N/A | \{<br/>"ephemeral_1h_input_tokens": 0,<br/>"ephemeral_5m_input_tokens": 100<br/>} |
|
||||
| `completion_tokens` | *int* | :heavy_check_mark: | The tokens generated | |
|
||||
| `completion_tokens_details` | [OptionalNullable[components.ImageGenerationUsageCompletionTokensDetails]](../components/imagegenerationusagecompletiontokensdetails.mdx) | :heavy_minus_sign: | N/A | |
|
||||
| `cost` | *OptionalNullable[float]* | :heavy_minus_sign: | Cost of the completion | |
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: "ImageGenTextChunkEvent"
|
||||
---
|
||||
|
||||
Emitted when a text chunk becomes available during streaming generation of text-based formats (e.g. SVG)
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `phase` | [components.ImageGenTextChunkEventPhase](../components/imagegentextchunkeventphase.mdx) | :heavy_check_mark: | The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases. |
|
||||
| `text` | *str* | :heavy_check_mark: | A text fragment of the image being generated (e.g. partial SVG markup) |
|
||||
| `type` | [components.ImageGenTextChunkEventType](../components/imagegentextchunkeventtype.mdx) | :heavy_check_mark: | The event type |
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "ImageGenTextChunkEventPhase"
|
||||
---
|
||||
|
||||
The generation phase this chunk belongs to. `content` is the renderable output; `reasoning` and `draft` are intermediate provider phases.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import ImageGenTextChunkEventPhase
|
||||
|
||||
# Open enum: unrecognized values are captured as UnrecognizedStr
|
||||
value: ImageGenTextChunkEventPhase = "content"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
This is an open enum. Unrecognized values will not fail type checks.
|
||||
|
||||
- `"content"`
|
||||
- `"reasoning"`
|
||||
- `"draft"`
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
title: "ImageGenTextChunkEventType"
|
||||
---
|
||||
|
||||
The event type
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import ImageGenTextChunkEventType
|
||||
value: ImageGenTextChunkEventType = "image_generation.text_chunk"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"image_generation.text_chunk"`
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: "ImageInputModality"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import ImageInputModality
|
||||
|
||||
# Open enum: unrecognized values are captured as UnrecognizedStr
|
||||
value: ImageInputModality = "text"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
This is an open enum. Unrecognized values will not fail type checks.
|
||||
|
||||
- `"text"`
|
||||
- `"image"`
|
||||
- `"file"`
|
||||
- `"audio"`
|
||||
- `"video"`
|
||||
@@ -6,5 +6,5 @@ title: "ImageModelArchitecture"
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
||||
| `input_modalities` | List[[components.InputModality](../components/inputmodality.mdx)] | :heavy_check_mark: | Supported input modalities |
|
||||
| `input_modalities` | List[[components.ImageInputModality](../components/imageinputmodality.mdx)] | :heavy_check_mark: | Supported input modalities |
|
||||
| `output_modalities` | List[[components.ImageOutputModality](../components/imageoutputmodality.mdx)] | :heavy_check_mark: | Supported output modalities |
|
||||
@@ -10,6 +10,12 @@ title: "ImageStreamingResponseData"
|
||||
value: components.ImageGenPartialImageEvent = /* values here */
|
||||
```
|
||||
|
||||
### `components.ImageGenTextChunkEvent`
|
||||
|
||||
```python
|
||||
value: components.ImageGenTextChunkEvent = /* values here */
|
||||
```
|
||||
|
||||
### `components.ImageGenCompletedEvent`
|
||||
|
||||
```python
|
||||
|
||||
@@ -274,9 +274,27 @@ value: components.CustomToolCallOutputItem = /* values here */
|
||||
value: components.CompactionItem = /* values here */
|
||||
```
|
||||
|
||||
### `components.ContextCompactionItem`
|
||||
|
||||
```python
|
||||
value: components.ContextCompactionItem = /* values here */
|
||||
```
|
||||
|
||||
### `components.ItemReferenceItem`
|
||||
|
||||
```python
|
||||
value: components.ItemReferenceItem = /* values here */
|
||||
```
|
||||
|
||||
### `components.AdditionalToolsItem`
|
||||
|
||||
```python
|
||||
value: components.AdditionalToolsItem = /* values here */
|
||||
```
|
||||
|
||||
### `components.AgentMessageItem`
|
||||
|
||||
```python
|
||||
value: components.AgentMessageItem = /* values here */
|
||||
```
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ Text input content item
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `type` | [components.InputTextType](../components/inputtexttype.mdx) | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `prompt_cache_breakpoint` | [OptionalNullable[components.PromptCacheBreakpoint]](../components/promptcachebreakpoint.mdx) | :heavy_minus_sign: | Marks an explicit prompt-cache boundary on this content block (OpenAI-style). Everything through the block carrying this marker is part of the candidate cached prefix. Supported natively by OpenAI GPT-5.6 and newer; on providers that use Anthropic-style `cache_control`, OpenRouter converts the marker to that format automatically. | \{<br/>"mode": "explicit"<br/>} |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A | |
|
||||
| `type` | [components.InputTextType](../components/inputtexttype.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -4,6 +4,7 @@ title: "InputTokensDetails"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `cached_tokens` | *int* | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `cache_write_tokens` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A |
|
||||
| `cached_tokens` | *int* | :heavy_check_mark: | N/A |
|
||||
@@ -9,7 +9,7 @@ Video input content part (legacy format - deprecated)
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ |
|
||||
| `type` | [components.LegacyChatContentVideoType](../components/legacychatcontentvideotype.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `video_url` | [components.ChatContentVideoInput](../components/chatcontentvideoinput.mdx) | :heavy_check_mark: | Video input object | \{<br/>"url": "https://example.com/video.mp4"<br/>} |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
||||
| `type` | [components.LegacyChatContentVideoType](../components/legacychatcontentvideotype.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `video_url` | [components.LegacyChatContentVideoInput](../components/legacychatcontentvideoinput.mdx) | :heavy_check_mark: | Video input object | \{<br/>"url": "https://example.com/video.mp4"<br/>} |
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: "LegacyChatContentVideoInput"
|
||||
---
|
||||
|
||||
Video input object
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- |
|
||||
| `url` | *str* | :heavy_check_mark: | URL of the video (data: URLs supported) |
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: "Links"
|
||||
---
|
||||
|
||||
Pagination links
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| `next` | *Nullable[str]* | :heavy_check_mark: | URL for the next page of results, or null if this is the last page | /api/v1/models?offset=500&limit=500 |
|
||||
@@ -9,7 +9,7 @@ Request schema for Anthropic Messages API endpoint
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `cache_control` | [Optional[components.AnthropicCacheControlDirective]](../components/anthropiccachecontroldirective.mdx) | :heavy_minus_sign: | Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format. | \{<br/>"type": "ephemeral"<br/>} |
|
||||
| `context_management` | [OptionalNullable[components.ContextManagement]](../components/contextmanagement.mdx) | :heavy_minus_sign: | N/A | |
|
||||
| `fallbacks` | List[[components.MessagesFallbackParam](../components/messagesfallbackparam.mdx)] | :heavy_minus_sign: | Fallback models to try if the primary model fails or refuses, in order. Handled by OpenRouter multi-model routing rather than Anthropic server-side fallbacks; cannot be combined with `models`. Each entry accepts only `model`. Maximum of 3 entries. | [<br/>\{<br/>"model": "claude-opus-4-8"<br/>}<br/>] |
|
||||
| `max_tokens` | *Optional[int]* | :heavy_minus_sign: | N/A | |
|
||||
|
||||
@@ -58,10 +58,10 @@ value: components.DatetimeServerTool = /* values here */
|
||||
value: components.ImageGenerationServerToolOpenRouter = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatSearchModelsServerTool`
|
||||
### `components.MessagesSearchModelsServerTool`
|
||||
|
||||
```python
|
||||
value: components.ChatSearchModelsServerTool = /* values here */
|
||||
value: components.MessagesSearchModelsServerTool = /* values here */
|
||||
```
|
||||
|
||||
### `components.WebFetchServerTool`
|
||||
|
||||
+4
-3
@@ -1,12 +1,13 @@
|
||||
---
|
||||
title: "ImageGenerationRequestProvider"
|
||||
title: "MessagesSearchModelsServerTool"
|
||||
---
|
||||
|
||||
Provider-specific passthrough configuration
|
||||
OpenRouter built-in server tool: searches and filters AI models available on OpenRouter
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| `options` | [Optional[components.ImageGenerationRequestOptions]](../components/imagegenerationrequestoptions.mdx) | :heavy_minus_sign: | N/A | \{<br/>"black-forest-labs": \{<br/>"guidance": 3,<br/>"steps": 40<br/>}<br/>} |
|
||||
| `parameters` | [Optional[components.SearchModelsServerToolConfig]](../components/searchmodelsservertoolconfig.mdx) | :heavy_minus_sign: | Configuration for the openrouter:experimental__search_models server tool | \{<br/>"max_results": 5<br/>} |
|
||||
| `type` | [components.MessagesSearchModelsServerToolType](../components/messagessearchmodelsservertooltype.mdx) | :heavy_check_mark: | N/A | |
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "MessagesSearchModelsServerToolType"
|
||||
---
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import MessagesSearchModelsServerToolType
|
||||
value: MessagesSearchModelsServerToolType = "openrouter:experimental__search_models"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
- `"openrouter:experimental__search_models"`
|
||||
@@ -7,10 +7,10 @@ Model architecture information
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `input_modalities` | List[[components.InputModality](../components/inputmodality.mdx)] | :heavy_check_mark: | Supported input modalities | |
|
||||
| `instruct_type` | [OptionalNullable[components.ModelArchitectureInstructType]](../components/modelarchitectureinstructtype.mdx) | :heavy_minus_sign: | Instruction format type | chatml |
|
||||
| `modality` | *Nullable[str]* | :heavy_check_mark: | Primary modality of the model | text->text |
|
||||
| `output_modalities` | List[[components.OutputModality](../components/outputmodality.mdx)] | :heavy_check_mark: | Supported output modalities | |
|
||||
| `tokenizer` | [Optional[components.ModelGroup]](../components/modelgroup.mdx) | :heavy_minus_sign: | Tokenizer type used by the model | GPT |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
||||
| `input_modalities` | List[[components.InputModality](../components/inputmodality.mdx)] | :heavy_check_mark: | Supported input modalities | |
|
||||
| `instruct_type` | [OptionalNullable[components.InstructType]](../components/instructtype.mdx) | :heavy_minus_sign: | Instruction format type | chatml |
|
||||
| `modality` | *Nullable[str]* | :heavy_check_mark: | Primary modality of the model | text->text |
|
||||
| `output_modalities` | List[[components.OutputModality](../components/outputmodality.mdx)] | :heavy_check_mark: | Supported output modalities | |
|
||||
| `tokenizer` | [Optional[components.ModelGroup]](../components/modelgroup.mdx) | :heavy_minus_sign: | Tokenizer type used by the model | GPT |
|
||||
@@ -1,42 +0,0 @@
|
||||
---
|
||||
title: "ModelArchitectureInstructType"
|
||||
---
|
||||
|
||||
Instruction format type
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import ModelArchitectureInstructType
|
||||
|
||||
# Open enum: unrecognized values are captured as UnrecognizedStr
|
||||
value: ModelArchitectureInstructType = "none"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
This is an open enum. Unrecognized values will not fail type checks.
|
||||
|
||||
- `"none"`
|
||||
- `"airoboros"`
|
||||
- `"alpaca"`
|
||||
- `"alpaca-modif"`
|
||||
- `"chatml"`
|
||||
- `"claude"`
|
||||
- `"code-llama"`
|
||||
- `"gemma"`
|
||||
- `"llama2"`
|
||||
- `"llama3"`
|
||||
- `"mistral"`
|
||||
- `"nemotron"`
|
||||
- `"neural"`
|
||||
- `"openchat"`
|
||||
- `"phi3"`
|
||||
- `"rwkv"`
|
||||
- `"vicuna"`
|
||||
- `"zephyr"`
|
||||
- `"deepseek-r1"`
|
||||
- `"deepseek-v3.1"`
|
||||
- `"qwq"`
|
||||
- `"qwen3"`
|
||||
@@ -7,6 +7,8 @@ List of available models
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `data` | List[[components.Model](../components/model.mdx)] | :heavy_check_mark: | List of available models | [<br/>\{<br/>"architecture": \{<br/>"input_modalities": [<br/>"text"<br/>],<br/>"instruct_type": "chatml",<br/>"modality": "text-\u003etext",<br/>"output_modalities": [<br/>"text"<br/>],<br/>"tokenizer": "GPT"<br/>},<br/>"canonical_slug": "openai/gpt-4",<br/>"context_length": 8192,<br/>"created": 1692901234,<br/>"default_parameters": null,<br/>"description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.",<br/>"expiration_date": null,<br/>"id": "openai/gpt-4",<br/>"knowledge_cutoff": null,<br/>"links": \{<br/>"details": "/api/v1/models/openai/gpt-5.4/endpoints"<br/>},<br/>"name": "GPT-4",<br/>"per_request_limits": null,<br/>"pricing": \{<br/>"completion": "0.00006",<br/>"image": "0",<br/>"prompt": "0.00003",<br/>"request": "0"<br/>},<br/>"supported_parameters": [<br/>"temperature",<br/>"top_p",<br/>"max_tokens"<br/>],<br/>"supported_voices": null,<br/>"top_provider": \{<br/>"context_length": 8192,<br/>"is_moderated": true,<br/>"max_completion_tokens": 4096<br/>}<br/>}<br/>] |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `data` | List[[components.Model](../components/model.mdx)] | :heavy_check_mark: | List of available models | [<br/>\{<br/>"architecture": \{<br/>"input_modalities": [<br/>"text"<br/>],<br/>"instruct_type": "chatml",<br/>"modality": "text-\u003etext",<br/>"output_modalities": [<br/>"text"<br/>],<br/>"tokenizer": "GPT"<br/>},<br/>"canonical_slug": "openai/gpt-4",<br/>"context_length": 8192,<br/>"created": 1692901234,<br/>"default_parameters": null,<br/>"description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.",<br/>"expiration_date": null,<br/>"id": "openai/gpt-4",<br/>"knowledge_cutoff": null,<br/>"links": \{<br/>"details": "/api/v1/models/openai/gpt-4/endpoints"<br/>},<br/>"name": "GPT-4",<br/>"per_request_limits": null,<br/>"pricing": \{<br/>"completion": "0.00006",<br/>"image": "0",<br/>"prompt": "0.00003",<br/>"request": "0"<br/>},<br/>"supported_parameters": [<br/>"temperature",<br/>"top_p",<br/>"max_tokens"<br/>],<br/>"supported_voices": null,<br/>"top_provider": \{<br/>"context_length": 8192,<br/>"is_moderated": true,<br/>"max_completion_tokens": 4096<br/>}<br/>}<br/>] |
|
||||
| `links` | [components.Links](../components/links.mdx) | :heavy_check_mark: | Pagination links | |
|
||||
| `total_count` | *int* | :heavy_check_mark: | Total number of models matching the query | 150 |
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "Group"
|
||||
title: "ObservabilityFilterRuleGroup"
|
||||
---
|
||||
|
||||
## Fields
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: "ObservabilityFilterRulesConfigValue"
|
||||
title: "ObservabilityFilterRuleGroupValue"
|
||||
---
|
||||
|
||||
## Supported Types
|
||||
@@ -7,7 +7,7 @@ Optional structured filter rules controlling which events are forwarded.
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `groups` | List[[components.Group](../components/group.mdx)] | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `groups` | List[[components.ObservabilityFilterRuleGroup](../components/observabilityfilterrulegroup.mdx)] | :heavy_check_mark: | N/A |
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: "ObservabilityFilterRulesConfigNullable"
|
||||
---
|
||||
|
||||
Optional structured filter rules controlling which events are forwarded.
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
| `groups` | List[[components.ObservabilityFilterRuleGroup](../components/observabilityfilterrulegroup.mdx)] | :heavy_check_mark: | N/A |
|
||||
@@ -4,8 +4,9 @@ title: "ParetoRouterPlugin"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the pareto-router plugin for this request. Defaults to true. | |
|
||||
| `id` | [components.ParetoRouterPluginID](../components/paretorouterpluginid.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `min_coding_score` | *Optional[float]* | :heavy_minus_sign: | Minimum desired coding score between 0 and 1, where 1 is best. Higher values select from stronger coding models (sourced from Artificial Analysis coding percentiles). Maps internally to one of three tiers (low, medium, high). Omit to use the router default tier. | 0.8 |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the pareto-router plugin for this request. Defaults to true. | |
|
||||
| `id` | [components.ParetoRouterPluginID](../components/paretorouterpluginid.mdx) | :heavy_check_mark: | N/A | |
|
||||
| `min_coding_score` | *Optional[float]* | :heavy_minus_sign: | Minimum coding quality score between 0 and 1. Maps to internal quality tiers: >= 0.66 → high (top coding models), >= 0.33 → medium (strong modern flagships), < 0.33 → low (capable coders above the median). Omit to default to the highest tier (equivalent to >= 0.66). | 0.8 |
|
||||
| `price_source` | [Optional[components.PriceSource]](../components/pricesource.mdx) | :heavy_minus_sign: | Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt". | |
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "PriceSource"
|
||||
---
|
||||
|
||||
Price source for the Pareto frontier cost axis. "prompt" uses catalog list price (endpoint.pricing.prompt). "weighted_avg" uses traffic-weighted effective input price from ClickHouse, falling back to prompt price for models without traffic data. Defaults to "prompt".
|
||||
|
||||
## Example Usage
|
||||
|
||||
```python
|
||||
from openrouter.components import PriceSource
|
||||
|
||||
# Open enum: unrecognized values are captured as UnrecognizedStr
|
||||
value: PriceSource = "prompt"
|
||||
```
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
This is an open enum. Unrecognized values will not fail type checks.
|
||||
|
||||
- `"prompt"`
|
||||
- `"weighted_avg"`
|
||||
+18
-17
@@ -4,20 +4,21 @@ title: "Pricing"
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token |
|
||||
| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token |
|
||||
| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image |
|
||||
| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image |
|
||||
| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token |
|
||||
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token |
|
||||
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) |
|
||||
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. |
|
||||
| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. |
|
||||
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token |
|
||||
| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request |
|
||||
| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search |
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `audio` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio input token |
|
||||
| `audio_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per audio output token |
|
||||
| `completion` | *str* | :heavy_check_mark: | Price in USD per token for completion (output) generation |
|
||||
| `discount` | *Optional[float]* | :heavy_minus_sign: | Fractional discount applied to this endpoint's pricing; the price is multiplied by (1 - discount) (0 = no discount, 1 = free) |
|
||||
| `image` | *Optional[str]* | :heavy_minus_sign: | Price in USD per input image |
|
||||
| `image_output` | *Optional[str]* | :heavy_minus_sign: | Price in USD per output image |
|
||||
| `image_token` | *Optional[str]* | :heavy_minus_sign: | Price in USD per image token |
|
||||
| `input_audio_cache` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached audio input token |
|
||||
| `input_cache_read` | *Optional[str]* | :heavy_minus_sign: | Price in USD per cached input token (read) |
|
||||
| `input_cache_write` | *Optional[str]* | :heavy_minus_sign: | Price per cache-write token, in USD per token. For providers with multiple cache TTLs (e.g. Anthropic), this is the default (5-minute) cache-write rate. |
|
||||
| `input_cache_write_1h` | *Optional[str]* | :heavy_minus_sign: | Price per 1-hour cache-write token, in USD per token. Only present for providers that price an extended (1-hour) cache TTL separately, such as Anthropic. |
|
||||
| `internal_reasoning` | *Optional[str]* | :heavy_minus_sign: | Price in USD per internal reasoning token |
|
||||
| `overrides` | List[[components.PricingOverride](../components/pricingoverride.mdx)] | :heavy_minus_sign: | Conditional overrides of the base pricing (e.g. long-context or time-based pricing). An entry applies when all of its condition fields (e.g. min_prompt_tokens, or the utc_start/utc_end time window) match the request; among applicable entries, later entries win per key; price keys absent from an entry inherit the base price. The top-level pricing keys always reflect the price that applies under default conditions. |
|
||||
| `prompt` | *str* | :heavy_check_mark: | Price in USD per token for prompt (input) processing |
|
||||
| `request` | *Optional[str]* | :heavy_minus_sign: | Price in USD per request |
|
||||
| `web_search` | *Optional[str]* | :heavy_minus_sign: | Price in USD per web search |
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user