mirror of
https://github.com/wassname/openrouter-python-sdk-retry-errors.git
synced 2026-08-01 12:40:23 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67ef52b03e | ||
|
|
d4474da1b8 | ||
|
|
aed8199b2b |
+22
-21
@@ -1,12 +1,12 @@
|
|||||||
lockVersion: 2.0.0
|
lockVersion: 2.0.0
|
||||||
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d
|
||||||
management:
|
management:
|
||||||
docChecksum: 7c3a22e3f6b8d7c91ff063e2951aed2f
|
docChecksum: 01481f11e87a18cf1daa583fee2c88fb
|
||||||
docVersion: 1.0.0
|
docVersion: 1.0.0
|
||||||
speakeasyVersion: 1.666.0
|
speakeasyVersion: 1.666.0
|
||||||
generationVersion: 2.768.0
|
generationVersion: 2.768.0
|
||||||
releaseVersion: 0.1.1
|
releaseVersion: 0.0.21
|
||||||
configChecksum: 1206f35a1f0802441ea1b8674cd04f00
|
configChecksum: 52c13d7fdf159611bf5d900363e322ac
|
||||||
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
repoURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||||
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
installationURL: https://github.com/OpenRouterTeam/python-sdk.git
|
||||||
published: true
|
published: true
|
||||||
@@ -459,6 +459,7 @@ generatedFiles:
|
|||||||
- docs/operations/createembeddingsprovider.md
|
- docs/operations/createembeddingsprovider.md
|
||||||
- docs/operations/createembeddingsrequest.md
|
- docs/operations/createembeddingsrequest.md
|
||||||
- docs/operations/createembeddingsresponse.md
|
- docs/operations/createembeddingsresponse.md
|
||||||
|
- docs/operations/createembeddingsresponsebody.md
|
||||||
- docs/operations/createkeysdata.md
|
- docs/operations/createkeysdata.md
|
||||||
- docs/operations/createkeyslimitreset.md
|
- docs/operations/createkeyslimitreset.md
|
||||||
- docs/operations/createkeysrequest.md
|
- docs/operations/createkeysrequest.md
|
||||||
@@ -776,10 +777,10 @@ examples:
|
|||||||
createResponses:
|
createResponses:
|
||||||
speakeasy-default-create-responses:
|
speakeasy-default-create-responses:
|
||||||
requestBody:
|
requestBody:
|
||||||
application/json: {"input": [{"type": "message", "role": "user", "content": "Hello, how are you?"}], "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", "temperature": 0.7, "top_p": 0.9, "store": false, "service_tier": "auto", "stream": false}
|
application/json: {"store": false, "service_tier": "auto", "stream": false}
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "status": "completed", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "status": "completed", "content": [{"type": "output_text", "text": "Hello! How can I help you today?", "annotations": []}]}], "error": null, "incomplete_details": null, "usage": {"input_tokens": 10, "input_tokens_details": {"cached_tokens": 0}, "output_tokens": 25, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 35}, "max_output_tokens": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}
|
application/json: {"id": "resp-abc123", "object": "response", "created_at": 1704067200, "model": "gpt-4", "output": [{"id": "msg-abc123", "role": "assistant", "type": "message", "content": [{"type": "output_text", "text": "Hello! How can I help you today?"}]}], "error": null, "incomplete_details": null, "temperature": null, "top_p": null, "instructions": null, "metadata": null, "tools": [], "tool_choice": "auto", "parallel_tool_calls": true}
|
||||||
"400":
|
"400":
|
||||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||||
"401":
|
"401":
|
||||||
@@ -851,7 +852,7 @@ examples:
|
|||||||
createEmbeddings:
|
createEmbeddings:
|
||||||
speakeasy-default-create-embeddings:
|
speakeasy-default-create-embeddings:
|
||||||
requestBody:
|
requestBody:
|
||||||
application/json: {"input": "<value>", "model": "Taurus", "provider": {"data_collection": "allow", "zdr": true, "enforce_distillable_text": true, "order": ["OpenAI"], "only": ["OpenAI"], "ignore": ["OpenAI"], "quantizations": ["fp16"], "sort": "price"}}
|
application/json: {"input": "<value>", "model": "Taurus"}
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"object": "list", "data": [], "model": "Land Cruiser"}
|
application/json: {"object": "list", "data": [], "model": "Land Cruiser"}
|
||||||
@@ -880,7 +881,7 @@ examples:
|
|||||||
speakeasy-default-list-embeddings-models:
|
speakeasy-default-list-embeddings-models:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "context_length": 8192, "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"context_length": 8192, "max_completion_tokens": 4096, "is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "context_length": 8192, "architecture": {"modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
||||||
"400":
|
"400":
|
||||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||||
"500":
|
"500":
|
||||||
@@ -920,7 +921,7 @@ examples:
|
|||||||
speakeasy-default-get-models:
|
speakeasy-default-get-models:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "context_length": 8192, "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"context_length": 8192, "max_completion_tokens": 4096, "is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "context_length": 8192, "architecture": {"modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
||||||
"400":
|
"400":
|
||||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||||
"500":
|
"500":
|
||||||
@@ -929,7 +930,7 @@ examples:
|
|||||||
speakeasy-default-list-models-user:
|
speakeasy-default-list-models-user:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "context_length": 8192, "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"context_length": 8192, "max_completion_tokens": 4096, "is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
application/json: {"data": [{"id": "openai/gpt-4", "canonical_slug": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "context_length": 8192, "architecture": {"modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "top_provider": {"is_moderated": true}, "per_request_limits": null, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "default_parameters": null}]}
|
||||||
"401":
|
"401":
|
||||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||||
"500":
|
"500":
|
||||||
@@ -942,7 +943,7 @@ examples:
|
|||||||
slug: "<value>"
|
slug: "<value>"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": {"id": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "endpoints": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "status": -3, "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}}
|
application/json: {"data": {"id": "openai/gpt-4", "name": "GPT-4", "created": 1692901234, "description": "GPT-4 is a large multimodal model that can solve difficult problems with greater accuracy.", "architecture": {"tokenizer": "GPT", "instruct_type": "chatml", "modality": "text->text", "input_modalities": ["text"], "output_modalities": ["text"]}, "endpoints": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens", "frequency_penalty", "presence_penalty"], "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}}
|
||||||
"404":
|
"404":
|
||||||
application/json: {"error": {"code": 404, "message": "Resource not found"}}
|
application/json: {"error": {"code": 404, "message": "Resource not found"}}
|
||||||
"500":
|
"500":
|
||||||
@@ -951,7 +952,7 @@ examples:
|
|||||||
speakeasy-default-list-endpoints-zdr:
|
speakeasy-default-list-endpoints-zdr:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006", "request": "0", "image": "0"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens"], "status": 0, "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}
|
application/json: {"data": [{"name": "OpenAI: GPT-4", "model_name": "GPT-4", "context_length": 8192, "pricing": {"prompt": "0.00003", "completion": "0.00006"}, "provider_name": "OpenAI", "tag": "openai", "quantization": "fp16", "max_completion_tokens": 4096, "max_prompt_tokens": 8192, "supported_parameters": ["temperature", "top_p", "max_tokens"], "uptime_last_30m": 99.5, "supports_implicit_caching": true}]}
|
||||||
"500":
|
"500":
|
||||||
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
|
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
|
||||||
getParameters:
|
getParameters:
|
||||||
@@ -973,7 +974,7 @@ examples:
|
|||||||
speakeasy-default-list-providers:
|
speakeasy-default-list-providers:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": [{"name": "OpenAI", "slug": "openai", "privacy_policy_url": "https://openai.com/privacy", "terms_of_service_url": "https://openai.com/terms", "status_page_url": "https://status.openai.com"}]}
|
application/json: {"data": [{"name": "OpenAI", "slug": "openai", "privacy_policy_url": "https://openai.com/privacy"}]}
|
||||||
"500":
|
"500":
|
||||||
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
|
application/json: {"error": {"code": 500, "message": "Internal Server Error"}}
|
||||||
list:
|
list:
|
||||||
@@ -984,7 +985,7 @@ examples:
|
|||||||
offset: "0"
|
offset: "0"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": [{"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z", "expires_at": "2027-12-31T23:59:59Z"}]}
|
application/json: {"data": [{"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z"}]}
|
||||||
"401":
|
"401":
|
||||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||||
"429":
|
"429":
|
||||||
@@ -994,10 +995,10 @@ examples:
|
|||||||
createKeys:
|
createKeys:
|
||||||
speakeasy-default-create-keys:
|
speakeasy-default-create-keys:
|
||||||
requestBody:
|
requestBody:
|
||||||
application/json: {"name": "My New API Key", "limit": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "expires_at": "2027-12-31T23:59:59Z"}
|
application/json: {"name": "My New API Key"}
|
||||||
responses:
|
responses:
|
||||||
"201":
|
"201":
|
||||||
application/json: {"data": {"hash": "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", "name": "My New API Key", "label": "My New API Key", "disabled": false, "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "usage": 0, "usage_daily": 0, "usage_weekly": 0, "usage_monthly": 0, "byok_usage": 0, "byok_usage_daily": 0, "byok_usage_weekly": 0, "byok_usage_monthly": 0, "created_at": "2025-08-24T10:30:00Z", "updated_at": null, "expires_at": "2027-12-31T23:59:59Z"}, "key": "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"}
|
application/json: {"data": {"hash": "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", "name": "My New API Key", "label": "My New API Key", "disabled": false, "limit": 50, "limit_remaining": 50, "limit_reset": "monthly", "include_byok_in_limit": true, "usage": 0, "usage_daily": 0, "usage_weekly": 0, "usage_monthly": 0, "byok_usage": 0, "byok_usage_daily": 0, "byok_usage_weekly": 0, "byok_usage_monthly": 0, "created_at": "2025-08-24T10:30:00Z", "updated_at": null}, "key": "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"}
|
||||||
"400":
|
"400":
|
||||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||||
"401":
|
"401":
|
||||||
@@ -1012,10 +1013,10 @@ examples:
|
|||||||
path:
|
path:
|
||||||
hash: "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"
|
hash: "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"
|
||||||
requestBody:
|
requestBody:
|
||||||
application/json: {"name": "Updated API Key Name", "disabled": false, "limit": 75, "limit_reset": "daily", "include_byok_in_limit": true}
|
application/json: {}
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": {"hash": "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", "name": "Updated API Key Name", "label": "Updated API Key Name", "disabled": false, "limit": 75, "limit_remaining": 49.5, "limit_reset": "daily", "include_byok_in_limit": true, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T16:00:00Z", "expires_at": null}}
|
application/json: {"data": {"hash": "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", "name": "Updated API Key Name", "label": "Updated API Key Name", "disabled": false, "limit": 75, "limit_remaining": 49.5, "limit_reset": "daily", "include_byok_in_limit": true, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T16:00:00Z"}}
|
||||||
"400":
|
"400":
|
||||||
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
application/json: {"error": {"code": 400, "message": "Invalid request parameters"}}
|
||||||
"401":
|
"401":
|
||||||
@@ -1049,7 +1050,7 @@ examples:
|
|||||||
hash: "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"
|
hash: "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"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": {"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z", "expires_at": "2027-12-31T23:59:59Z"}}
|
application/json: {"data": {"hash": "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", "name": "My Production Key", "label": "Production API Key", "disabled": false, "limit": 100, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "created_at": "2025-08-24T10:30:00Z", "updated_at": "2025-08-24T15:45:00Z"}}
|
||||||
"401":
|
"401":
|
||||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||||
"404":
|
"404":
|
||||||
@@ -1062,7 +1063,7 @@ examples:
|
|||||||
speakeasy-default-get-current-key:
|
speakeasy-default-get-current-key:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": {"label": "sk-or-v1-au78b3456789012345678901234567890", "limit": 100, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "is_free_tier": false, "is_provisioning_key": false, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "expires_at": "2027-12-31T23:59:59Z", "rate_limit": {"requests": 1000, "interval": "1h", "note": "This field is deprecated and safe to ignore."}}}
|
application/json: {"data": {"label": "sk-or-v1-au78b3456789012345678901234567890", "limit": 100, "usage": 25.5, "usage_daily": 25.5, "usage_weekly": 25.5, "usage_monthly": 25.5, "byok_usage": 17.38, "byok_usage_daily": 17.38, "byok_usage_weekly": 17.38, "byok_usage_monthly": 17.38, "is_free_tier": false, "is_provisioning_key": false, "limit_remaining": 74.5, "limit_reset": "monthly", "include_byok_in_limit": false, "rate_limit": {"requests": 1000, "interval": "1h", "note": "This field is deprecated and safe to ignore."}}}
|
||||||
"401":
|
"401":
|
||||||
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
application/json: {"error": {"code": 401, "message": "Missing Authentication header"}}
|
||||||
"500":
|
"500":
|
||||||
@@ -1070,7 +1071,7 @@ examples:
|
|||||||
exchangeAuthCodeForAPIKey:
|
exchangeAuthCodeForAPIKey:
|
||||||
speakeasy-default-exchange-auth-code-for-API-key:
|
speakeasy-default-exchange-auth-code-for-API-key:
|
||||||
requestBody:
|
requestBody:
|
||||||
application/json: {"code": "auth_code_abc123def456", "code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk", "code_challenge_method": "S256"}
|
application/json: {"code": "auth_code_abc123def456"}
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"key": "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", "user_id": "user_2yOPcMpKoQhcd4bVgSMlELRaIah"}
|
application/json: {"key": "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", "user_id": "user_2yOPcMpKoQhcd4bVgSMlELRaIah"}
|
||||||
@@ -1083,7 +1084,7 @@ examples:
|
|||||||
createAuthKeysCode:
|
createAuthKeysCode:
|
||||||
speakeasy-default-create-auth-keys-code:
|
speakeasy-default-create-auth-keys-code:
|
||||||
requestBody:
|
requestBody:
|
||||||
application/json: {"callback_url": "https://myapp.com/auth/callback", "code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM", "code_challenge_method": "S256", "limit": 100}
|
application/json: {"callback_url": "https://myapp.com/auth/callback"}
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"data": {"id": "auth_code_xyz789", "app_id": 12345, "created_at": "2025-08-24T10:30:00Z"}}
|
application/json: {"data": {"id": "auth_code_xyz789", "app_id": 12345, "created_at": "2025-08-24T10:30:00Z"}}
|
||||||
|
|||||||
+7
-5
@@ -6,7 +6,7 @@ generation:
|
|||||||
sdkClassName: OpenRouter
|
sdkClassName: OpenRouter
|
||||||
maintainOpenAPIOrder: true
|
maintainOpenAPIOrder: true
|
||||||
usageSnippets:
|
usageSnippets:
|
||||||
optionalPropertyRendering: withExample
|
optionalPropertyRendering: never
|
||||||
sdkInitStyle: constructor
|
sdkInitStyle: constructor
|
||||||
useClassNamesForArrayFields: true
|
useClassNamesForArrayFields: true
|
||||||
fixes:
|
fixes:
|
||||||
@@ -24,13 +24,14 @@ generation:
|
|||||||
sdkHooksConfigAccess: true
|
sdkHooksConfigAccess: true
|
||||||
schemas:
|
schemas:
|
||||||
allOfMergeStrategy: shallowMerge
|
allOfMergeStrategy: shallowMerge
|
||||||
requestBodyFieldName: body
|
requestBodyFieldName: ""
|
||||||
tests:
|
tests:
|
||||||
generateTests: false
|
generateTests: false
|
||||||
generateNewTests: true
|
generateNewTests: true
|
||||||
skipResponseBodyAssertions: false
|
skipResponseBodyAssertions: false
|
||||||
|
preApplyUnionDiscriminators: true
|
||||||
python:
|
python:
|
||||||
version: 0.1.1
|
version: 0.0.21
|
||||||
additionalDependencies:
|
additionalDependencies:
|
||||||
dev: {}
|
dev: {}
|
||||||
main: {}
|
main: {}
|
||||||
@@ -57,11 +58,12 @@ python:
|
|||||||
imports:
|
imports:
|
||||||
option: openapi
|
option: openapi
|
||||||
paths:
|
paths:
|
||||||
callbacks: ""
|
callbacks: callbacks
|
||||||
errors: errors
|
errors: errors
|
||||||
operations: operations
|
operations: operations
|
||||||
shared: components
|
shared: components
|
||||||
webhooks: ""
|
webhooks: webhooks
|
||||||
|
inferSSEOverload: true
|
||||||
inferUnionDiscriminators: true
|
inferUnionDiscriminators: true
|
||||||
inputModelSuffix: input
|
inputModelSuffix: input
|
||||||
legacyPyright: false
|
legacyPyright: false
|
||||||
|
|||||||
@@ -3516,6 +3516,7 @@ components:
|
|||||||
- Relace
|
- Relace
|
||||||
- SambaNova
|
- SambaNova
|
||||||
- SiliconFlow
|
- SiliconFlow
|
||||||
|
- Sourceful
|
||||||
- Stealth
|
- Stealth
|
||||||
- StreamLake
|
- StreamLake
|
||||||
- Switchpoint
|
- Switchpoint
|
||||||
@@ -3816,6 +3817,11 @@ components:
|
|||||||
maxLength: 128
|
maxLength: 128
|
||||||
description: >-
|
description: >-
|
||||||
A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
||||||
|
session_id:
|
||||||
|
type: string
|
||||||
|
maxLength: 128
|
||||||
|
description: >-
|
||||||
|
A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||||
description: Request schema for Responses endpoint
|
description: Request schema for Responses endpoint
|
||||||
example:
|
example:
|
||||||
model: anthropic/claude-4.5-sonnet-20250929
|
model: anthropic/claude-4.5-sonnet-20250929
|
||||||
@@ -6242,6 +6248,11 @@ paths:
|
|||||||
- object
|
- object
|
||||||
- data
|
- data
|
||||||
- model
|
- model
|
||||||
|
text/event-stream:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Not used for embeddings - embeddings do not support streaming
|
||||||
|
x-speakeasy-sse-sentinel: '[DONE]'
|
||||||
'400':
|
'400':
|
||||||
description: Bad Request - Invalid request parameters or malformed input
|
description: Bad Request - Invalid request parameters or malformed input
|
||||||
content:
|
content:
|
||||||
@@ -6826,6 +6837,7 @@ paths:
|
|||||||
- Relace
|
- Relace
|
||||||
- SambaNova
|
- SambaNova
|
||||||
- SiliconFlow
|
- SiliconFlow
|
||||||
|
- Sourceful
|
||||||
- Stealth
|
- Stealth
|
||||||
- StreamLake
|
- StreamLake
|
||||||
- Switchpoint
|
- Switchpoint
|
||||||
@@ -8437,5 +8449,3 @@ x-speakeasy-globals:
|
|||||||
parameters:
|
parameters:
|
||||||
- $ref: "#/components/parameters/AppIdentifier"
|
- $ref: "#/components/parameters/AppIdentifier"
|
||||||
- $ref: "#/components/parameters/AppDisplayName"
|
- $ref: "#/components/parameters/AppDisplayName"
|
||||||
- $ref: "#/components/parameters/AppIdentifier"
|
|
||||||
- $ref: "#/components/parameters/AppDisplayName"
|
|
||||||
|
|||||||
@@ -6,30 +6,37 @@ sources:
|
|||||||
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
|
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
|
OpenRouter API:
|
||||||
|
sourceNamespace: open-router-chat-completions-api
|
||||||
|
sourceRevisionDigest: sha256:9b410c8cfafe475dc6d9550f97a1e755b9a02b54513d3a85efe606e9bb05ca57
|
||||||
|
sourceBlobDigest: sha256:61a2d897cc5ddd893a5131bfacad7fcc311fe5b2eaaa5641fbb0a5b3321bfde7
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- 1.0.0
|
||||||
targets:
|
targets:
|
||||||
open-router:
|
open-router:
|
||||||
source: -OAS
|
source: OpenRouter API
|
||||||
sourceNamespace: open-router-chat-completions-api
|
sourceNamespace: open-router-chat-completions-api
|
||||||
sourceRevisionDigest: sha256:f1b59b9b643de5e20d6e3299a8274783d8c0854615876f5d7f6f081814842695
|
sourceRevisionDigest: sha256:9b410c8cfafe475dc6d9550f97a1e755b9a02b54513d3a85efe606e9bb05ca57
|
||||||
sourceBlobDigest: sha256:ee1f2422281b3ed5b38951c74636ad192c9bb160f216069c1f7931ccc4e52553
|
sourceBlobDigest: sha256:61a2d897cc5ddd893a5131bfacad7fcc311fe5b2eaaa5641fbb0a5b3321bfde7
|
||||||
workflow:
|
workflow:
|
||||||
workflowVersion: 1.0.0
|
workflowVersion: 1.0.0
|
||||||
speakeasyVersion: 1.666.0
|
speakeasyVersion: 1.666.0
|
||||||
sources:
|
sources:
|
||||||
-OAS:
|
OpenRouter API:
|
||||||
inputs:
|
inputs:
|
||||||
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
- location: .speakeasy/in.openapi.yaml
|
||||||
overlays:
|
overlays:
|
||||||
- location: .speakeasy/overlays/open-enums.overlay.yaml
|
- location: .speakeasy/overlays/open-enums.overlay.yaml
|
||||||
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
|
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
|
||||||
- location: .speakeasy/overlays/add-headers.overlay.yaml
|
- location: .speakeasy/overlays/add-headers.overlay.yaml
|
||||||
output: .speakeasy/out.openapi.yaml
|
output: .speakeasy/out.openapi.yaml
|
||||||
registry:
|
registry:
|
||||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||||
targets:
|
targets:
|
||||||
open-router:
|
open-router:
|
||||||
target: python
|
target: python
|
||||||
source: -OAS
|
source: OpenRouter API
|
||||||
publish:
|
publish:
|
||||||
pypi:
|
pypi:
|
||||||
token: $pypi_token
|
token: $pypi_token
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
workflowVersion: 1.0.0
|
workflowVersion: 1.0.0
|
||||||
speakeasyVersion: 1.666.0
|
speakeasyVersion: 1.666.0
|
||||||
sources:
|
sources:
|
||||||
-OAS:
|
OpenRouter API:
|
||||||
inputs:
|
inputs:
|
||||||
- location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api:main
|
- location: .speakeasy/in.openapi.yaml
|
||||||
overlays:
|
overlays:
|
||||||
- location: .speakeasy/overlays/open-enums.overlay.yaml
|
- location: .speakeasy/overlays/open-enums.overlay.yaml
|
||||||
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
|
- location: .speakeasy/overlays/remove-rss-responses.overlay.yaml
|
||||||
- location: .speakeasy/overlays/add-headers.overlay.yaml
|
- location: .speakeasy/overlays/add-headers.overlay.yaml
|
||||||
output: .speakeasy/out.openapi.yaml
|
output: .speakeasy/out.openapi.yaml
|
||||||
registry:
|
registry:
|
||||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas
|
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-chat-completions-api
|
||||||
targets:
|
targets:
|
||||||
open-router:
|
open-router:
|
||||||
target: python
|
target: python
|
||||||
source: -OAS
|
source: OpenRouter API
|
||||||
publish:
|
publish:
|
||||||
pypi:
|
pypi:
|
||||||
token: $pypi_token
|
token: $pypi_token
|
||||||
codeSamples:
|
codeSamples:
|
||||||
registry:
|
registry:
|
||||||
location: registry.speakeasyapi.dev/openrouter/sdk/-oas-python-code-samples
|
location: registry.speakeasyapi.dev/openrouter/sdk/open-router-python-code-samples
|
||||||
labelOverride:
|
labelOverride:
|
||||||
fixedValue: Python (SDK)
|
fixedValue: Python (SDK)
|
||||||
blocking: false
|
blocking: false
|
||||||
|
|||||||
@@ -9,61 +9,7 @@ with OpenRouter(
|
|||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
|
|
||||||
res = open_router.beta.responses.send(input=[
|
res = open_router.beta.responses.send(service_tier="auto", stream=False)
|
||||||
{
|
|
||||||
"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",
|
|
||||||
})
|
|
||||||
|
|
||||||
with res as event_stream:
|
with res as event_stream:
|
||||||
for event in event_stream:
|
for event in event_stream:
|
||||||
@@ -87,61 +33,7 @@ async def main():
|
|||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
|
|
||||||
res = await open_router.beta.responses.send_async(input=[
|
res = await open_router.beta.responses.send_async(service_tier="auto", stream=False)
|
||||||
{
|
|
||||||
"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",
|
|
||||||
})
|
|
||||||
|
|
||||||
async with res as event_stream:
|
async with res as event_stream:
|
||||||
async for event in event_stream:
|
async for event in event_stream:
|
||||||
|
|||||||
@@ -34,3 +34,4 @@ Request schema for Responses endpoint
|
|||||||
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||||
| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||||
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
|
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
|
||||||
|
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |
|
||||||
@@ -61,6 +61,7 @@
|
|||||||
| `RELACE` | Relace |
|
| `RELACE` | Relace |
|
||||||
| `SAMBA_NOVA` | SambaNova |
|
| `SAMBA_NOVA` | SambaNova |
|
||||||
| `SILICON_FLOW` | SiliconFlow |
|
| `SILICON_FLOW` | SiliconFlow |
|
||||||
|
| `SOURCEFUL` | Sourceful |
|
||||||
| `STEALTH` | Stealth |
|
| `STEALTH` | Stealth |
|
||||||
| `STREAM_LAKE` | StreamLake |
|
| `STREAM_LAKE` | StreamLake |
|
||||||
| `SWITCHPOINT` | Switchpoint |
|
| `SWITCHPOINT` | Switchpoint |
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
# CreateEmbeddingsResponse
|
# 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 |
|
||||||
@@ -61,6 +61,7 @@
|
|||||||
| `RELACE` | Relace |
|
| `RELACE` | Relace |
|
||||||
| `SAMBA_NOVA` | SambaNova |
|
| `SAMBA_NOVA` | SambaNova |
|
||||||
| `SILICON_FLOW` | SiliconFlow |
|
| `SILICON_FLOW` | SiliconFlow |
|
||||||
|
| `SOURCEFUL` | Sourceful |
|
||||||
| `STEALTH` | Stealth |
|
| `STEALTH` | Stealth |
|
||||||
| `STREAM_LAKE` | StreamLake |
|
| `STREAM_LAKE` | StreamLake |
|
||||||
| `SWITCHPOINT` | Switchpoint |
|
| `SWITCHPOINT` | Switchpoint |
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
| Field | Type | Required | Description | Example |
|
| Field | Type | Required | Description | Example |
|
||||||
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `hash` | *str* | :heavy_check_mark: | The hash identifier of the API key to update | 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 |
|
| `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" -->
|
<!-- UsageSnippet language="python" operationID="createKeys" method="post" path="/keys" -->
|
||||||
```python
|
```python
|
||||||
from openrouter import OpenRouter
|
from openrouter import OpenRouter
|
||||||
from openrouter.utils import parse_datetime
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
@@ -75,7 +74,7 @@ with OpenRouter(
|
|||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) 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
|
# Handle response
|
||||||
print(res)
|
print(res)
|
||||||
@@ -123,7 +122,7 @@ with OpenRouter(
|
|||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) 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
|
# Handle response
|
||||||
print(res)
|
print(res)
|
||||||
|
|||||||
@@ -26,24 +26,7 @@ with OpenRouter(
|
|||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
|
|
||||||
res = open_router.embeddings.generate(input="<value>", model="Taurus", provider={
|
res = open_router.embeddings.generate(input="<value>", model="Taurus")
|
||||||
"data_collection": "allow",
|
|
||||||
"zdr": True,
|
|
||||||
"enforce_distillable_text": True,
|
|
||||||
"order": [
|
|
||||||
"OpenAI",
|
|
||||||
],
|
|
||||||
"only": [
|
|
||||||
"OpenAI",
|
|
||||||
],
|
|
||||||
"ignore": [
|
|
||||||
"OpenAI",
|
|
||||||
],
|
|
||||||
"quantizations": [
|
|
||||||
"fp16",
|
|
||||||
],
|
|
||||||
"sort": "price",
|
|
||||||
})
|
|
||||||
|
|
||||||
# Handle response
|
# Handle response
|
||||||
print(res)
|
print(res)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ with OpenRouter(
|
|||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) 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
|
# Handle response
|
||||||
print(res)
|
print(res)
|
||||||
@@ -71,7 +71,7 @@ with OpenRouter(
|
|||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) 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
|
# Handle response
|
||||||
print(res)
|
print(res)
|
||||||
|
|||||||
@@ -25,61 +25,7 @@ with OpenRouter(
|
|||||||
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
api_key=os.getenv("OPENROUTER_API_KEY", ""),
|
||||||
) as open_router:
|
) as open_router:
|
||||||
|
|
||||||
res = open_router.beta.responses.send(input=[
|
res = open_router.beta.responses.send(service_tier="auto", stream=False)
|
||||||
{
|
|
||||||
"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",
|
|
||||||
})
|
|
||||||
|
|
||||||
with res as event_stream:
|
with res as event_stream:
|
||||||
for event in event_stream:
|
for event in event_stream:
|
||||||
@@ -118,6 +64,7 @@ with OpenRouter(
|
|||||||
| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | |
|
||||||
| `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
| `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | |
|
||||||
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
|
| `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | |
|
||||||
|
| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | |
|
||||||
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
|
| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | |
|
||||||
|
|
||||||
### Response
|
### Response
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "openrouter"
|
name = "openrouter"
|
||||||
version = "0.1.1"
|
version = "0.0.21"
|
||||||
description = "Official Python Client SDK for OpenRouter."
|
description = "Official Python Client SDK for OpenRouter."
|
||||||
authors = [{ name = "OpenRouter" },]
|
authors = [{ name = "OpenRouter" },]
|
||||||
readme = "README-PYPI.md"
|
readme = "README-PYPI.md"
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
import importlib.metadata
|
import importlib.metadata
|
||||||
|
|
||||||
__title__: str = "openrouter"
|
__title__: str = "openrouter"
|
||||||
__version__: str = "0.1.1"
|
__version__: str = "0.0.21"
|
||||||
__openapi_doc_version__: str = "1.0.0"
|
__openapi_doc_version__: str = "1.0.0"
|
||||||
__gen_version__: str = "2.768.0"
|
__gen_version__: str = "2.768.0"
|
||||||
__user_agent__: str = "speakeasy-sdk/python 0.1.1 2.768.0 1.0.0 openrouter"
|
__user_agent__: str = "speakeasy-sdk/python 0.0.21 2.768.0 1.0.0 openrouter"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if __package__ is not None:
|
if __package__ is not None:
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ class APIKeys(BaseSDK):
|
|||||||
|
|
||||||
request = operations.UpdateKeysRequest(
|
request = operations.UpdateKeysRequest(
|
||||||
hash=hash,
|
hash=hash,
|
||||||
body=operations.UpdateKeysRequestBody(
|
request_body=operations.UpdateKeysRequestBody(
|
||||||
name=name,
|
name=name,
|
||||||
disabled=disabled,
|
disabled=disabled,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
@@ -529,7 +529,11 @@ class APIKeys(BaseSDK):
|
|||||||
http_headers=http_headers,
|
http_headers=http_headers,
|
||||||
security=self.sdk_configuration.security,
|
security=self.sdk_configuration.security,
|
||||||
get_serialized_body=lambda: utils.serialize_request_body(
|
get_serialized_body=lambda: utils.serialize_request_body(
|
||||||
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
request.request_body,
|
||||||
|
False,
|
||||||
|
False,
|
||||||
|
"json",
|
||||||
|
operations.UpdateKeysRequestBody,
|
||||||
),
|
),
|
||||||
allow_empty_value=None,
|
allow_empty_value=None,
|
||||||
timeout_ms=timeout_ms,
|
timeout_ms=timeout_ms,
|
||||||
@@ -638,7 +642,7 @@ class APIKeys(BaseSDK):
|
|||||||
|
|
||||||
request = operations.UpdateKeysRequest(
|
request = operations.UpdateKeysRequest(
|
||||||
hash=hash,
|
hash=hash,
|
||||||
body=operations.UpdateKeysRequestBody(
|
request_body=operations.UpdateKeysRequestBody(
|
||||||
name=name,
|
name=name,
|
||||||
disabled=disabled,
|
disabled=disabled,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
@@ -661,7 +665,11 @@ class APIKeys(BaseSDK):
|
|||||||
http_headers=http_headers,
|
http_headers=http_headers,
|
||||||
security=self.sdk_configuration.security,
|
security=self.sdk_configuration.security,
|
||||||
get_serialized_body=lambda: utils.serialize_request_body(
|
get_serialized_body=lambda: utils.serialize_request_body(
|
||||||
request.body, False, False, "json", operations.UpdateKeysRequestBody
|
request.request_body,
|
||||||
|
False,
|
||||||
|
False,
|
||||||
|
"json",
|
||||||
|
operations.UpdateKeysRequestBody,
|
||||||
),
|
),
|
||||||
allow_empty_value=None,
|
allow_empty_value=None,
|
||||||
timeout_ms=timeout_ms,
|
timeout_ms=timeout_ms,
|
||||||
|
|||||||
@@ -497,6 +497,8 @@ class OpenResponsesRequestTypedDict(TypedDict):
|
|||||||
r"""Plugins you want to enable for this request, including their settings."""
|
r"""Plugins you want to enable for this request, including their settings."""
|
||||||
user: NotRequired[str]
|
user: NotRequired[str]
|
||||||
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
|
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
|
||||||
|
session_id: NotRequired[str]
|
||||||
|
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
|
||||||
|
|
||||||
|
|
||||||
class OpenResponsesRequest(BaseModel):
|
class OpenResponsesRequest(BaseModel):
|
||||||
@@ -574,6 +576,9 @@ class OpenResponsesRequest(BaseModel):
|
|||||||
user: Optional[str] = None
|
user: Optional[str] = None
|
||||||
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
|
r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters."""
|
||||||
|
|
||||||
|
session_id: Optional[str] = None
|
||||||
|
r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters."""
|
||||||
|
|
||||||
@model_serializer(mode="wrap")
|
@model_serializer(mode="wrap")
|
||||||
def serialize_model(self, handler):
|
def serialize_model(self, handler):
|
||||||
optional_fields = [
|
optional_fields = [
|
||||||
@@ -604,6 +609,7 @@ class OpenResponsesRequest(BaseModel):
|
|||||||
"provider",
|
"provider",
|
||||||
"plugins",
|
"plugins",
|
||||||
"user",
|
"user",
|
||||||
|
"session_id",
|
||||||
]
|
]
|
||||||
nullable_fields = [
|
nullable_fields = [
|
||||||
"instructions",
|
"instructions",
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ ProviderName = Union[
|
|||||||
"Relace",
|
"Relace",
|
||||||
"SambaNova",
|
"SambaNova",
|
||||||
"SiliconFlow",
|
"SiliconFlow",
|
||||||
|
"Sourceful",
|
||||||
"Stealth",
|
"Stealth",
|
||||||
"StreamLake",
|
"StreamLake",
|
||||||
"Switchpoint",
|
"Switchpoint",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
||||||
|
|
||||||
from .basesdk import BaseSDK
|
from .basesdk import BaseSDK
|
||||||
|
from enum import Enum
|
||||||
from openrouter import components, errors, operations, utils
|
from openrouter import components, errors, operations, utils
|
||||||
from openrouter._hooks import HookContext
|
from openrouter._hooks import HookContext
|
||||||
from openrouter.types import OptionalNullable, UNSET
|
from openrouter.types import OptionalNullable, UNSET
|
||||||
@@ -9,6 +10,11 @@ from openrouter.utils.unmarshal_json_response import unmarshal_json_response
|
|||||||
from typing import Any, Mapping, Optional, Union
|
from typing import Any, Mapping, Optional, Union
|
||||||
|
|
||||||
|
|
||||||
|
class GenerateAcceptEnum(str, Enum):
|
||||||
|
APPLICATION_JSON = "application/json"
|
||||||
|
TEXT_EVENT_STREAM = "text/event-stream"
|
||||||
|
|
||||||
|
|
||||||
class Embeddings(BaseSDK):
|
class Embeddings(BaseSDK):
|
||||||
r"""Text embedding endpoints"""
|
r"""Text embedding endpoints"""
|
||||||
|
|
||||||
@@ -30,6 +36,7 @@ class Embeddings(BaseSDK):
|
|||||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||||
server_url: Optional[str] = None,
|
server_url: Optional[str] = None,
|
||||||
timeout_ms: Optional[int] = None,
|
timeout_ms: Optional[int] = None,
|
||||||
|
accept_header_override: Optional[GenerateAcceptEnum] = None,
|
||||||
http_headers: Optional[Mapping[str, str]] = None,
|
http_headers: Optional[Mapping[str, str]] = None,
|
||||||
) -> operations.CreateEmbeddingsResponse:
|
) -> operations.CreateEmbeddingsResponse:
|
||||||
r"""Submit an embedding request
|
r"""Submit an embedding request
|
||||||
@@ -46,6 +53,7 @@ class Embeddings(BaseSDK):
|
|||||||
:param retries: Override the default retry configuration for this method
|
:param retries: Override the default retry configuration for this method
|
||||||
:param server_url: Override the default server URL for this method
|
:param server_url: Override the default server URL for this method
|
||||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||||
|
:param accept_header_override: Override the default accept header for this method
|
||||||
:param http_headers: Additional headers to set or replace on requests.
|
:param http_headers: Additional headers to set or replace on requests.
|
||||||
"""
|
"""
|
||||||
base_url = None
|
base_url = None
|
||||||
@@ -80,7 +88,9 @@ class Embeddings(BaseSDK):
|
|||||||
request_has_path_params=False,
|
request_has_path_params=False,
|
||||||
request_has_query_params=True,
|
request_has_query_params=True,
|
||||||
user_agent_header="user-agent",
|
user_agent_header="user-agent",
|
||||||
accept_header_value="application/json",
|
accept_header_value=accept_header_override.value
|
||||||
|
if accept_header_override is not None
|
||||||
|
else "application/json;q=1, text/event-stream;q=0",
|
||||||
http_headers=http_headers,
|
http_headers=http_headers,
|
||||||
security=self.sdk_configuration.security,
|
security=self.sdk_configuration.security,
|
||||||
get_serialized_body=lambda: utils.serialize_request_body(
|
get_serialized_body=lambda: utils.serialize_request_body(
|
||||||
@@ -129,8 +139,10 @@ class Embeddings(BaseSDK):
|
|||||||
response_data: Any = None
|
response_data: Any = None
|
||||||
if utils.match_response(http_res, "200", "application/json"):
|
if utils.match_response(http_res, "200", "application/json"):
|
||||||
return unmarshal_json_response(
|
return unmarshal_json_response(
|
||||||
operations.CreateEmbeddingsResponse, http_res
|
operations.CreateEmbeddingsResponseBody, http_res
|
||||||
)
|
)
|
||||||
|
if utils.match_response(http_res, "200", "text/event-stream"):
|
||||||
|
return http_res.text
|
||||||
if utils.match_response(http_res, "400", "application/json"):
|
if utils.match_response(http_res, "400", "application/json"):
|
||||||
response_data = unmarshal_json_response(
|
response_data = unmarshal_json_response(
|
||||||
errors.BadRequestResponseErrorData, http_res
|
errors.BadRequestResponseErrorData, http_res
|
||||||
@@ -212,6 +224,7 @@ class Embeddings(BaseSDK):
|
|||||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||||
server_url: Optional[str] = None,
|
server_url: Optional[str] = None,
|
||||||
timeout_ms: Optional[int] = None,
|
timeout_ms: Optional[int] = None,
|
||||||
|
accept_header_override: Optional[GenerateAcceptEnum] = None,
|
||||||
http_headers: Optional[Mapping[str, str]] = None,
|
http_headers: Optional[Mapping[str, str]] = None,
|
||||||
) -> operations.CreateEmbeddingsResponse:
|
) -> operations.CreateEmbeddingsResponse:
|
||||||
r"""Submit an embedding request
|
r"""Submit an embedding request
|
||||||
@@ -228,6 +241,7 @@ class Embeddings(BaseSDK):
|
|||||||
:param retries: Override the default retry configuration for this method
|
:param retries: Override the default retry configuration for this method
|
||||||
:param server_url: Override the default server URL for this method
|
:param server_url: Override the default server URL for this method
|
||||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||||
|
:param accept_header_override: Override the default accept header for this method
|
||||||
:param http_headers: Additional headers to set or replace on requests.
|
:param http_headers: Additional headers to set or replace on requests.
|
||||||
"""
|
"""
|
||||||
base_url = None
|
base_url = None
|
||||||
@@ -262,7 +276,9 @@ class Embeddings(BaseSDK):
|
|||||||
request_has_path_params=False,
|
request_has_path_params=False,
|
||||||
request_has_query_params=True,
|
request_has_query_params=True,
|
||||||
user_agent_header="user-agent",
|
user_agent_header="user-agent",
|
||||||
accept_header_value="application/json",
|
accept_header_value=accept_header_override.value
|
||||||
|
if accept_header_override is not None
|
||||||
|
else "application/json;q=1, text/event-stream;q=0",
|
||||||
http_headers=http_headers,
|
http_headers=http_headers,
|
||||||
security=self.sdk_configuration.security,
|
security=self.sdk_configuration.security,
|
||||||
get_serialized_body=lambda: utils.serialize_request_body(
|
get_serialized_body=lambda: utils.serialize_request_body(
|
||||||
@@ -311,8 +327,10 @@ class Embeddings(BaseSDK):
|
|||||||
response_data: Any = None
|
response_data: Any = None
|
||||||
if utils.match_response(http_res, "200", "application/json"):
|
if utils.match_response(http_res, "200", "application/json"):
|
||||||
return unmarshal_json_response(
|
return unmarshal_json_response(
|
||||||
operations.CreateEmbeddingsResponse, http_res
|
operations.CreateEmbeddingsResponseBody, http_res
|
||||||
)
|
)
|
||||||
|
if utils.match_response(http_res, "200", "text/event-stream"):
|
||||||
|
return http_res.text
|
||||||
if utils.match_response(http_res, "400", "application/json"):
|
if utils.match_response(http_res, "400", "application/json"):
|
||||||
response_data = unmarshal_json_response(
|
response_data = unmarshal_json_response(
|
||||||
errors.BadRequestResponseErrorData, http_res
|
errors.BadRequestResponseErrorData, http_res
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ if TYPE_CHECKING:
|
|||||||
CreateEmbeddingsRequest,
|
CreateEmbeddingsRequest,
|
||||||
CreateEmbeddingsRequestTypedDict,
|
CreateEmbeddingsRequestTypedDict,
|
||||||
CreateEmbeddingsResponse,
|
CreateEmbeddingsResponse,
|
||||||
|
CreateEmbeddingsResponseBody,
|
||||||
|
CreateEmbeddingsResponseBodyTypedDict,
|
||||||
CreateEmbeddingsResponseTypedDict,
|
CreateEmbeddingsResponseTypedDict,
|
||||||
Embedding,
|
Embedding,
|
||||||
EmbeddingTypedDict,
|
EmbeddingTypedDict,
|
||||||
@@ -219,6 +221,8 @@ __all__ = [
|
|||||||
"CreateEmbeddingsRequest",
|
"CreateEmbeddingsRequest",
|
||||||
"CreateEmbeddingsRequestTypedDict",
|
"CreateEmbeddingsRequestTypedDict",
|
||||||
"CreateEmbeddingsResponse",
|
"CreateEmbeddingsResponse",
|
||||||
|
"CreateEmbeddingsResponseBody",
|
||||||
|
"CreateEmbeddingsResponseBodyTypedDict",
|
||||||
"CreateEmbeddingsResponseTypedDict",
|
"CreateEmbeddingsResponseTypedDict",
|
||||||
"CreateKeysData",
|
"CreateKeysData",
|
||||||
"CreateKeysDataTypedDict",
|
"CreateKeysDataTypedDict",
|
||||||
@@ -373,6 +377,8 @@ _dynamic_imports: dict[str, str] = {
|
|||||||
"CreateEmbeddingsRequest": ".createembeddings",
|
"CreateEmbeddingsRequest": ".createembeddings",
|
||||||
"CreateEmbeddingsRequestTypedDict": ".createembeddings",
|
"CreateEmbeddingsRequestTypedDict": ".createembeddings",
|
||||||
"CreateEmbeddingsResponse": ".createembeddings",
|
"CreateEmbeddingsResponse": ".createembeddings",
|
||||||
|
"CreateEmbeddingsResponseBody": ".createembeddings",
|
||||||
|
"CreateEmbeddingsResponseBodyTypedDict": ".createembeddings",
|
||||||
"CreateEmbeddingsResponseTypedDict": ".createembeddings",
|
"CreateEmbeddingsResponseTypedDict": ".createembeddings",
|
||||||
"Embedding": ".createembeddings",
|
"Embedding": ".createembeddings",
|
||||||
"EmbeddingTypedDict": ".createembeddings",
|
"EmbeddingTypedDict": ".createembeddings",
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ class Usage(BaseModel):
|
|||||||
cost: Optional[float] = None
|
cost: Optional[float] = None
|
||||||
|
|
||||||
|
|
||||||
class CreateEmbeddingsResponseTypedDict(TypedDict):
|
class CreateEmbeddingsResponseBodyTypedDict(TypedDict):
|
||||||
r"""Embedding response"""
|
r"""Embedding response"""
|
||||||
|
|
||||||
object: Object
|
object: Object
|
||||||
@@ -405,7 +405,7 @@ class CreateEmbeddingsResponseTypedDict(TypedDict):
|
|||||||
usage: NotRequired[UsageTypedDict]
|
usage: NotRequired[UsageTypedDict]
|
||||||
|
|
||||||
|
|
||||||
class CreateEmbeddingsResponse(BaseModel):
|
class CreateEmbeddingsResponseBody(BaseModel):
|
||||||
r"""Embedding response"""
|
r"""Embedding response"""
|
||||||
|
|
||||||
object: Object
|
object: Object
|
||||||
@@ -417,3 +417,14 @@ class CreateEmbeddingsResponse(BaseModel):
|
|||||||
id: Optional[str] = None
|
id: Optional[str] = None
|
||||||
|
|
||||||
usage: Optional[Usage] = None
|
usage: Optional[Usage] = None
|
||||||
|
|
||||||
|
|
||||||
|
CreateEmbeddingsResponseTypedDict = TypeAliasType(
|
||||||
|
"CreateEmbeddingsResponseTypedDict",
|
||||||
|
Union[CreateEmbeddingsResponseBodyTypedDict, str],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
CreateEmbeddingsResponse = TypeAliasType(
|
||||||
|
"CreateEmbeddingsResponse", Union[CreateEmbeddingsResponseBody, str]
|
||||||
|
)
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ GetParametersProvider = Union[
|
|||||||
"Relace",
|
"Relace",
|
||||||
"SambaNova",
|
"SambaNova",
|
||||||
"SiliconFlow",
|
"SiliconFlow",
|
||||||
|
"Sourceful",
|
||||||
"Stealth",
|
"Stealth",
|
||||||
"StreamLake",
|
"StreamLake",
|
||||||
"Switchpoint",
|
"Switchpoint",
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class UpdateKeysRequestBody(BaseModel):
|
|||||||
class UpdateKeysRequestTypedDict(TypedDict):
|
class UpdateKeysRequestTypedDict(TypedDict):
|
||||||
hash: str
|
hash: str
|
||||||
r"""The hash identifier of the API key to update"""
|
r"""The hash identifier of the API key to update"""
|
||||||
body: UpdateKeysRequestBodyTypedDict
|
request_body: UpdateKeysRequestBodyTypedDict
|
||||||
|
|
||||||
|
|
||||||
class UpdateKeysRequest(BaseModel):
|
class UpdateKeysRequest(BaseModel):
|
||||||
@@ -114,7 +114,7 @@ class UpdateKeysRequest(BaseModel):
|
|||||||
]
|
]
|
||||||
r"""The hash identifier of the API key to update"""
|
r"""The hash identifier of the API key to update"""
|
||||||
|
|
||||||
body: Annotated[
|
request_body: Annotated[
|
||||||
UpdateKeysRequestBody,
|
UpdateKeysRequestBody,
|
||||||
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
FieldMetadata(request=RequestMetadata(media_type="application/json")),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ class Responses(BaseSDK):
|
|||||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||||
] = None,
|
] = None,
|
||||||
user: Optional[str] = None,
|
user: Optional[str] = None,
|
||||||
|
session_id: Optional[str] = None,
|
||||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||||
server_url: Optional[str] = None,
|
server_url: Optional[str] = None,
|
||||||
timeout_ms: Optional[int] = None,
|
timeout_ms: Optional[int] = None,
|
||||||
@@ -114,6 +115,7 @@ class Responses(BaseSDK):
|
|||||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||||
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
||||||
|
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||||
:param retries: Override the default retry configuration for this method
|
:param retries: Override the default retry configuration for this method
|
||||||
:param server_url: Override the default server URL for this method
|
:param server_url: Override the default server URL for this method
|
||||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||||
@@ -182,6 +184,7 @@ class Responses(BaseSDK):
|
|||||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||||
] = None,
|
] = None,
|
||||||
user: Optional[str] = None,
|
user: Optional[str] = None,
|
||||||
|
session_id: Optional[str] = None,
|
||||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||||
server_url: Optional[str] = None,
|
server_url: Optional[str] = None,
|
||||||
timeout_ms: Optional[int] = None,
|
timeout_ms: Optional[int] = None,
|
||||||
@@ -217,6 +220,7 @@ class Responses(BaseSDK):
|
|||||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||||
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
||||||
|
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||||
:param retries: Override the default retry configuration for this method
|
:param retries: Override the default retry configuration for this method
|
||||||
:param server_url: Override the default server URL for this method
|
:param server_url: Override the default server URL for this method
|
||||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||||
@@ -284,6 +288,7 @@ class Responses(BaseSDK):
|
|||||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||||
] = None,
|
] = None,
|
||||||
user: Optional[str] = None,
|
user: Optional[str] = None,
|
||||||
|
session_id: Optional[str] = None,
|
||||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||||
server_url: Optional[str] = None,
|
server_url: Optional[str] = None,
|
||||||
timeout_ms: Optional[int] = None,
|
timeout_ms: Optional[int] = None,
|
||||||
@@ -319,6 +324,7 @@ class Responses(BaseSDK):
|
|||||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||||
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
||||||
|
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||||
:param retries: Override the default retry configuration for this method
|
:param retries: Override the default retry configuration for this method
|
||||||
:param server_url: Override the default server URL for this method
|
:param server_url: Override the default server URL for this method
|
||||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||||
@@ -378,6 +384,7 @@ class Responses(BaseSDK):
|
|||||||
plugins, Optional[List[components.Plugin]]
|
plugins, Optional[List[components.Plugin]]
|
||||||
),
|
),
|
||||||
user=user,
|
user=user,
|
||||||
|
session_id=session_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
req = self._build_request(
|
req = self._build_request(
|
||||||
@@ -630,6 +637,7 @@ class Responses(BaseSDK):
|
|||||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||||
] = None,
|
] = None,
|
||||||
user: Optional[str] = None,
|
user: Optional[str] = None,
|
||||||
|
session_id: Optional[str] = None,
|
||||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||||
server_url: Optional[str] = None,
|
server_url: Optional[str] = None,
|
||||||
timeout_ms: Optional[int] = None,
|
timeout_ms: Optional[int] = None,
|
||||||
@@ -665,6 +673,7 @@ class Responses(BaseSDK):
|
|||||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||||
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
||||||
|
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||||
:param retries: Override the default retry configuration for this method
|
:param retries: Override the default retry configuration for this method
|
||||||
:param server_url: Override the default server URL for this method
|
:param server_url: Override the default server URL for this method
|
||||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||||
@@ -733,6 +742,7 @@ class Responses(BaseSDK):
|
|||||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||||
] = None,
|
] = None,
|
||||||
user: Optional[str] = None,
|
user: Optional[str] = None,
|
||||||
|
session_id: Optional[str] = None,
|
||||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||||
server_url: Optional[str] = None,
|
server_url: Optional[str] = None,
|
||||||
timeout_ms: Optional[int] = None,
|
timeout_ms: Optional[int] = None,
|
||||||
@@ -768,6 +778,7 @@ class Responses(BaseSDK):
|
|||||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||||
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
||||||
|
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||||
:param retries: Override the default retry configuration for this method
|
:param retries: Override the default retry configuration for this method
|
||||||
:param server_url: Override the default server URL for this method
|
:param server_url: Override the default server URL for this method
|
||||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||||
@@ -835,6 +846,7 @@ class Responses(BaseSDK):
|
|||||||
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
Union[List[components.Plugin], List[components.PluginTypedDict]]
|
||||||
] = None,
|
] = None,
|
||||||
user: Optional[str] = None,
|
user: Optional[str] = None,
|
||||||
|
session_id: Optional[str] = None,
|
||||||
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
||||||
server_url: Optional[str] = None,
|
server_url: Optional[str] = None,
|
||||||
timeout_ms: Optional[int] = None,
|
timeout_ms: Optional[int] = None,
|
||||||
@@ -870,6 +882,7 @@ class Responses(BaseSDK):
|
|||||||
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
:param provider: When multiple model providers are available, optionally indicate your routing preference.
|
||||||
:param plugins: Plugins you want to enable for this request, including their settings.
|
:param plugins: Plugins you want to enable for this request, including their settings.
|
||||||
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
:param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.
|
||||||
|
:param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.
|
||||||
:param retries: Override the default retry configuration for this method
|
:param retries: Override the default retry configuration for this method
|
||||||
:param server_url: Override the default server URL for this method
|
:param server_url: Override the default server URL for this method
|
||||||
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
||||||
@@ -929,6 +942,7 @@ class Responses(BaseSDK):
|
|||||||
plugins, Optional[List[components.Plugin]]
|
plugins, Optional[List[components.Plugin]]
|
||||||
),
|
),
|
||||||
user=user,
|
user=user,
|
||||||
|
session_id=session_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
req = self._build_request_async(
|
req = self._build_request_async(
|
||||||
|
|||||||
Reference in New Issue
Block a user