mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-07-29 11:23:49 +08:00
updates
This commit is contained in:
@@ -26,5 +26,4 @@
|
||||
| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A |
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -33,3 +33,9 @@ value: components.ChatMessageContentItemVideo = /* values here */
|
||||
value: components.ChatMessageContentItemVideo = /* values here */
|
||||
```
|
||||
|
||||
### `components.ChatMessageContentItemFile`
|
||||
|
||||
```python
|
||||
value: components.ChatMessageContentItemFile = /* values here */
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# ChatMessageContentItemAudioFormat
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `WAV` | wav |
|
||||
| `MP3` | mp3 |
|
||||
| `FLAC` | flac |
|
||||
| `M4A` | m4a |
|
||||
| `OGG` | ogg |
|
||||
| `PCM16` | pcm16 |
|
||||
| `PCM24` | pcm24 |
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||
| `format_` | *str* | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||
| `data` | *str* | :heavy_check_mark: | N/A |
|
||||
| `format_` | [components.ChatMessageContentItemAudioFormat](../components/chatmessagecontentitemaudioformat.md) | :heavy_check_mark: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# ChatMessageContentItemCacheControl
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||
| `type` | *Literal["ephemeral"]* | :heavy_check_mark: | N/A |
|
||||
| `ttl` | [Optional[components.TTL]](../components/ttl.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,9 @@
|
||||
# ChatMessageContentItemFile
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
||||
| `type` | *Literal["file"]* | :heavy_check_mark: | N/A |
|
||||
| `file` | [components.File](../components/file.md) | :heavy_check_mark: | N/A |
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `type` | *Literal["text"]* | :heavy_check_mark: | N/A |
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||
| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A |
|
||||
| `video_url` | [components.VideoURL1](../components/videourl1.md) | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ |
|
||||
| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A |
|
||||
| `video_url` | [components.VideoURL](../components/videourl.md) | :heavy_check_mark: | N/A |
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- |
|
||||
| `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A |
|
||||
| `video_url` | [components.VideoURL2](../components/videourl2.md) | :heavy_check_mark: | N/A |
|
||||
| Field | Type | Required | Description |
|
||||
| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
||||
| `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A |
|
||||
| `video_url` | [components.ChatMessageContentItemVideoVideoURLVideoURL](../components/chatmessagecontentitemvideovideourlvideourl.md) | :heavy_check_mark: | N/A |
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# VideoURL2
|
||||
# ChatMessageContentItemVideoVideoURLVideoURL
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -8,6 +8,4 @@
|
||||
| `text` | *str* | :heavy_check_mark: | N/A |
|
||||
| `index` | *float* | :heavy_check_mark: | N/A |
|
||||
| `logprobs` | [Nullable[components.CompletionLogprobs]](../components/completionlogprobs.md) | :heavy_check_mark: | N/A |
|
||||
| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||
| `native_finish_reason` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A |
|
||||
| `finish_reason` | [Nullable[components.CompletionFinishReason]](../components/completionfinishreason.md) | :heavy_check_mark: | N/A |
|
||||
@@ -9,7 +9,6 @@
|
||||
| `object` | *Literal["text_completion"]* | :heavy_check_mark: | N/A |
|
||||
| `created` | *float* | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `provider` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `system_fingerprint` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `choices` | List[[components.CompletionChoice](../components/completionchoice.md)] | :heavy_check_mark: | N/A |
|
||||
| `usage` | [Optional[components.CompletionUsage]](../components/completionusage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# Debug
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| -------------------- | -------------------- | -------------------- | -------------------- |
|
||||
| `echo_upstream_body` | *Optional[bool]* | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,10 @@
|
||||
# File
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------ | ------------------ | ------------------ | ------------------ |
|
||||
| `file_data` | *str* | :heavy_check_mark: | N/A |
|
||||
| `file_id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `filename` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
@@ -1,8 +0,0 @@
|
||||
# IDResponseHealing
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------------------ | ------------------ |
|
||||
| `RESPONSE_HEALING` | response-healing |
|
||||
@@ -27,8 +27,8 @@ Request schema for Responses endpoint
|
||||
| `include` | List[[components.OpenAIResponsesIncludable](../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | |
|
||||
| `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `store` | *Optional[Literal[False]]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | |
|
||||
| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [OptionalNullable[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
|
||||
@@ -21,9 +21,3 @@ value: components.PluginWeb = /* values here */
|
||||
value: components.PluginFileParser = /* values here */
|
||||
```
|
||||
|
||||
### `components.PluginResponseHealing`
|
||||
|
||||
```python
|
||||
value: components.PluginResponseHealing = /* values here */
|
||||
```
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# PluginResponseHealing
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
|
||||
| `id` | [components.IDResponseHealing](../components/idresponsehealing.md) | :heavy_check_mark: | N/A |
|
||||
@@ -9,14 +9,12 @@
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `ARCEE_AI` | Arcee AI |
|
||||
| `ARCEE` | Arcee |
|
||||
| `ATLAS_CLOUD` | AtlasCloud |
|
||||
| `AVIAN` | Avian |
|
||||
| `AZURE` | Azure |
|
||||
| `BASE_TEN` | BaseTen |
|
||||
| `BYTE_PLUS` | BytePlus |
|
||||
| `BLACK_FOREST_LABS` | Black Forest Labs |
|
||||
| `CEREBRAS` | Cerebras |
|
||||
| `CHUTES` | Chutes |
|
||||
@@ -31,7 +29,6 @@
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GO_POMELO` | GoPomelo |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
@@ -62,7 +59,6 @@
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
| `TARGON` | Targon |
|
||||
| `TOGETHER` | Together |
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------ | ------ |
|
||||
| `AUTO` | auto |
|
||||
| Name | Value |
|
||||
| ---------- | ---------- |
|
||||
| `AUTO` | auto |
|
||||
| `DEFAULT` | default |
|
||||
| `FLEX` | flex |
|
||||
| `PRIORITY` | priority |
|
||||
| `SCALE` | scale |
|
||||
@@ -1,9 +0,0 @@
|
||||
# TTL
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
| Name | Value |
|
||||
| ------- | ------- |
|
||||
| `FIVEM` | 5m |
|
||||
| `ONEH` | 1h |
|
||||
@@ -1,4 +1,4 @@
|
||||
# VideoURL1
|
||||
# VideoURL
|
||||
|
||||
|
||||
## Fields
|
||||
@@ -1,14 +1,17 @@
|
||||
# CreateEmbeddingsResponse
|
||||
|
||||
Embedding response
|
||||
|
||||
## Supported Types
|
||||
|
||||
## Fields
|
||||
### `operations.CreateEmbeddingsResponseBody`
|
||||
|
||||
```python
|
||||
value: operations.CreateEmbeddingsResponseBody = /* values here */
|
||||
```
|
||||
|
||||
### `str`
|
||||
|
||||
```python
|
||||
value: str = /* values here */
|
||||
```
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `object` | [operations.Object](../operations/object.md) | :heavy_check_mark: | N/A |
|
||||
| `data` | List[[operations.CreateEmbeddingsData](../operations/createembeddingsdata.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `usage` | [Optional[operations.Usage]](../operations/usage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -0,0 +1,14 @@
|
||||
# CreateEmbeddingsResponseBody
|
||||
|
||||
Embedding response
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
||||
| `id` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `object` | [operations.Object](../operations/object.md) | :heavy_check_mark: | N/A |
|
||||
| `data` | List[[operations.CreateEmbeddingsData](../operations/createembeddingsdata.md)] | :heavy_check_mark: | N/A |
|
||||
| `model` | *str* | :heavy_check_mark: | N/A |
|
||||
| `usage` | [Optional[operations.Usage]](../operations/usage.md) | :heavy_minus_sign: | N/A |
|
||||
@@ -1,9 +0,0 @@
|
||||
# GetCreditsData
|
||||
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ----------------------- | ----------------------- | ----------------------- | ----------------------- | ----------------------- |
|
||||
| `total_credits` | *float* | :heavy_check_mark: | Total credits purchased | 100.5 |
|
||||
| `total_usage` | *float* | :heavy_check_mark: | Total credits used | 25.75 |
|
||||
@@ -5,6 +5,5 @@ Total credits purchased and used
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| `data` | [operations.GetCreditsData](../operations/getcreditsdata.md) | :heavy_check_mark: | N/A | {<br/>"total_credits": 100.5,<br/>"total_usage": 25.75<br/>} |
|
||||
| Field | Type | Required | Description |
|
||||
| ----------- | ----------- | ----------- | ----------- |
|
||||
@@ -9,14 +9,12 @@
|
||||
| `AION_LABS` | AionLabs |
|
||||
| `ALIBABA` | Alibaba |
|
||||
| `AMAZON_BEDROCK` | Amazon Bedrock |
|
||||
| `AMAZON_NOVA` | Amazon Nova |
|
||||
| `ANTHROPIC` | Anthropic |
|
||||
| `ARCEE_AI` | Arcee AI |
|
||||
| `ARCEE` | Arcee |
|
||||
| `ATLAS_CLOUD` | AtlasCloud |
|
||||
| `AVIAN` | Avian |
|
||||
| `AZURE` | Azure |
|
||||
| `BASE_TEN` | BaseTen |
|
||||
| `BYTE_PLUS` | BytePlus |
|
||||
| `BLACK_FOREST_LABS` | Black Forest Labs |
|
||||
| `CEREBRAS` | Cerebras |
|
||||
| `CHUTES` | Chutes |
|
||||
@@ -31,7 +29,6 @@
|
||||
| `FIREWORKS` | Fireworks |
|
||||
| `FRIENDLI` | Friendli |
|
||||
| `GMI_CLOUD` | GMICloud |
|
||||
| `GO_POMELO` | GoPomelo |
|
||||
| `GOOGLE` | Google |
|
||||
| `GOOGLE_AI_STUDIO` | Google AI Studio |
|
||||
| `GROQ` | Groq |
|
||||
@@ -62,7 +59,6 @@
|
||||
| `SAMBA_NOVA` | SambaNova |
|
||||
| `SILICON_FLOW` | SiliconFlow |
|
||||
| `STEALTH` | Stealth |
|
||||
| `STREAM_LAKE` | StreamLake |
|
||||
| `SWITCHPOINT` | Switchpoint |
|
||||
| `TARGON` | Targon |
|
||||
| `TOGETHER` | Together |
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to update | 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 |
|
||||
| `body` | [operations.UpdateKeysRequestBody](../operations/updatekeysrequestbody.md) | :heavy_check_mark: | N/A | {<br/>"name": "Updated API Key Name",<br/>"disabled": false,<br/>"limit": 75,<br/>"limit_reset": "daily",<br/>"include_byok_in_limit": true<br/>} |
|
||||
| `request_body` | [operations.UpdateKeysRequestBody](../operations/updatekeysrequestbody.md) | :heavy_check_mark: | N/A | {<br/>"name": "Updated API Key Name",<br/>"disabled": false,<br/>"limit": 75,<br/>"limit_reset": "daily",<br/>"include_byok_in_limit": true<br/>} |
|
||||
@@ -67,7 +67,6 @@ Create a new API key
|
||||
<!-- UsageSnippet language="python" operationID="createKeys" method="post" path="/keys" -->
|
||||
```python
|
||||
from openrouter import OpenRouter
|
||||
from openrouter.utils import parse_datetime
|
||||
import os
|
||||
|
||||
|
||||
@@ -75,7 +74,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.api_keys.create(name="My New API Key", limit=50, limit_reset="monthly", include_byok_in_limit=True, expires_at=parse_datetime("2027-12-31T23:59:59Z"))
|
||||
res = open_router.api_keys.create(name="My New API Key")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
@@ -123,7 +122,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.api_keys.update(hash="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", name="Updated API Key Name", disabled=False, limit=75, limit_reset="daily", include_byok_in_limit=True)
|
||||
res = open_router.api_keys.update(hash="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")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
@@ -58,7 +58,6 @@ with OpenRouter(
|
||||
| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A |
|
||||
| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A |
|
||||
| `user` | *Optional[str]* | :heavy_minus_sign: | N/A |
|
||||
| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A |
|
||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. |
|
||||
|
||||
### Response
|
||||
|
||||
@@ -26,24 +26,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.embeddings.generate(input="<value>", model="Taurus", provider={
|
||||
"data_collection": "allow",
|
||||
"zdr": True,
|
||||
"enforce_distillable_text": True,
|
||||
"order": [
|
||||
"OpenAI",
|
||||
],
|
||||
"only": [
|
||||
"OpenAI",
|
||||
],
|
||||
"ignore": [
|
||||
"OpenAI",
|
||||
],
|
||||
"quantizations": [
|
||||
"fp16",
|
||||
],
|
||||
"sort": "price",
|
||||
})
|
||||
res = open_router.embeddings.generate(input="<value>", model="Taurus")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
@@ -26,7 +26,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.o_auth.exchange_auth_code_for_api_key(code="auth_code_abc123def456", code_verifier="dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", code_challenge_method="S256")
|
||||
res = open_router.o_auth.exchange_auth_code_for_api_key(code="auth_code_abc123def456")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
@@ -71,7 +71,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.o_auth.create_auth_code(callback_url="https://myapp.com/auth/callback", code_challenge="E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", code_challenge_method="S256", limit=100)
|
||||
res = open_router.o_auth.create_auth_code(callback_url="https://myapp.com/auth/callback")
|
||||
|
||||
# Handle response
|
||||
print(res)
|
||||
|
||||
@@ -25,61 +25,7 @@ with OpenRouter(
|
||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||
) as open_router:
|
||||
|
||||
res = open_router.beta.responses.send(input=[
|
||||
{
|
||||
"type": "message",
|
||||
"role": "user",
|
||||
"content": "Hello, how are you?",
|
||||
},
|
||||
], metadata={
|
||||
"user_id": "123",
|
||||
"session_id": "abc-def-ghi",
|
||||
}, tools=[
|
||||
{
|
||||
"type": "function",
|
||||
"name": "get_current_weather",
|
||||
"description": "Get the current weather in a given location",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"location": {
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
], model="anthropic/claude-4.5-sonnet-20250929", text={
|
||||
"format_": {
|
||||
"type": "text",
|
||||
},
|
||||
"verbosity": "medium",
|
||||
}, reasoning={
|
||||
"summary": "auto",
|
||||
"enabled": True,
|
||||
}, temperature=0.7, top_p=0.9, prompt={
|
||||
"id": "<id>",
|
||||
"variables": {
|
||||
"key": {
|
||||
"type": "input_text",
|
||||
"text": "Hello, how can I help you?",
|
||||
},
|
||||
},
|
||||
}, service_tier="auto", truncation="auto", stream=False, provider={
|
||||
"data_collection": "allow",
|
||||
"zdr": True,
|
||||
"enforce_distillable_text": True,
|
||||
"order": [
|
||||
"OpenAI",
|
||||
],
|
||||
"only": [
|
||||
"OpenAI",
|
||||
],
|
||||
"ignore": [
|
||||
"OpenAI",
|
||||
],
|
||||
"quantizations": None,
|
||||
"sort": "price",
|
||||
})
|
||||
res = open_router.beta.responses.send(stream=False)
|
||||
|
||||
with res as event_stream:
|
||||
for event in event_stream:
|
||||
@@ -112,7 +58,8 @@ with OpenRouter(
|
||||
| `include` | List[[components.OpenAIResponsesIncludable](../../components/openairesponsesincludable.md)] | :heavy_minus_sign: | N/A | |
|
||||
| `background` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `safety_identifier` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | |
|
||||
| `store` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `service_tier` | [OptionalNullable[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto |
|
||||
| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | |
|
||||
| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||
|
||||
Reference in New Issue
Block a user