From 041d7f8befa9c73e7772ec1c2b3bf501496d176b Mon Sep 17 00:00:00 2001 From: David Alberto Adler Date: Sun, 7 Sep 2025 21:39:50 +0100 Subject: [PATCH] --- .speakeasy/gen.lock | 150 ++- .speakeasy/gen.yaml | 2 +- .../{input.openapi.yaml => in.openapi.yaml} | 200 +-- .speakeasy/out.openapi.yaml | 200 +-- .speakeasy/workflow.yaml | 2 +- README-PYPI.md | 1 + README.md | 1 + docs/models/chatcompletioncreateparams.md | 54 +- ....md => chatcompletioncreateparamsaudio.md} | 2 +- .../chatcompletioncreateparamscompletion.md | 23 + ...atcompletioncreateparamsdatacollection.md} | 2 +- ...md => chatcompletioncreateparamseffort.md} | 2 +- ...md => chatcompletioncreateparamsengine.md} | 2 +- ...completioncreateparamsidchainofthought.md} | 2 +- ...chatcompletioncreateparamsidfileparser.md} | 2 +- ...chatcompletioncreateparamsidmoderation.md} | 2 +- ....md => chatcompletioncreateparamsidweb.md} | 2 +- ...> chatcompletioncreateparamsignoreenum.md} | 2 +- .../chatcompletioncreateparamsignoreunion.md | 17 + ....md => chatcompletioncreateparamsimage.md} | 2 +- ...> chatcompletioncreateparamsjsonschema.md} | 2 +- .../chatcompletioncreateparamsmaxprice.md | 14 + ... => chatcompletioncreateparamsonlyenum.md} | 2 +- .../chatcompletioncreateparamsonlyunion.md | 17 + ...=> chatcompletioncreateparamsorderenum.md} | 2 +- .../chatcompletioncreateparamsorderunion.md | 17 + docs/models/chatcompletioncreateparamspdf.md | 8 + ...=> chatcompletioncreateparamspdfengine.md} | 2 +- ...pletioncreateparamspluginchainofthought.md | 8 + ...tcompletioncreateparamspluginfileparser.md | 10 + ...tcompletioncreateparamspluginmoderation.md | 8 + .../chatcompletioncreateparamspluginunion.md | 29 + .../chatcompletioncreateparamspluginweb.md | 11 + ...md => chatcompletioncreateparamsprompt.md} | 2 +- ... => chatcompletioncreateparamsprovider.md} | 16 +- ...chatcompletioncreateparamsquantization.md} | 2 +- .../chatcompletioncreateparamsreasoning.md | 13 + ...tcompletioncreateparamsreasoningeffort.md} | 2 +- ...d => chatcompletioncreateparamsrequest.md} | 2 +- ...letioncreateparamsresponseformatgrammar.md | 11 + ...ioncreateparamsresponseformatjsonobject.md | 10 + ...ioncreateparamsresponseformatjsonschema.md | 11 + ...pletioncreateparamsresponseformatpython.md | 10 + ...mpletioncreateparamsresponseformattext.md} | 2 +- ...mpletioncreateparamsresponseformatunion.md | 37 + ...t.md => chatcompletioncreateparamssort.md} | 2 +- ...p.md => chatcompletioncreateparamsstop.md} | 2 +- ...hatcompletioncreateparamsstreamoptions.md} | 2 +- ... chatcompletioncreateparamstypegrammar.md} | 2 +- ...atcompletioncreateparamstypejsonobject.md} | 2 +- ...atcompletioncreateparamstypejsonschema.md} | 2 +- ...> chatcompletioncreateparamstypepython.md} | 2 +- .../chatstreamcompletioncreateparams.md | 34 + .../chatstreamcompletioncreateparamsaudio.md | 23 + ...tstreamcompletioncreateparamscompletion.md | 23 + ...eamcompletioncreateparamsdatacollection.md | 14 + .../chatstreamcompletioncreateparamseffort.md | 13 + .../chatstreamcompletioncreateparamsengine.md | 9 + ...mcompletioncreateparamsidchainofthought.md | 8 + ...treamcompletioncreateparamsidfileparser.md | 8 + ...treamcompletioncreateparamsidmoderation.md | 8 + .../chatstreamcompletioncreateparamsidweb.md | 8 + ...tstreamcompletioncreateparamsignoreenum.md | 85 ++ ...streamcompletioncreateparamsignoreunion.md | 17 + .../chatstreamcompletioncreateparamsimage.md | 23 + ...tstreamcompletioncreateparamsjsonschema.md | 11 + ...hatstreamcompletioncreateparamsmaxprice.md | 14 + ...hatstreamcompletioncreateparamsonlyenum.md | 85 ++ ...atstreamcompletioncreateparamsonlyunion.md | 17 + ...atstreamcompletioncreateparamsorderenum.md | 85 ++ ...tstreamcompletioncreateparamsorderunion.md | 17 + .../chatstreamcompletioncreateparamspdf.md | 8 + ...atstreamcompletioncreateparamspdfengine.md | 10 + ...pletioncreateparamspluginchainofthought.md | 8 + ...mcompletioncreateparamspluginfileparser.md | 10 + ...mcompletioncreateparamspluginmoderation.md | 8 + ...streamcompletioncreateparamspluginunion.md | 29 + ...atstreamcompletioncreateparamspluginweb.md | 11 + .../chatstreamcompletioncreateparamsprompt.md | 23 + ...hatstreamcompletioncreateparamsprovider.md | 18 + ...treamcompletioncreateparamsquantization.md | 16 + ...atstreamcompletioncreateparamsreasoning.md | 13 + ...amcompletioncreateparamsreasoningeffort.md | 13 + ...chatstreamcompletioncreateparamsrequest.md | 23 + ...letioncreateparamsresponseformatgrammar.md | 11 + ...ioncreateparamsresponseformatjsonobject.md | 10 + ...ioncreateparamsresponseformatjsonschema.md | 11 + ...pletioncreateparamsresponseformatpython.md | 10 + ...ompletioncreateparamsresponseformattext.md | 10 + ...mpletioncreateparamsresponseformatunion.md | 37 + .../chatstreamcompletioncreateparamssort.md | 12 + .../chatstreamcompletioncreateparamsstop.md | 25 + ...reamcompletioncreateparamsstreamoptions.md | 10 + ...streamcompletioncreateparamstypegrammar.md | 8 + ...eamcompletioncreateparamstypejsonobject.md | 8 + ...eamcompletioncreateparamstypejsonschema.md | 8 + ...tstreamcompletioncreateparamstypepython.md | 8 + ...hatstreamcompletioncreateparamstypetext.md | 8 + docs/models/ignore.md | 17 - docs/models/maxprice.md | 14 - docs/models/only.md | 17 - docs/models/order.md | 17 - docs/models/pdf.md | 8 - docs/models/plugin.md | 29 - docs/models/pluginchainofthought.md | 8 - docs/models/pluginfileparser.md | 10 - docs/models/pluginmoderation.md | 8 - docs/models/pluginweb.md | 11 - docs/models/reasoning.md | 13 - docs/models/request.md | 23 - docs/models/responseformat.md | 37 - docs/models/responseformatgrammar.md | 11 - docs/models/responseformatjsonobject.md | 10 - docs/models/responseformatjsonschema.md | 11 - docs/models/responseformatpython.md | 10 - .../streamchatcompletionresponsebody.md | 10 + docs/sdks/chat/README.md | 132 +- pyproject.toml | 2 +- src/openrouter/_version.py | 4 +- src/openrouter/chat.py | 721 +++++++++-- src/openrouter/models/__init__.py | 649 ++++++---- .../models/chatcompletioncreateparams.py | 366 +++--- .../chatstreamcompletioncreateparams.py | 1097 +++++++++++++++++ .../models/streamchatcompletionop.py | 20 + src/openrouter/sdk.py | 1 + uv.lock | 2 +- 126 files changed, 4020 insertions(+), 1038 deletions(-) rename .speakeasy/{input.openapi.yaml => in.openapi.yaml} (86%) rename docs/models/{image.md => chatcompletioncreateparamsaudio.md} (85%) create mode 100644 docs/models/chatcompletioncreateparamscompletion.md rename docs/models/{datacollection.md => chatcompletioncreateparamsdatacollection.md} (89%) rename docs/models/{effort.md => chatcompletioncreateparamseffort.md} (85%) rename docs/models/{engine.md => chatcompletioncreateparamsengine.md} (75%) rename docs/models/{idchainofthought.md => chatcompletioncreateparamsidchainofthought.md} (76%) rename docs/models/{idfileparser.md => chatcompletioncreateparamsidfileparser.md} (73%) rename docs/models/{idmoderation.md => chatcompletioncreateparamsidmoderation.md} (72%) rename docs/models/{idweb.md => chatcompletioncreateparamsidweb.md} (66%) rename docs/models/{orderenum.md => chatcompletioncreateparamsignoreenum.md} (98%) create mode 100644 docs/models/chatcompletioncreateparamsignoreunion.md rename docs/models/{audio.md => chatcompletioncreateparamsimage.md} (85%) rename docs/models/{jsonschema.md => chatcompletioncreateparamsjsonschema.md} (98%) create mode 100644 docs/models/chatcompletioncreateparamsmaxprice.md rename docs/models/{ignoreenum.md => chatcompletioncreateparamsonlyenum.md} (98%) create mode 100644 docs/models/chatcompletioncreateparamsonlyunion.md rename docs/models/{onlyenum.md => chatcompletioncreateparamsorderenum.md} (98%) create mode 100644 docs/models/chatcompletioncreateparamsorderunion.md create mode 100644 docs/models/chatcompletioncreateparamspdf.md rename docs/models/{pdfengine.md => chatcompletioncreateparamspdfengine.md} (82%) create mode 100644 docs/models/chatcompletioncreateparamspluginchainofthought.md create mode 100644 docs/models/chatcompletioncreateparamspluginfileparser.md create mode 100644 docs/models/chatcompletioncreateparamspluginmoderation.md create mode 100644 docs/models/chatcompletioncreateparamspluginunion.md create mode 100644 docs/models/chatcompletioncreateparamspluginweb.md rename docs/models/{completion.md => chatcompletioncreateparamsprompt.md} (84%) rename docs/models/{provider.md => chatcompletioncreateparamsprovider.md} (91%) rename docs/models/{quantization.md => chatcompletioncreateparamsquantization.md} (87%) create mode 100644 docs/models/chatcompletioncreateparamsreasoning.md rename docs/models/{reasoningeffort.md => chatcompletioncreateparamsreasoningeffort.md} (80%) rename docs/models/{prompt.md => chatcompletioncreateparamsrequest.md} (84%) create mode 100644 docs/models/chatcompletioncreateparamsresponseformatgrammar.md create mode 100644 docs/models/chatcompletioncreateparamsresponseformatjsonobject.md create mode 100644 docs/models/chatcompletioncreateparamsresponseformatjsonschema.md create mode 100644 docs/models/chatcompletioncreateparamsresponseformatpython.md rename docs/models/{responseformattext.md => chatcompletioncreateparamsresponseformattext.md} (96%) create mode 100644 docs/models/chatcompletioncreateparamsresponseformatunion.md rename docs/models/{sort.md => chatcompletioncreateparamssort.md} (89%) rename docs/models/{stop.md => chatcompletioncreateparamsstop.md} (87%) rename docs/models/{streamoptions.md => chatcompletioncreateparamsstreamoptions.md} (93%) rename docs/models/{typegrammar.md => chatcompletioncreateparamstypegrammar.md} (69%) rename docs/models/{typejsonobject.md => chatcompletioncreateparamstypejsonobject.md} (72%) rename docs/models/{typejsonschema.md => chatcompletioncreateparamstypejsonschema.md} (72%) rename docs/models/{typepython.md => chatcompletioncreateparamstypepython.md} (68%) create mode 100644 docs/models/chatstreamcompletioncreateparams.md create mode 100644 docs/models/chatstreamcompletioncreateparamsaudio.md create mode 100644 docs/models/chatstreamcompletioncreateparamscompletion.md create mode 100644 docs/models/chatstreamcompletioncreateparamsdatacollection.md create mode 100644 docs/models/chatstreamcompletioncreateparamseffort.md create mode 100644 docs/models/chatstreamcompletioncreateparamsengine.md create mode 100644 docs/models/chatstreamcompletioncreateparamsidchainofthought.md create mode 100644 docs/models/chatstreamcompletioncreateparamsidfileparser.md create mode 100644 docs/models/chatstreamcompletioncreateparamsidmoderation.md create mode 100644 docs/models/chatstreamcompletioncreateparamsidweb.md create mode 100644 docs/models/chatstreamcompletioncreateparamsignoreenum.md create mode 100644 docs/models/chatstreamcompletioncreateparamsignoreunion.md create mode 100644 docs/models/chatstreamcompletioncreateparamsimage.md create mode 100644 docs/models/chatstreamcompletioncreateparamsjsonschema.md create mode 100644 docs/models/chatstreamcompletioncreateparamsmaxprice.md create mode 100644 docs/models/chatstreamcompletioncreateparamsonlyenum.md create mode 100644 docs/models/chatstreamcompletioncreateparamsonlyunion.md create mode 100644 docs/models/chatstreamcompletioncreateparamsorderenum.md create mode 100644 docs/models/chatstreamcompletioncreateparamsorderunion.md create mode 100644 docs/models/chatstreamcompletioncreateparamspdf.md create mode 100644 docs/models/chatstreamcompletioncreateparamspdfengine.md create mode 100644 docs/models/chatstreamcompletioncreateparamspluginchainofthought.md create mode 100644 docs/models/chatstreamcompletioncreateparamspluginfileparser.md create mode 100644 docs/models/chatstreamcompletioncreateparamspluginmoderation.md create mode 100644 docs/models/chatstreamcompletioncreateparamspluginunion.md create mode 100644 docs/models/chatstreamcompletioncreateparamspluginweb.md create mode 100644 docs/models/chatstreamcompletioncreateparamsprompt.md create mode 100644 docs/models/chatstreamcompletioncreateparamsprovider.md create mode 100644 docs/models/chatstreamcompletioncreateparamsquantization.md create mode 100644 docs/models/chatstreamcompletioncreateparamsreasoning.md create mode 100644 docs/models/chatstreamcompletioncreateparamsreasoningeffort.md create mode 100644 docs/models/chatstreamcompletioncreateparamsrequest.md create mode 100644 docs/models/chatstreamcompletioncreateparamsresponseformatgrammar.md create mode 100644 docs/models/chatstreamcompletioncreateparamsresponseformatjsonobject.md create mode 100644 docs/models/chatstreamcompletioncreateparamsresponseformatjsonschema.md create mode 100644 docs/models/chatstreamcompletioncreateparamsresponseformatpython.md create mode 100644 docs/models/chatstreamcompletioncreateparamsresponseformattext.md create mode 100644 docs/models/chatstreamcompletioncreateparamsresponseformatunion.md create mode 100644 docs/models/chatstreamcompletioncreateparamssort.md create mode 100644 docs/models/chatstreamcompletioncreateparamsstop.md create mode 100644 docs/models/chatstreamcompletioncreateparamsstreamoptions.md create mode 100644 docs/models/chatstreamcompletioncreateparamstypegrammar.md create mode 100644 docs/models/chatstreamcompletioncreateparamstypejsonobject.md create mode 100644 docs/models/chatstreamcompletioncreateparamstypejsonschema.md create mode 100644 docs/models/chatstreamcompletioncreateparamstypepython.md create mode 100644 docs/models/chatstreamcompletioncreateparamstypetext.md delete mode 100644 docs/models/ignore.md delete mode 100644 docs/models/maxprice.md delete mode 100644 docs/models/only.md delete mode 100644 docs/models/order.md delete mode 100644 docs/models/pdf.md delete mode 100644 docs/models/plugin.md delete mode 100644 docs/models/pluginchainofthought.md delete mode 100644 docs/models/pluginfileparser.md delete mode 100644 docs/models/pluginmoderation.md delete mode 100644 docs/models/pluginweb.md delete mode 100644 docs/models/reasoning.md delete mode 100644 docs/models/request.md delete mode 100644 docs/models/responseformat.md delete mode 100644 docs/models/responseformatgrammar.md delete mode 100644 docs/models/responseformatjsonobject.md delete mode 100644 docs/models/responseformatjsonschema.md delete mode 100644 docs/models/responseformatpython.md create mode 100644 docs/models/streamchatcompletionresponsebody.md create mode 100644 src/openrouter/models/chatstreamcompletioncreateparams.py create mode 100644 src/openrouter/models/streamchatcompletionop.py diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index be2bc8a..8d97565 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 232c6d4f-b0fd-4172-8f1b-e2421566e9b4 management: - docChecksum: 3b6b1c16df754c251634311623cd5995 + docChecksum: f7eafe8edffbaf9ef5bb835b345c5a9e docVersion: 1.0.0 speakeasyVersion: 1.611.1 generationVersion: 2.694.1 - releaseVersion: 0.3.3 - configChecksum: 6887da24cc6e150f7e0b5ab6d9e6f2f5 + releaseVersion: 0.4.1 + configChecksum: 613707bdc6463db5dce971bc9cb430bb repoURL: https://github.com/speakeasy-sdks/openrouter-python-sdk.git installationURL: https://github.com/speakeasy-sdks/openrouter-python-sdk.git features: @@ -25,7 +25,6 @@ features: globalSecurityCallbacks: 1.0.0 globalSecurityFlattening: 1.0.0 globalServerURLs: 3.1.1 - groups: 3.0.0 methodArguments: 1.0.2 nameOverrides: 3.0.1 nullables: 1.0.1 @@ -44,7 +43,6 @@ generatedFiles: - USAGE.md - docs/errors/chatcompletionerror.md - docs/models/annotationdetail.md - - docs/models/audio.md - docs/models/chatcompletion.md - docs/models/chatcompletionassistantmessageparam.md - docs/models/chatcompletionassistantmessageparamcontent.md @@ -71,6 +69,50 @@ generatedFiles: - docs/models/chatcompletioncontentparttext.md - docs/models/chatcompletioncontentparttexttype.md - docs/models/chatcompletioncreateparams.md + - docs/models/chatcompletioncreateparamsaudio.md + - docs/models/chatcompletioncreateparamscompletion.md + - docs/models/chatcompletioncreateparamsdatacollection.md + - docs/models/chatcompletioncreateparamseffort.md + - docs/models/chatcompletioncreateparamsengine.md + - docs/models/chatcompletioncreateparamsidchainofthought.md + - docs/models/chatcompletioncreateparamsidfileparser.md + - docs/models/chatcompletioncreateparamsidmoderation.md + - docs/models/chatcompletioncreateparamsidweb.md + - docs/models/chatcompletioncreateparamsignoreenum.md + - docs/models/chatcompletioncreateparamsignoreunion.md + - docs/models/chatcompletioncreateparamsimage.md + - docs/models/chatcompletioncreateparamsjsonschema.md + - docs/models/chatcompletioncreateparamsmaxprice.md + - docs/models/chatcompletioncreateparamsonlyenum.md + - docs/models/chatcompletioncreateparamsonlyunion.md + - docs/models/chatcompletioncreateparamsorderenum.md + - docs/models/chatcompletioncreateparamsorderunion.md + - docs/models/chatcompletioncreateparamspdf.md + - docs/models/chatcompletioncreateparamspdfengine.md + - docs/models/chatcompletioncreateparamspluginchainofthought.md + - docs/models/chatcompletioncreateparamspluginfileparser.md + - docs/models/chatcompletioncreateparamspluginmoderation.md + - docs/models/chatcompletioncreateparamspluginunion.md + - docs/models/chatcompletioncreateparamspluginweb.md + - docs/models/chatcompletioncreateparamsprompt.md + - docs/models/chatcompletioncreateparamsprovider.md + - docs/models/chatcompletioncreateparamsquantization.md + - docs/models/chatcompletioncreateparamsreasoning.md + - docs/models/chatcompletioncreateparamsreasoningeffort.md + - docs/models/chatcompletioncreateparamsrequest.md + - docs/models/chatcompletioncreateparamsresponseformatgrammar.md + - docs/models/chatcompletioncreateparamsresponseformatjsonobject.md + - docs/models/chatcompletioncreateparamsresponseformatjsonschema.md + - docs/models/chatcompletioncreateparamsresponseformatpython.md + - docs/models/chatcompletioncreateparamsresponseformattext.md + - docs/models/chatcompletioncreateparamsresponseformatunion.md + - docs/models/chatcompletioncreateparamssort.md + - docs/models/chatcompletioncreateparamsstop.md + - docs/models/chatcompletioncreateparamsstreamoptions.md + - docs/models/chatcompletioncreateparamstypegrammar.md + - docs/models/chatcompletioncreateparamstypejsonobject.md + - docs/models/chatcompletioncreateparamstypejsonschema.md + - docs/models/chatcompletioncreateparamstypepython.md - docs/models/chatcompletioncreateparamstypetext.md - docs/models/chatcompletionmessage.md - docs/models/chatcompletionmessageparam.md @@ -100,7 +142,52 @@ generatedFiles: - docs/models/chatcompletionusermessageparam.md - docs/models/chatcompletionusermessageparamcontent.md - docs/models/chatcompletionusermessageparamrole.md - - docs/models/completion.md + - docs/models/chatstreamcompletioncreateparams.md + - docs/models/chatstreamcompletioncreateparamsaudio.md + - docs/models/chatstreamcompletioncreateparamscompletion.md + - docs/models/chatstreamcompletioncreateparamsdatacollection.md + - docs/models/chatstreamcompletioncreateparamseffort.md + - docs/models/chatstreamcompletioncreateparamsengine.md + - docs/models/chatstreamcompletioncreateparamsidchainofthought.md + - docs/models/chatstreamcompletioncreateparamsidfileparser.md + - docs/models/chatstreamcompletioncreateparamsidmoderation.md + - docs/models/chatstreamcompletioncreateparamsidweb.md + - docs/models/chatstreamcompletioncreateparamsignoreenum.md + - docs/models/chatstreamcompletioncreateparamsignoreunion.md + - docs/models/chatstreamcompletioncreateparamsimage.md + - docs/models/chatstreamcompletioncreateparamsjsonschema.md + - docs/models/chatstreamcompletioncreateparamsmaxprice.md + - docs/models/chatstreamcompletioncreateparamsonlyenum.md + - docs/models/chatstreamcompletioncreateparamsonlyunion.md + - docs/models/chatstreamcompletioncreateparamsorderenum.md + - docs/models/chatstreamcompletioncreateparamsorderunion.md + - docs/models/chatstreamcompletioncreateparamspdf.md + - docs/models/chatstreamcompletioncreateparamspdfengine.md + - docs/models/chatstreamcompletioncreateparamspluginchainofthought.md + - docs/models/chatstreamcompletioncreateparamspluginfileparser.md + - docs/models/chatstreamcompletioncreateparamspluginmoderation.md + - docs/models/chatstreamcompletioncreateparamspluginunion.md + - docs/models/chatstreamcompletioncreateparamspluginweb.md + - docs/models/chatstreamcompletioncreateparamsprompt.md + - docs/models/chatstreamcompletioncreateparamsprovider.md + - docs/models/chatstreamcompletioncreateparamsquantization.md + - docs/models/chatstreamcompletioncreateparamsreasoning.md + - docs/models/chatstreamcompletioncreateparamsreasoningeffort.md + - docs/models/chatstreamcompletioncreateparamsrequest.md + - docs/models/chatstreamcompletioncreateparamsresponseformatgrammar.md + - docs/models/chatstreamcompletioncreateparamsresponseformatjsonobject.md + - docs/models/chatstreamcompletioncreateparamsresponseformatjsonschema.md + - docs/models/chatstreamcompletioncreateparamsresponseformatpython.md + - docs/models/chatstreamcompletioncreateparamsresponseformattext.md + - docs/models/chatstreamcompletioncreateparamsresponseformatunion.md + - docs/models/chatstreamcompletioncreateparamssort.md + - docs/models/chatstreamcompletioncreateparamsstop.md + - docs/models/chatstreamcompletioncreateparamsstreamoptions.md + - docs/models/chatstreamcompletioncreateparamstypegrammar.md + - docs/models/chatstreamcompletioncreateparamstypejsonobject.md + - docs/models/chatstreamcompletioncreateparamstypejsonschema.md + - docs/models/chatstreamcompletioncreateparamstypepython.md + - docs/models/chatstreamcompletioncreateparamstypetext.md - docs/models/completiontokensdetails.md - docs/models/completionusage.md - docs/models/contentimageurl.md @@ -108,42 +195,15 @@ generatedFiles: - docs/models/contenttypeimageurl.md - docs/models/contenttypetext.md - docs/models/createchatcompletionresponse.md - - docs/models/datacollection.md - docs/models/detail.md - - docs/models/effort.md - - docs/models/engine.md - docs/models/error.md - docs/models/file.md - docs/models/fileannotationdetail.md - docs/models/fileannotationdetailcontentunion.md - docs/models/fileannotationdetailimageurl.md - - docs/models/idchainofthought.md - - docs/models/idfileparser.md - - docs/models/idmoderation.md - - docs/models/idweb.md - - docs/models/ignore.md - - docs/models/ignoreenum.md - - docs/models/image.md - docs/models/inputaudio.md - - docs/models/jsonschema.md - - docs/models/maxprice.md - - docs/models/only.md - - docs/models/onlyenum.md - - docs/models/order.md - - docs/models/orderenum.md - docs/models/parameters.md - - docs/models/pdf.md - - docs/models/pdfengine.md - - docs/models/plugin.md - - docs/models/pluginchainofthought.md - - docs/models/pluginfileparser.md - - docs/models/pluginmoderation.md - - docs/models/pluginweb.md - - docs/models/prompt.md - docs/models/prompttokensdetails.md - - docs/models/provider.md - - docs/models/quantization.md - - docs/models/reasoning.md - docs/models/reasoningdetail.md - docs/models/reasoningdetailencrypted.md - docs/models/reasoningdetailencryptedformat.md @@ -154,25 +214,11 @@ generatedFiles: - docs/models/reasoningdetailtext.md - docs/models/reasoningdetailtextformat.md - docs/models/reasoningdetailtexttype.md - - docs/models/reasoningeffort.md - - docs/models/request.md - - docs/models/responseformat.md - - docs/models/responseformatgrammar.md - - docs/models/responseformatjsonobject.md - - docs/models/responseformatjsonschema.md - docs/models/responseformatjsonschemaschema.md - - docs/models/responseformatpython.md - - docs/models/responseformattext.md - docs/models/security.md - - docs/models/sort.md - - docs/models/stop.md - - docs/models/streamoptions.md + - docs/models/streamchatcompletionresponsebody.md - docs/models/toplogprob.md - docs/models/typefile.md - - docs/models/typegrammar.md - - docs/models/typejsonobject.md - - docs/models/typejsonschema.md - - docs/models/typepython.md - docs/models/urlcitation.md - docs/models/urlcitationannotationdetail.md - docs/models/urlcitationannotationdetailtype.md @@ -225,6 +271,7 @@ generatedFiles: - src/openrouter/models/chatcompletiontoolchoiceoption.py - src/openrouter/models/chatcompletiontoolmessageparam.py - src/openrouter/models/chatcompletionusermessageparam.py + - src/openrouter/models/chatstreamcompletioncreateparams.py - src/openrouter/models/completionusage.py - src/openrouter/models/createchatcompletionop.py - src/openrouter/models/fileannotationdetail.py @@ -234,6 +281,7 @@ generatedFiles: - src/openrouter/models/reasoningdetailtext.py - src/openrouter/models/responseformatjsonschemaschema.py - src/openrouter/models/security.py + - src/openrouter/models/streamchatcompletionop.py - src/openrouter/models/urlcitationannotationdetail.py - src/openrouter/py.typed - src/openrouter/sdk.py @@ -272,10 +320,10 @@ examples: streamChatCompletion: speakeasy-default-stream-chat-completion: requestBody: - application/json: {"messages": [{"role": "user", "content": "Hello, how are you?"}], "stream": true, "temperature": 1, "top_p": 1} + application/json: {"stream": false, "messages": [{"role": "user", "content": "Hello, how are you?"}], "temperature": 1, "top_p": 1} responses: "400": - application/json: {"error": {"code": "", "message": "", "param": "", "type": ""}} + application/json: {"error": {"code": null, "message": ""}} "500": - application/json: {"error": {"code": "", "message": "", "param": "", "type": ""}} + application/json: {"error": {"code": null, "message": ""}} examplesVersion: 1.0.2 diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index a85f9fb..9e62e8d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -25,7 +25,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 0.3.3 + version: 0.4.1 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/input.openapi.yaml b/.speakeasy/in.openapi.yaml similarity index 86% rename from .speakeasy/input.openapi.yaml rename to .speakeasy/in.openapi.yaml index 1b3dc5d..df00661 100644 --- a/.speakeasy/input.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -36,7 +36,7 @@ components: required: [data] properties: data: - $ref: '#/components/schemas/ChatCompletionChunk' + $ref: "#/components/schemas/ChatCompletionChunk" ChatCompletionMessageToolCall: type: object properties: @@ -147,15 +147,15 @@ components: description: Text reasoning detail ReasoningDetail: oneOf: - - $ref: '#/components/schemas/ReasoningDetailSummary' - - $ref: '#/components/schemas/ReasoningDetailEncrypted' - - $ref: '#/components/schemas/ReasoningDetailText' + - $ref: "#/components/schemas/ReasoningDetailSummary" + - $ref: "#/components/schemas/ReasoningDetailEncrypted" + - $ref: "#/components/schemas/ReasoningDetailText" discriminator: propertyName: type mapping: - reasoning.summary: '#/components/schemas/ReasoningDetailSummary' - reasoning.encrypted: '#/components/schemas/ReasoningDetailEncrypted' - reasoning.text: '#/components/schemas/ReasoningDetailText' + reasoning.summary: "#/components/schemas/ReasoningDetailSummary" + reasoning.encrypted: "#/components/schemas/ReasoningDetailEncrypted" + reasoning.text: "#/components/schemas/ReasoningDetailText" description: Reasoning detail information FileAnnotationDetail: type: object @@ -240,13 +240,13 @@ components: description: URL citation annotation AnnotationDetail: oneOf: - - $ref: '#/components/schemas/FileAnnotationDetail' - - $ref: '#/components/schemas/URLCitationAnnotationDetail' + - $ref: "#/components/schemas/FileAnnotationDetail" + - $ref: "#/components/schemas/URLCitationAnnotationDetail" discriminator: propertyName: type mapping: - file: '#/components/schemas/FileAnnotationDetail' - url_citation: '#/components/schemas/URLCitationAnnotationDetail' + file: "#/components/schemas/FileAnnotationDetail" + url_citation: "#/components/schemas/URLCitationAnnotationDetail" description: Annotation information ChatCompletionMessage: type: object @@ -270,17 +270,17 @@ components: tool_calls: type: array items: - $ref: '#/components/schemas/ChatCompletionMessageToolCall' + $ref: "#/components/schemas/ChatCompletionMessageToolCall" description: Tool calls made by the assistant reasoning_details: type: array items: - $ref: '#/components/schemas/ReasoningDetail' + $ref: "#/components/schemas/ReasoningDetail" description: Reasoning details delta to send reasoning details back to upstream annotations: type: array items: - $ref: '#/components/schemas/AnnotationDetail' + $ref: "#/components/schemas/AnnotationDetail" description: Annotations delta to send annotations back to upstream required: - role @@ -335,13 +335,13 @@ components: type: array nullable: true items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' + $ref: "#/components/schemas/ChatCompletionTokenLogprob" description: Log probabilities for content tokens refusal: type: array nullable: true items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' + $ref: "#/components/schemas/ChatCompletionTokenLogprob" description: Log probabilities for refusal tokens required: - content @@ -364,9 +364,9 @@ components: type: number description: Choice index message: - $ref: '#/components/schemas/ChatCompletionMessage' + $ref: "#/components/schemas/ChatCompletionMessage" logprobs: - $ref: '#/components/schemas/ChatCompletionTokenLogprobs' + $ref: "#/components/schemas/ChatCompletionTokenLogprobs" required: - finish_reason - index @@ -424,7 +424,7 @@ components: choices: type: array items: - $ref: '#/components/schemas/ChatCompletionChoice' + $ref: "#/components/schemas/ChatCompletionChoice" description: List of completion choices created: type: number @@ -441,7 +441,7 @@ components: description: System fingerprint nullable: true usage: - $ref: '#/components/schemas/CompletionUsage' + $ref: "#/components/schemas/CompletionUsage" required: - id - choices @@ -522,24 +522,24 @@ components: tool_calls: type: array items: - $ref: '#/components/schemas/ChatCompletionChunkChoiceDeltaToolCall' + $ref: "#/components/schemas/ChatCompletionChunkChoiceDeltaToolCall" description: Tool calls delta reasoning_details: type: array items: - $ref: '#/components/schemas/ReasoningDetail' + $ref: "#/components/schemas/ReasoningDetail" description: Reasoning details delta to send reasoning details back to upstream annotations: type: array items: - $ref: '#/components/schemas/AnnotationDetail' + $ref: "#/components/schemas/AnnotationDetail" description: Annotations delta to send annotations back to upstream description: Delta changes in streaming response ChatCompletionChunkChoice: type: object properties: delta: - $ref: '#/components/schemas/ChatCompletionChunkChoiceDelta' + $ref: "#/components/schemas/ChatCompletionChunkChoiceDelta" finish_reason: type: string nullable: true @@ -552,7 +552,7 @@ components: index: type: number logprobs: - $ref: '#/components/schemas/ChatCompletionTokenLogprobs' + $ref: "#/components/schemas/ChatCompletionTokenLogprobs" required: - delta - finish_reason @@ -566,7 +566,7 @@ components: choices: type: array items: - $ref: '#/components/schemas/ChatCompletionChunkChoice' + $ref: "#/components/schemas/ChatCompletionChunkChoice" created: type: number model: @@ -579,7 +579,7 @@ components: type: string nullable: true usage: - $ref: '#/components/schemas/CompletionUsage' + $ref: "#/components/schemas/CompletionUsage" required: - id - choices @@ -621,7 +621,7 @@ components: properties: url: type: string - description: 'URL of the image (data: URLs supported)' + description: "URL of the image (data: URLs supported)" detail: type: string enum: @@ -668,15 +668,15 @@ components: description: Audio input content part ChatCompletionContentPart: oneOf: - - $ref: '#/components/schemas/ChatCompletionContentPartText' - - $ref: '#/components/schemas/ChatCompletionContentPartImage' - - $ref: '#/components/schemas/ChatCompletionContentPartAudio' + - $ref: "#/components/schemas/ChatCompletionContentPartText" + - $ref: "#/components/schemas/ChatCompletionContentPartImage" + - $ref: "#/components/schemas/ChatCompletionContentPartAudio" discriminator: propertyName: type mapping: - text: '#/components/schemas/ChatCompletionContentPartText' - image_url: '#/components/schemas/ChatCompletionContentPartImage' - input_audio: '#/components/schemas/ChatCompletionContentPartAudio' + text: "#/components/schemas/ChatCompletionContentPartText" + image_url: "#/components/schemas/ChatCompletionContentPartImage" + input_audio: "#/components/schemas/ChatCompletionContentPartAudio" description: Content part for chat completion messages ChatCompletionSystemMessageParam: type: object @@ -690,7 +690,7 @@ components: - type: string - type: array items: - $ref: '#/components/schemas/ChatCompletionContentPartText' + $ref: "#/components/schemas/ChatCompletionContentPartText" description: System message content name: type: string @@ -711,7 +711,7 @@ components: - type: string - type: array items: - $ref: '#/components/schemas/ChatCompletionContentPart' + $ref: "#/components/schemas/ChatCompletionContentPart" description: User message content name: type: string @@ -732,7 +732,7 @@ components: - type: string - type: array items: - $ref: '#/components/schemas/ChatCompletionContentPart' + $ref: "#/components/schemas/ChatCompletionContentPart" - nullable: true description: Assistant message content name: @@ -741,7 +741,7 @@ components: tool_calls: type: array items: - $ref: '#/components/schemas/ChatCompletionMessageToolCall' + $ref: "#/components/schemas/ChatCompletionMessageToolCall" description: Tool calls made by the assistant refusal: type: string @@ -762,7 +762,7 @@ components: - type: string - type: array items: - $ref: '#/components/schemas/ChatCompletionContentPart' + $ref: "#/components/schemas/ChatCompletionContentPart" description: Tool response content tool_call_id: type: string @@ -774,17 +774,17 @@ components: description: Tool response message ChatCompletionMessageParam: oneOf: - - $ref: '#/components/schemas/ChatCompletionSystemMessageParam' - - $ref: '#/components/schemas/ChatCompletionUserMessageParam' - - $ref: '#/components/schemas/ChatCompletionAssistantMessageParam' - - $ref: '#/components/schemas/ChatCompletionToolMessageParam' + - $ref: "#/components/schemas/ChatCompletionSystemMessageParam" + - $ref: "#/components/schemas/ChatCompletionUserMessageParam" + - $ref: "#/components/schemas/ChatCompletionAssistantMessageParam" + - $ref: "#/components/schemas/ChatCompletionToolMessageParam" discriminator: propertyName: role mapping: - system: '#/components/schemas/ChatCompletionSystemMessageParam' - user: '#/components/schemas/ChatCompletionUserMessageParam' - assistant: '#/components/schemas/ChatCompletionAssistantMessageParam' - tool: '#/components/schemas/ChatCompletionToolMessageParam' + system: "#/components/schemas/ChatCompletionSystemMessageParam" + user: "#/components/schemas/ChatCompletionUserMessageParam" + assistant: "#/components/schemas/ChatCompletionAssistantMessageParam" + tool: "#/components/schemas/ChatCompletionToolMessageParam" description: Chat completion message with role-based discrimination ChatCompletionTool: type: object @@ -848,7 +848,7 @@ components: - type: string enum: - required - - $ref: '#/components/schemas/ChatCompletionNamedToolChoice' + - $ref: "#/components/schemas/ChatCompletionNamedToolChoice" description: Tool choice configuration ChatCompletionStreamOptions: type: object @@ -867,7 +867,7 @@ components: messages: type: array items: - $ref: '#/components/schemas/ChatCompletionMessageParam' + $ref: "#/components/schemas/ChatCompletionMessageParam" minItems: 1 description: List of messages for the conversation example: @@ -980,7 +980,7 @@ components: type: string description: Schema description for the model schema: - $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + $ref: "#/components/schemas/ResponseFormatJsonSchemaSchema" strict: type: boolean nullable: true @@ -1034,7 +1034,7 @@ components: description: Enable streaming response stream_options: allOf: - - $ref: '#/components/schemas/ChatCompletionStreamOptions' + - $ref: "#/components/schemas/ChatCompletionStreamOptions" - nullable: true temperature: type: number @@ -1044,11 +1044,11 @@ components: default: 1 description: Sampling temperature (0-2) tool_choice: - $ref: '#/components/schemas/ChatCompletionToolChoiceOption' + $ref: "#/components/schemas/ChatCompletionToolChoiceOption" tools: type: array items: - $ref: '#/components/schemas/ChatCompletionTool' + $ref: "#/components/schemas/ChatCompletionTool" description: Available tools for function calling top_p: type: number @@ -1061,7 +1061,8 @@ components: type: string description: Unique user identifier models: - x-speakeasy-name-override: model_list + # Needed to avoid conflict with the `models` directory + x-speakeasy-name-override: fallback_models type: array nullable: true items: @@ -1498,13 +1499,22 @@ components: required: - messages description: Chat completion request parameters + ChatStreamCompletionCreateParams: + allOf: + - type: object + properties: + stream: + type: boolean + enum: + - true + default: true + description: Enable streaming response + - $ref: "#/components/schemas/ChatCompletionCreateParams" parameters: {} paths: /chat/completions: post: operationId: createChatCompletion - x-speakeasy-group: chat - x-speakeasy-name-override: complete summary: Create a chat completion description: Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes. tags: @@ -1515,40 +1525,92 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionCreateParams' + $ref: "#/components/schemas/ChatCompletionCreateParams" responses: - '200': + "200": description: Successful chat completion response content: application/json: schema: - $ref: '#/components/schemas/ChatCompletion' + $ref: "#/components/schemas/ChatCompletion" description: Non-streaming response when stream=false text/event-stream: - x-speakeasy-sse-sentinel: '[DONE]' + x-speakeasy-sse-sentinel: "[DONE]" schema: - $ref: '#/components/schemas/ChatCompletionChunkWrapper' - '400': + $ref: "#/components/schemas/ChatCompletionChunkWrapper" + "400": description: Bad request - invalid parameters content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionError' - '401': + $ref: "#/components/schemas/ChatCompletionError" + "401": description: Unauthorized - invalid API key content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionError' - '429': + $ref: "#/components/schemas/ChatCompletionError" + "429": description: Too many requests - rate limit exceeded content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionError' - '500': + $ref: "#/components/schemas/ChatCompletionError" + "500": description: Internal server error content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionError' + $ref: "#/components/schemas/ChatCompletionError" + x-speakeasy-name-override: complete + /chat/completions#stream: + post: + operationId: streamChatCompletion + summary: Create a chat completion + description: Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes. + tags: + - Chat + requestBody: + description: Chat completion request parameters + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ChatStreamCompletionCreateParams" + responses: + "200": + description: Successful chat completion response + content: + text/event-stream: + x-speakeasy-sse-sentinel: "[DONE]" + schema: + type: object + required: [data] + properties: + data: + $ref: "#/components/schemas/ChatCompletionChunk" + "400": + description: Bad request - invalid parameters + content: + application/json: + schema: + $ref: "#/components/schemas/ChatCompletionError" + "401": + description: Unauthorized - invalid API key + content: + application/json: + schema: + $ref: "#/components/schemas/ChatCompletionError" + "429": + description: Too many requests - rate limit exceeded + content: + application/json: + schema: + $ref: "#/components/schemas/ChatCompletionError" + "500": + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/ChatCompletionError" + x-speakeasy-name-override: completeStream diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 1b3dc5d..df00661 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -36,7 +36,7 @@ components: required: [data] properties: data: - $ref: '#/components/schemas/ChatCompletionChunk' + $ref: "#/components/schemas/ChatCompletionChunk" ChatCompletionMessageToolCall: type: object properties: @@ -147,15 +147,15 @@ components: description: Text reasoning detail ReasoningDetail: oneOf: - - $ref: '#/components/schemas/ReasoningDetailSummary' - - $ref: '#/components/schemas/ReasoningDetailEncrypted' - - $ref: '#/components/schemas/ReasoningDetailText' + - $ref: "#/components/schemas/ReasoningDetailSummary" + - $ref: "#/components/schemas/ReasoningDetailEncrypted" + - $ref: "#/components/schemas/ReasoningDetailText" discriminator: propertyName: type mapping: - reasoning.summary: '#/components/schemas/ReasoningDetailSummary' - reasoning.encrypted: '#/components/schemas/ReasoningDetailEncrypted' - reasoning.text: '#/components/schemas/ReasoningDetailText' + reasoning.summary: "#/components/schemas/ReasoningDetailSummary" + reasoning.encrypted: "#/components/schemas/ReasoningDetailEncrypted" + reasoning.text: "#/components/schemas/ReasoningDetailText" description: Reasoning detail information FileAnnotationDetail: type: object @@ -240,13 +240,13 @@ components: description: URL citation annotation AnnotationDetail: oneOf: - - $ref: '#/components/schemas/FileAnnotationDetail' - - $ref: '#/components/schemas/URLCitationAnnotationDetail' + - $ref: "#/components/schemas/FileAnnotationDetail" + - $ref: "#/components/schemas/URLCitationAnnotationDetail" discriminator: propertyName: type mapping: - file: '#/components/schemas/FileAnnotationDetail' - url_citation: '#/components/schemas/URLCitationAnnotationDetail' + file: "#/components/schemas/FileAnnotationDetail" + url_citation: "#/components/schemas/URLCitationAnnotationDetail" description: Annotation information ChatCompletionMessage: type: object @@ -270,17 +270,17 @@ components: tool_calls: type: array items: - $ref: '#/components/schemas/ChatCompletionMessageToolCall' + $ref: "#/components/schemas/ChatCompletionMessageToolCall" description: Tool calls made by the assistant reasoning_details: type: array items: - $ref: '#/components/schemas/ReasoningDetail' + $ref: "#/components/schemas/ReasoningDetail" description: Reasoning details delta to send reasoning details back to upstream annotations: type: array items: - $ref: '#/components/schemas/AnnotationDetail' + $ref: "#/components/schemas/AnnotationDetail" description: Annotations delta to send annotations back to upstream required: - role @@ -335,13 +335,13 @@ components: type: array nullable: true items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' + $ref: "#/components/schemas/ChatCompletionTokenLogprob" description: Log probabilities for content tokens refusal: type: array nullable: true items: - $ref: '#/components/schemas/ChatCompletionTokenLogprob' + $ref: "#/components/schemas/ChatCompletionTokenLogprob" description: Log probabilities for refusal tokens required: - content @@ -364,9 +364,9 @@ components: type: number description: Choice index message: - $ref: '#/components/schemas/ChatCompletionMessage' + $ref: "#/components/schemas/ChatCompletionMessage" logprobs: - $ref: '#/components/schemas/ChatCompletionTokenLogprobs' + $ref: "#/components/schemas/ChatCompletionTokenLogprobs" required: - finish_reason - index @@ -424,7 +424,7 @@ components: choices: type: array items: - $ref: '#/components/schemas/ChatCompletionChoice' + $ref: "#/components/schemas/ChatCompletionChoice" description: List of completion choices created: type: number @@ -441,7 +441,7 @@ components: description: System fingerprint nullable: true usage: - $ref: '#/components/schemas/CompletionUsage' + $ref: "#/components/schemas/CompletionUsage" required: - id - choices @@ -522,24 +522,24 @@ components: tool_calls: type: array items: - $ref: '#/components/schemas/ChatCompletionChunkChoiceDeltaToolCall' + $ref: "#/components/schemas/ChatCompletionChunkChoiceDeltaToolCall" description: Tool calls delta reasoning_details: type: array items: - $ref: '#/components/schemas/ReasoningDetail' + $ref: "#/components/schemas/ReasoningDetail" description: Reasoning details delta to send reasoning details back to upstream annotations: type: array items: - $ref: '#/components/schemas/AnnotationDetail' + $ref: "#/components/schemas/AnnotationDetail" description: Annotations delta to send annotations back to upstream description: Delta changes in streaming response ChatCompletionChunkChoice: type: object properties: delta: - $ref: '#/components/schemas/ChatCompletionChunkChoiceDelta' + $ref: "#/components/schemas/ChatCompletionChunkChoiceDelta" finish_reason: type: string nullable: true @@ -552,7 +552,7 @@ components: index: type: number logprobs: - $ref: '#/components/schemas/ChatCompletionTokenLogprobs' + $ref: "#/components/schemas/ChatCompletionTokenLogprobs" required: - delta - finish_reason @@ -566,7 +566,7 @@ components: choices: type: array items: - $ref: '#/components/schemas/ChatCompletionChunkChoice' + $ref: "#/components/schemas/ChatCompletionChunkChoice" created: type: number model: @@ -579,7 +579,7 @@ components: type: string nullable: true usage: - $ref: '#/components/schemas/CompletionUsage' + $ref: "#/components/schemas/CompletionUsage" required: - id - choices @@ -621,7 +621,7 @@ components: properties: url: type: string - description: 'URL of the image (data: URLs supported)' + description: "URL of the image (data: URLs supported)" detail: type: string enum: @@ -668,15 +668,15 @@ components: description: Audio input content part ChatCompletionContentPart: oneOf: - - $ref: '#/components/schemas/ChatCompletionContentPartText' - - $ref: '#/components/schemas/ChatCompletionContentPartImage' - - $ref: '#/components/schemas/ChatCompletionContentPartAudio' + - $ref: "#/components/schemas/ChatCompletionContentPartText" + - $ref: "#/components/schemas/ChatCompletionContentPartImage" + - $ref: "#/components/schemas/ChatCompletionContentPartAudio" discriminator: propertyName: type mapping: - text: '#/components/schemas/ChatCompletionContentPartText' - image_url: '#/components/schemas/ChatCompletionContentPartImage' - input_audio: '#/components/schemas/ChatCompletionContentPartAudio' + text: "#/components/schemas/ChatCompletionContentPartText" + image_url: "#/components/schemas/ChatCompletionContentPartImage" + input_audio: "#/components/schemas/ChatCompletionContentPartAudio" description: Content part for chat completion messages ChatCompletionSystemMessageParam: type: object @@ -690,7 +690,7 @@ components: - type: string - type: array items: - $ref: '#/components/schemas/ChatCompletionContentPartText' + $ref: "#/components/schemas/ChatCompletionContentPartText" description: System message content name: type: string @@ -711,7 +711,7 @@ components: - type: string - type: array items: - $ref: '#/components/schemas/ChatCompletionContentPart' + $ref: "#/components/schemas/ChatCompletionContentPart" description: User message content name: type: string @@ -732,7 +732,7 @@ components: - type: string - type: array items: - $ref: '#/components/schemas/ChatCompletionContentPart' + $ref: "#/components/schemas/ChatCompletionContentPart" - nullable: true description: Assistant message content name: @@ -741,7 +741,7 @@ components: tool_calls: type: array items: - $ref: '#/components/schemas/ChatCompletionMessageToolCall' + $ref: "#/components/schemas/ChatCompletionMessageToolCall" description: Tool calls made by the assistant refusal: type: string @@ -762,7 +762,7 @@ components: - type: string - type: array items: - $ref: '#/components/schemas/ChatCompletionContentPart' + $ref: "#/components/schemas/ChatCompletionContentPart" description: Tool response content tool_call_id: type: string @@ -774,17 +774,17 @@ components: description: Tool response message ChatCompletionMessageParam: oneOf: - - $ref: '#/components/schemas/ChatCompletionSystemMessageParam' - - $ref: '#/components/schemas/ChatCompletionUserMessageParam' - - $ref: '#/components/schemas/ChatCompletionAssistantMessageParam' - - $ref: '#/components/schemas/ChatCompletionToolMessageParam' + - $ref: "#/components/schemas/ChatCompletionSystemMessageParam" + - $ref: "#/components/schemas/ChatCompletionUserMessageParam" + - $ref: "#/components/schemas/ChatCompletionAssistantMessageParam" + - $ref: "#/components/schemas/ChatCompletionToolMessageParam" discriminator: propertyName: role mapping: - system: '#/components/schemas/ChatCompletionSystemMessageParam' - user: '#/components/schemas/ChatCompletionUserMessageParam' - assistant: '#/components/schemas/ChatCompletionAssistantMessageParam' - tool: '#/components/schemas/ChatCompletionToolMessageParam' + system: "#/components/schemas/ChatCompletionSystemMessageParam" + user: "#/components/schemas/ChatCompletionUserMessageParam" + assistant: "#/components/schemas/ChatCompletionAssistantMessageParam" + tool: "#/components/schemas/ChatCompletionToolMessageParam" description: Chat completion message with role-based discrimination ChatCompletionTool: type: object @@ -848,7 +848,7 @@ components: - type: string enum: - required - - $ref: '#/components/schemas/ChatCompletionNamedToolChoice' + - $ref: "#/components/schemas/ChatCompletionNamedToolChoice" description: Tool choice configuration ChatCompletionStreamOptions: type: object @@ -867,7 +867,7 @@ components: messages: type: array items: - $ref: '#/components/schemas/ChatCompletionMessageParam' + $ref: "#/components/schemas/ChatCompletionMessageParam" minItems: 1 description: List of messages for the conversation example: @@ -980,7 +980,7 @@ components: type: string description: Schema description for the model schema: - $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' + $ref: "#/components/schemas/ResponseFormatJsonSchemaSchema" strict: type: boolean nullable: true @@ -1034,7 +1034,7 @@ components: description: Enable streaming response stream_options: allOf: - - $ref: '#/components/schemas/ChatCompletionStreamOptions' + - $ref: "#/components/schemas/ChatCompletionStreamOptions" - nullable: true temperature: type: number @@ -1044,11 +1044,11 @@ components: default: 1 description: Sampling temperature (0-2) tool_choice: - $ref: '#/components/schemas/ChatCompletionToolChoiceOption' + $ref: "#/components/schemas/ChatCompletionToolChoiceOption" tools: type: array items: - $ref: '#/components/schemas/ChatCompletionTool' + $ref: "#/components/schemas/ChatCompletionTool" description: Available tools for function calling top_p: type: number @@ -1061,7 +1061,8 @@ components: type: string description: Unique user identifier models: - x-speakeasy-name-override: model_list + # Needed to avoid conflict with the `models` directory + x-speakeasy-name-override: fallback_models type: array nullable: true items: @@ -1498,13 +1499,22 @@ components: required: - messages description: Chat completion request parameters + ChatStreamCompletionCreateParams: + allOf: + - type: object + properties: + stream: + type: boolean + enum: + - true + default: true + description: Enable streaming response + - $ref: "#/components/schemas/ChatCompletionCreateParams" parameters: {} paths: /chat/completions: post: operationId: createChatCompletion - x-speakeasy-group: chat - x-speakeasy-name-override: complete summary: Create a chat completion description: Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes. tags: @@ -1515,40 +1525,92 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionCreateParams' + $ref: "#/components/schemas/ChatCompletionCreateParams" responses: - '200': + "200": description: Successful chat completion response content: application/json: schema: - $ref: '#/components/schemas/ChatCompletion' + $ref: "#/components/schemas/ChatCompletion" description: Non-streaming response when stream=false text/event-stream: - x-speakeasy-sse-sentinel: '[DONE]' + x-speakeasy-sse-sentinel: "[DONE]" schema: - $ref: '#/components/schemas/ChatCompletionChunkWrapper' - '400': + $ref: "#/components/schemas/ChatCompletionChunkWrapper" + "400": description: Bad request - invalid parameters content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionError' - '401': + $ref: "#/components/schemas/ChatCompletionError" + "401": description: Unauthorized - invalid API key content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionError' - '429': + $ref: "#/components/schemas/ChatCompletionError" + "429": description: Too many requests - rate limit exceeded content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionError' - '500': + $ref: "#/components/schemas/ChatCompletionError" + "500": description: Internal server error content: application/json: schema: - $ref: '#/components/schemas/ChatCompletionError' + $ref: "#/components/schemas/ChatCompletionError" + x-speakeasy-name-override: complete + /chat/completions#stream: + post: + operationId: streamChatCompletion + summary: Create a chat completion + description: Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes. + tags: + - Chat + requestBody: + description: Chat completion request parameters + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ChatStreamCompletionCreateParams" + responses: + "200": + description: Successful chat completion response + content: + text/event-stream: + x-speakeasy-sse-sentinel: "[DONE]" + schema: + type: object + required: [data] + properties: + data: + $ref: "#/components/schemas/ChatCompletionChunk" + "400": + description: Bad request - invalid parameters + content: + application/json: + schema: + $ref: "#/components/schemas/ChatCompletionError" + "401": + description: Unauthorized - invalid API key + content: + application/json: + schema: + $ref: "#/components/schemas/ChatCompletionError" + "429": + description: Too many requests - rate limit exceeded + content: + application/json: + schema: + $ref: "#/components/schemas/ChatCompletionError" + "500": + description: Internal server error + content: + application/json: + schema: + $ref: "#/components/schemas/ChatCompletionError" + x-speakeasy-name-override: completeStream diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 3c27ca2..b822d24 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -3,7 +3,7 @@ speakeasyVersion: latest sources: OpenRouter Chat Completions API: inputs: - - location: .speakeasy/input.openapi.yaml + - location: .speakeasy/in.openapi.yaml output: .speakeasy/out.openapi.yaml registry: location: registry.speakeasyapi.dev/sheldon-vaughn-test/sandbox/open-router-chat-completions-api diff --git a/README-PYPI.md b/README-PYPI.md index 0eaf719..d5650c8 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -222,6 +222,7 @@ with OpenRouter( ### [chat](https://github.com/speakeasy-sdks/openrouter-python-sdk/blob/master/docs/sdks/chat/README.md) * [complete](https://github.com/speakeasy-sdks/openrouter-python-sdk/blob/master/docs/sdks/chat/README.md#complete) - Create a chat completion +* [complete_stream](https://github.com/speakeasy-sdks/openrouter-python-sdk/blob/master/docs/sdks/chat/README.md#complete_stream) - Create a chat completion diff --git a/README.md b/README.md index 4bdfdbe..3e62330 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,7 @@ with OpenRouter( ### [chat](docs/sdks/chat/README.md) * [complete](docs/sdks/chat/README.md#complete) - Create a chat completion +* [complete_stream](docs/sdks/chat/README.md#complete_stream) - Create a chat completion diff --git a/docs/models/chatcompletioncreateparams.md b/docs/models/chatcompletioncreateparams.md index aa2576a..4ad0570 100644 --- a/docs/models/chatcompletioncreateparams.md +++ b/docs/models/chatcompletioncreateparams.md @@ -5,30 +5,30 @@ Chat completion request parameters ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `messages` | List[[models.ChatCompletionMessageParam](../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello, how are you?"
}
] | -| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | | -| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | | -| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | | -| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | | -| `reasoning` | [OptionalNullable[models.Reasoning]](../models/reasoning.md) | :heavy_minus_sign: | Reasoning configuration | | -| `response_format` | [Optional[models.ResponseFormat]](../models/responseformat.md) | :heavy_minus_sign: | Response format configuration | | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | | -| `stop` | [OptionalNullable[models.Stop]](../models/stop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | | -| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | | -| `stream_options` | [OptionalNullable[models.StreamOptions]](../models/streamoptions.md) | :heavy_minus_sign: | N/A | | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | | -| `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | | -| `tools` | List[[models.ChatCompletionTool](../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | | -| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | | -| `model_list` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | | -| `reasoning_effort` | [OptionalNullable[models.ReasoningEffort]](../models/reasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | | -| `provider` | [OptionalNullable[models.Provider]](../models/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | -| `plugins` | List[[models.Plugin](../models/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `messages` | List[[models.ChatCompletionMessageParam](../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello, how are you?"
}
] | +| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | | +| `reasoning` | [OptionalNullable[models.ChatCompletionCreateParamsReasoning]](../models/chatcompletioncreateparamsreasoning.md) | :heavy_minus_sign: | Reasoning configuration | | +| `response_format` | [Optional[models.ChatCompletionCreateParamsResponseFormatUnion]](../models/chatcompletioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | Response format configuration | | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | | +| `stop` | [OptionalNullable[models.ChatCompletionCreateParamsStop]](../models/chatcompletioncreateparamsstop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | | +| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | | +| `stream_options` | [OptionalNullable[models.ChatCompletionCreateParamsStreamOptions]](../models/chatcompletioncreateparamsstreamoptions.md) | :heavy_minus_sign: | N/A | | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | | +| `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | | +| `tools` | List[[models.ChatCompletionTool](../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | | +| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | | +| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | | +| `reasoning_effort` | [OptionalNullable[models.ChatCompletionCreateParamsReasoningEffort]](../models/chatcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | | +| `provider` | [OptionalNullable[models.ChatCompletionCreateParamsProvider]](../models/chatcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[models.ChatCompletionCreateParamsPluginUnion](../models/chatcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | \ No newline at end of file diff --git a/docs/models/image.md b/docs/models/chatcompletioncreateparamsaudio.md similarity index 85% rename from docs/models/image.md rename to docs/models/chatcompletioncreateparamsaudio.md index cae2edf..e60d0c8 100644 --- a/docs/models/image.md +++ b/docs/models/chatcompletioncreateparamsaudio.md @@ -1,4 +1,4 @@ -# Image +# ChatCompletionCreateParamsAudio ## Supported Types diff --git a/docs/models/chatcompletioncreateparamscompletion.md b/docs/models/chatcompletioncreateparamscompletion.md new file mode 100644 index 0000000..0718ff0 --- /dev/null +++ b/docs/models/chatcompletioncreateparamscompletion.md @@ -0,0 +1,23 @@ +# ChatCompletionCreateParamsCompletion + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/models/datacollection.md b/docs/models/chatcompletioncreateparamsdatacollection.md similarity index 89% rename from docs/models/datacollection.md rename to docs/models/chatcompletioncreateparamsdatacollection.md index bb07fc4..0f05804 100644 --- a/docs/models/datacollection.md +++ b/docs/models/chatcompletioncreateparamsdatacollection.md @@ -1,4 +1,4 @@ -# DataCollection +# ChatCompletionCreateParamsDataCollection Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it diff --git a/docs/models/effort.md b/docs/models/chatcompletioncreateparamseffort.md similarity index 85% rename from docs/models/effort.md rename to docs/models/chatcompletioncreateparamseffort.md index eac615b..15adb4b 100644 --- a/docs/models/effort.md +++ b/docs/models/chatcompletioncreateparamseffort.md @@ -1,4 +1,4 @@ -# Effort +# ChatCompletionCreateParamsEffort OpenAI-style reasoning effort setting diff --git a/docs/models/engine.md b/docs/models/chatcompletioncreateparamsengine.md similarity index 75% rename from docs/models/engine.md rename to docs/models/chatcompletioncreateparamsengine.md index fcea19c..5f1bb21 100644 --- a/docs/models/engine.md +++ b/docs/models/chatcompletioncreateparamsengine.md @@ -1,4 +1,4 @@ -# Engine +# ChatCompletionCreateParamsEngine ## Values diff --git a/docs/models/idchainofthought.md b/docs/models/chatcompletioncreateparamsidchainofthought.md similarity index 76% rename from docs/models/idchainofthought.md rename to docs/models/chatcompletioncreateparamsidchainofthought.md index a704b14..e13847b 100644 --- a/docs/models/idchainofthought.md +++ b/docs/models/chatcompletioncreateparamsidchainofthought.md @@ -1,4 +1,4 @@ -# IDChainOfThought +# ChatCompletionCreateParamsIDChainOfThought ## Values diff --git a/docs/models/idfileparser.md b/docs/models/chatcompletioncreateparamsidfileparser.md similarity index 73% rename from docs/models/idfileparser.md rename to docs/models/chatcompletioncreateparamsidfileparser.md index 1a27fa0..7d664f1 100644 --- a/docs/models/idfileparser.md +++ b/docs/models/chatcompletioncreateparamsidfileparser.md @@ -1,4 +1,4 @@ -# IDFileParser +# ChatCompletionCreateParamsIDFileParser ## Values diff --git a/docs/models/idmoderation.md b/docs/models/chatcompletioncreateparamsidmoderation.md similarity index 72% rename from docs/models/idmoderation.md rename to docs/models/chatcompletioncreateparamsidmoderation.md index 2284d6c..a605649 100644 --- a/docs/models/idmoderation.md +++ b/docs/models/chatcompletioncreateparamsidmoderation.md @@ -1,4 +1,4 @@ -# IDModeration +# ChatCompletionCreateParamsIDModeration ## Values diff --git a/docs/models/idweb.md b/docs/models/chatcompletioncreateparamsidweb.md similarity index 66% rename from docs/models/idweb.md rename to docs/models/chatcompletioncreateparamsidweb.md index 8c668e6..62d1f02 100644 --- a/docs/models/idweb.md +++ b/docs/models/chatcompletioncreateparamsidweb.md @@ -1,4 +1,4 @@ -# IDWeb +# ChatCompletionCreateParamsIDWeb ## Values diff --git a/docs/models/orderenum.md b/docs/models/chatcompletioncreateparamsignoreenum.md similarity index 98% rename from docs/models/orderenum.md rename to docs/models/chatcompletioncreateparamsignoreenum.md index 2e00a0d..39a3791 100644 --- a/docs/models/orderenum.md +++ b/docs/models/chatcompletioncreateparamsignoreenum.md @@ -1,4 +1,4 @@ -# OrderEnum +# ChatCompletionCreateParamsIgnoreEnum ## Values diff --git a/docs/models/chatcompletioncreateparamsignoreunion.md b/docs/models/chatcompletioncreateparamsignoreunion.md new file mode 100644 index 0000000..96cc708 --- /dev/null +++ b/docs/models/chatcompletioncreateparamsignoreunion.md @@ -0,0 +1,17 @@ +# ChatCompletionCreateParamsIgnoreUnion + + +## Supported Types + +### `models.ChatCompletionCreateParamsIgnoreEnum` + +```python +value: models.ChatCompletionCreateParamsIgnoreEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/models/audio.md b/docs/models/chatcompletioncreateparamsimage.md similarity index 85% rename from docs/models/audio.md rename to docs/models/chatcompletioncreateparamsimage.md index 8c0f701..c61f30d 100644 --- a/docs/models/audio.md +++ b/docs/models/chatcompletioncreateparamsimage.md @@ -1,4 +1,4 @@ -# Audio +# ChatCompletionCreateParamsImage ## Supported Types diff --git a/docs/models/jsonschema.md b/docs/models/chatcompletioncreateparamsjsonschema.md similarity index 98% rename from docs/models/jsonschema.md rename to docs/models/chatcompletioncreateparamsjsonschema.md index 9787b1d..f7b77cc 100644 --- a/docs/models/jsonschema.md +++ b/docs/models/chatcompletioncreateparamsjsonschema.md @@ -1,4 +1,4 @@ -# JSONSchema +# ChatCompletionCreateParamsJSONSchema ## Fields diff --git a/docs/models/chatcompletioncreateparamsmaxprice.md b/docs/models/chatcompletioncreateparamsmaxprice.md new file mode 100644 index 0000000..21a9f9d --- /dev/null +++ b/docs/models/chatcompletioncreateparamsmaxprice.md @@ -0,0 +1,14 @@ +# ChatCompletionCreateParamsMaxPrice + +The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `prompt` | [Optional[models.ChatCompletionCreateParamsPrompt]](../models/chatcompletioncreateparamsprompt.md) | :heavy_minus_sign: | N/A | +| `completion` | [Optional[models.ChatCompletionCreateParamsCompletion]](../models/chatcompletioncreateparamscompletion.md) | :heavy_minus_sign: | N/A | +| `image` | [Optional[models.ChatCompletionCreateParamsImage]](../models/chatcompletioncreateparamsimage.md) | :heavy_minus_sign: | N/A | +| `audio` | [Optional[models.ChatCompletionCreateParamsAudio]](../models/chatcompletioncreateparamsaudio.md) | :heavy_minus_sign: | N/A | +| `request` | [Optional[models.ChatCompletionCreateParamsRequest]](../models/chatcompletioncreateparamsrequest.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/ignoreenum.md b/docs/models/chatcompletioncreateparamsonlyenum.md similarity index 98% rename from docs/models/ignoreenum.md rename to docs/models/chatcompletioncreateparamsonlyenum.md index ad28f68..ac7e092 100644 --- a/docs/models/ignoreenum.md +++ b/docs/models/chatcompletioncreateparamsonlyenum.md @@ -1,4 +1,4 @@ -# IgnoreEnum +# ChatCompletionCreateParamsOnlyEnum ## Values diff --git a/docs/models/chatcompletioncreateparamsonlyunion.md b/docs/models/chatcompletioncreateparamsonlyunion.md new file mode 100644 index 0000000..190e394 --- /dev/null +++ b/docs/models/chatcompletioncreateparamsonlyunion.md @@ -0,0 +1,17 @@ +# ChatCompletionCreateParamsOnlyUnion + + +## Supported Types + +### `models.ChatCompletionCreateParamsOnlyEnum` + +```python +value: models.ChatCompletionCreateParamsOnlyEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/models/onlyenum.md b/docs/models/chatcompletioncreateparamsorderenum.md similarity index 98% rename from docs/models/onlyenum.md rename to docs/models/chatcompletioncreateparamsorderenum.md index 1c55f80..a83b3e5 100644 --- a/docs/models/onlyenum.md +++ b/docs/models/chatcompletioncreateparamsorderenum.md @@ -1,4 +1,4 @@ -# OnlyEnum +# ChatCompletionCreateParamsOrderEnum ## Values diff --git a/docs/models/chatcompletioncreateparamsorderunion.md b/docs/models/chatcompletioncreateparamsorderunion.md new file mode 100644 index 0000000..5b1429e --- /dev/null +++ b/docs/models/chatcompletioncreateparamsorderunion.md @@ -0,0 +1,17 @@ +# ChatCompletionCreateParamsOrderUnion + + +## Supported Types + +### `models.ChatCompletionCreateParamsOrderEnum` + +```python +value: models.ChatCompletionCreateParamsOrderEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/models/chatcompletioncreateparamspdf.md b/docs/models/chatcompletioncreateparamspdf.md new file mode 100644 index 0000000..e95b198 --- /dev/null +++ b/docs/models/chatcompletioncreateparamspdf.md @@ -0,0 +1,8 @@ +# ChatCompletionCreateParamsPdf + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `engine` | [Optional[models.ChatCompletionCreateParamsPdfEngine]](../models/chatcompletioncreateparamspdfengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/pdfengine.md b/docs/models/chatcompletioncreateparamspdfengine.md similarity index 82% rename from docs/models/pdfengine.md rename to docs/models/chatcompletioncreateparamspdfengine.md index 55bca5e..1330e18 100644 --- a/docs/models/pdfengine.md +++ b/docs/models/chatcompletioncreateparamspdfengine.md @@ -1,4 +1,4 @@ -# PdfEngine +# ChatCompletionCreateParamsPdfEngine ## Values diff --git a/docs/models/chatcompletioncreateparamspluginchainofthought.md b/docs/models/chatcompletioncreateparamspluginchainofthought.md new file mode 100644 index 0000000..98d012b --- /dev/null +++ b/docs/models/chatcompletioncreateparamspluginchainofthought.md @@ -0,0 +1,8 @@ +# ChatCompletionCreateParamsPluginChainOfThought + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `id` | [models.ChatCompletionCreateParamsIDChainOfThought](../models/chatcompletioncreateparamsidchainofthought.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatcompletioncreateparamspluginfileparser.md b/docs/models/chatcompletioncreateparamspluginfileparser.md new file mode 100644 index 0000000..6d060a6 --- /dev/null +++ b/docs/models/chatcompletioncreateparamspluginfileparser.md @@ -0,0 +1,10 @@ +# ChatCompletionCreateParamsPluginFileParser + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `id` | [models.ChatCompletionCreateParamsIDFileParser](../models/chatcompletioncreateparamsidfileparser.md) | :heavy_check_mark: | N/A | +| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `pdf` | [Optional[models.ChatCompletionCreateParamsPdf]](../models/chatcompletioncreateparamspdf.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatcompletioncreateparamspluginmoderation.md b/docs/models/chatcompletioncreateparamspluginmoderation.md new file mode 100644 index 0000000..a213ea0 --- /dev/null +++ b/docs/models/chatcompletioncreateparamspluginmoderation.md @@ -0,0 +1,8 @@ +# ChatCompletionCreateParamsPluginModeration + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `id` | [models.ChatCompletionCreateParamsIDModeration](../models/chatcompletioncreateparamsidmoderation.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatcompletioncreateparamspluginunion.md b/docs/models/chatcompletioncreateparamspluginunion.md new file mode 100644 index 0000000..f326c21 --- /dev/null +++ b/docs/models/chatcompletioncreateparamspluginunion.md @@ -0,0 +1,29 @@ +# ChatCompletionCreateParamsPluginUnion + + +## Supported Types + +### `models.ChatCompletionCreateParamsPluginModeration` + +```python +value: models.ChatCompletionCreateParamsPluginModeration = /* values here */ +``` + +### `models.ChatCompletionCreateParamsPluginWeb` + +```python +value: models.ChatCompletionCreateParamsPluginWeb = /* values here */ +``` + +### `models.ChatCompletionCreateParamsPluginChainOfThought` + +```python +value: models.ChatCompletionCreateParamsPluginChainOfThought = /* values here */ +``` + +### `models.ChatCompletionCreateParamsPluginFileParser` + +```python +value: models.ChatCompletionCreateParamsPluginFileParser = /* values here */ +``` + diff --git a/docs/models/chatcompletioncreateparamspluginweb.md b/docs/models/chatcompletioncreateparamspluginweb.md new file mode 100644 index 0000000..9796a17 --- /dev/null +++ b/docs/models/chatcompletioncreateparamspluginweb.md @@ -0,0 +1,11 @@ +# ChatCompletionCreateParamsPluginWeb + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `id` | [models.ChatCompletionCreateParamsIDWeb](../models/chatcompletioncreateparamsidweb.md) | :heavy_check_mark: | N/A | +| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `engine` | [Optional[models.ChatCompletionCreateParamsEngine]](../models/chatcompletioncreateparamsengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/completion.md b/docs/models/chatcompletioncreateparamsprompt.md similarity index 84% rename from docs/models/completion.md rename to docs/models/chatcompletioncreateparamsprompt.md index ce9609b..12c0a17 100644 --- a/docs/models/completion.md +++ b/docs/models/chatcompletioncreateparamsprompt.md @@ -1,4 +1,4 @@ -# Completion +# ChatCompletionCreateParamsPrompt ## Supported Types diff --git a/docs/models/provider.md b/docs/models/chatcompletioncreateparamsprovider.md similarity index 91% rename from docs/models/provider.md rename to docs/models/chatcompletioncreateparamsprovider.md index 22de09c..e217d53 100644 --- a/docs/models/provider.md +++ b/docs/models/chatcompletioncreateparamsprovider.md @@ -1,4 +1,4 @@ -# Provider +# ChatCompletionCreateParamsProvider When multiple model providers are available, optionally indicate your routing preference. @@ -9,10 +9,10 @@ When multiple model providers are available, optionally indicate your routing pr | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| | `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | -| `data_collection` | [OptionalNullable[models.DataCollection]](../models/datacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
| -| `order` | List[[models.Order](../models/order.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | -| `only` | List[[models.Only](../models/only.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | -| `ignore` | List[[models.Ignore](../models/ignore.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | -| `quantizations` | List[[models.Quantization](../models/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | -| `sort` | [OptionalNullable[models.Sort]](../models/sort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | -| `max_price` | [Optional[models.MaxPrice]](../models/maxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | \ No newline at end of file +| `data_collection` | [OptionalNullable[models.ChatCompletionCreateParamsDataCollection]](../models/chatcompletioncreateparamsdatacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
| +| `order` | List[[models.ChatCompletionCreateParamsOrderUnion](../models/chatcompletioncreateparamsorderunion.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | +| `only` | List[[models.ChatCompletionCreateParamsOnlyUnion](../models/chatcompletioncreateparamsonlyunion.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | +| `ignore` | List[[models.ChatCompletionCreateParamsIgnoreUnion](../models/chatcompletioncreateparamsignoreunion.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | +| `quantizations` | List[[models.ChatCompletionCreateParamsQuantization](../models/chatcompletioncreateparamsquantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | +| `sort` | [OptionalNullable[models.ChatCompletionCreateParamsSort]](../models/chatcompletioncreateparamssort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | +| `max_price` | [Optional[models.ChatCompletionCreateParamsMaxPrice]](../models/chatcompletioncreateparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | \ No newline at end of file diff --git a/docs/models/quantization.md b/docs/models/chatcompletioncreateparamsquantization.md similarity index 87% rename from docs/models/quantization.md rename to docs/models/chatcompletioncreateparamsquantization.md index 7a0574a..2c6c357 100644 --- a/docs/models/quantization.md +++ b/docs/models/chatcompletioncreateparamsquantization.md @@ -1,4 +1,4 @@ -# Quantization +# ChatCompletionCreateParamsQuantization ## Values diff --git a/docs/models/chatcompletioncreateparamsreasoning.md b/docs/models/chatcompletioncreateparamsreasoning.md new file mode 100644 index 0000000..d2374f7 --- /dev/null +++ b/docs/models/chatcompletioncreateparamsreasoning.md @@ -0,0 +1,13 @@ +# ChatCompletionCreateParamsReasoning + +Reasoning configuration + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Enables reasoning with default settings. Only work for some models. | +| `effort` | [OptionalNullable[models.ChatCompletionCreateParamsEffort]](../models/chatcompletioncreateparamseffort.md) | :heavy_minus_sign: | OpenAI-style reasoning effort setting | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | non-OpenAI-style reasoning effort setting | +| `exclude` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/reasoningeffort.md b/docs/models/chatcompletioncreateparamsreasoningeffort.md similarity index 80% rename from docs/models/reasoningeffort.md rename to docs/models/chatcompletioncreateparamsreasoningeffort.md index 004197f..771aab3 100644 --- a/docs/models/reasoningeffort.md +++ b/docs/models/chatcompletioncreateparamsreasoningeffort.md @@ -1,4 +1,4 @@ -# ReasoningEffort +# ChatCompletionCreateParamsReasoningEffort Reasoning effort diff --git a/docs/models/prompt.md b/docs/models/chatcompletioncreateparamsrequest.md similarity index 84% rename from docs/models/prompt.md rename to docs/models/chatcompletioncreateparamsrequest.md index f242343..05c8a09 100644 --- a/docs/models/prompt.md +++ b/docs/models/chatcompletioncreateparamsrequest.md @@ -1,4 +1,4 @@ -# Prompt +# ChatCompletionCreateParamsRequest ## Supported Types diff --git a/docs/models/chatcompletioncreateparamsresponseformatgrammar.md b/docs/models/chatcompletioncreateparamsresponseformatgrammar.md new file mode 100644 index 0000000..4b4275a --- /dev/null +++ b/docs/models/chatcompletioncreateparamsresponseformatgrammar.md @@ -0,0 +1,11 @@ +# ChatCompletionCreateParamsResponseFormatGrammar + +Custom grammar response format + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `type` | [models.ChatCompletionCreateParamsTypeGrammar](../models/chatcompletioncreateparamstypegrammar.md) | :heavy_check_mark: | N/A | +| `grammar` | *str* | :heavy_check_mark: | Custom grammar for text generation | \ No newline at end of file diff --git a/docs/models/chatcompletioncreateparamsresponseformatjsonobject.md b/docs/models/chatcompletioncreateparamsresponseformatjsonobject.md new file mode 100644 index 0000000..0de86bb --- /dev/null +++ b/docs/models/chatcompletioncreateparamsresponseformatjsonobject.md @@ -0,0 +1,10 @@ +# ChatCompletionCreateParamsResponseFormatJSONObject + +JSON object response format + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `type` | [models.ChatCompletionCreateParamsTypeJSONObject](../models/chatcompletioncreateparamstypejsonobject.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatcompletioncreateparamsresponseformatjsonschema.md b/docs/models/chatcompletioncreateparamsresponseformatjsonschema.md new file mode 100644 index 0000000..9bd34e0 --- /dev/null +++ b/docs/models/chatcompletioncreateparamsresponseformatjsonschema.md @@ -0,0 +1,11 @@ +# ChatCompletionCreateParamsResponseFormatJSONSchema + +JSON Schema response format for structured outputs + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `type` | [models.ChatCompletionCreateParamsTypeJSONSchema](../models/chatcompletioncreateparamstypejsonschema.md) | :heavy_check_mark: | N/A | +| `json_schema` | [models.ChatCompletionCreateParamsJSONSchema](../models/chatcompletioncreateparamsjsonschema.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatcompletioncreateparamsresponseformatpython.md b/docs/models/chatcompletioncreateparamsresponseformatpython.md new file mode 100644 index 0000000..770b61a --- /dev/null +++ b/docs/models/chatcompletioncreateparamsresponseformatpython.md @@ -0,0 +1,10 @@ +# ChatCompletionCreateParamsResponseFormatPython + +Python code response format + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `type` | [models.ChatCompletionCreateParamsTypePython](../models/chatcompletioncreateparamstypepython.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/responseformattext.md b/docs/models/chatcompletioncreateparamsresponseformattext.md similarity index 96% rename from docs/models/responseformattext.md rename to docs/models/chatcompletioncreateparamsresponseformattext.md index 7634448..0eadf11 100644 --- a/docs/models/responseformattext.md +++ b/docs/models/chatcompletioncreateparamsresponseformattext.md @@ -1,4 +1,4 @@ -# ResponseFormatText +# ChatCompletionCreateParamsResponseFormatText Default text response format diff --git a/docs/models/chatcompletioncreateparamsresponseformatunion.md b/docs/models/chatcompletioncreateparamsresponseformatunion.md new file mode 100644 index 0000000..5b66aef --- /dev/null +++ b/docs/models/chatcompletioncreateparamsresponseformatunion.md @@ -0,0 +1,37 @@ +# ChatCompletionCreateParamsResponseFormatUnion + +Response format configuration + + +## Supported Types + +### `models.ChatCompletionCreateParamsResponseFormatText` + +```python +value: models.ChatCompletionCreateParamsResponseFormatText = /* values here */ +``` + +### `models.ChatCompletionCreateParamsResponseFormatJSONObject` + +```python +value: models.ChatCompletionCreateParamsResponseFormatJSONObject = /* values here */ +``` + +### `models.ChatCompletionCreateParamsResponseFormatJSONSchema` + +```python +value: models.ChatCompletionCreateParamsResponseFormatJSONSchema = /* values here */ +``` + +### `models.ChatCompletionCreateParamsResponseFormatGrammar` + +```python +value: models.ChatCompletionCreateParamsResponseFormatGrammar = /* values here */ +``` + +### `models.ChatCompletionCreateParamsResponseFormatPython` + +```python +value: models.ChatCompletionCreateParamsResponseFormatPython = /* values here */ +``` + diff --git a/docs/models/sort.md b/docs/models/chatcompletioncreateparamssort.md similarity index 89% rename from docs/models/sort.md rename to docs/models/chatcompletioncreateparamssort.md index 65b6edb..a11c83a 100644 --- a/docs/models/sort.md +++ b/docs/models/chatcompletioncreateparamssort.md @@ -1,4 +1,4 @@ -# Sort +# ChatCompletionCreateParamsSort The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. diff --git a/docs/models/stop.md b/docs/models/chatcompletioncreateparamsstop.md similarity index 87% rename from docs/models/stop.md rename to docs/models/chatcompletioncreateparamsstop.md index c36d910..5b4be00 100644 --- a/docs/models/stop.md +++ b/docs/models/chatcompletioncreateparamsstop.md @@ -1,4 +1,4 @@ -# Stop +# ChatCompletionCreateParamsStop Stop sequences (up to 4) diff --git a/docs/models/streamoptions.md b/docs/models/chatcompletioncreateparamsstreamoptions.md similarity index 93% rename from docs/models/streamoptions.md rename to docs/models/chatcompletioncreateparamsstreamoptions.md index f004063..9f75def 100644 --- a/docs/models/streamoptions.md +++ b/docs/models/chatcompletioncreateparamsstreamoptions.md @@ -1,4 +1,4 @@ -# StreamOptions +# ChatCompletionCreateParamsStreamOptions Streaming configuration options diff --git a/docs/models/typegrammar.md b/docs/models/chatcompletioncreateparamstypegrammar.md similarity index 69% rename from docs/models/typegrammar.md rename to docs/models/chatcompletioncreateparamstypegrammar.md index ecd24b7..c3cf87f 100644 --- a/docs/models/typegrammar.md +++ b/docs/models/chatcompletioncreateparamstypegrammar.md @@ -1,4 +1,4 @@ -# TypeGrammar +# ChatCompletionCreateParamsTypeGrammar ## Values diff --git a/docs/models/typejsonobject.md b/docs/models/chatcompletioncreateparamstypejsonobject.md similarity index 72% rename from docs/models/typejsonobject.md rename to docs/models/chatcompletioncreateparamstypejsonobject.md index 47eebd5..b3724f9 100644 --- a/docs/models/typejsonobject.md +++ b/docs/models/chatcompletioncreateparamstypejsonobject.md @@ -1,4 +1,4 @@ -# TypeJSONObject +# ChatCompletionCreateParamsTypeJSONObject ## Values diff --git a/docs/models/typejsonschema.md b/docs/models/chatcompletioncreateparamstypejsonschema.md similarity index 72% rename from docs/models/typejsonschema.md rename to docs/models/chatcompletioncreateparamstypejsonschema.md index 47333d3..9f307a4 100644 --- a/docs/models/typejsonschema.md +++ b/docs/models/chatcompletioncreateparamstypejsonschema.md @@ -1,4 +1,4 @@ -# TypeJSONSchema +# ChatCompletionCreateParamsTypeJSONSchema ## Values diff --git a/docs/models/typepython.md b/docs/models/chatcompletioncreateparamstypepython.md similarity index 68% rename from docs/models/typepython.md rename to docs/models/chatcompletioncreateparamstypepython.md index 4304c4b..991e9ac 100644 --- a/docs/models/typepython.md +++ b/docs/models/chatcompletioncreateparamstypepython.md @@ -1,4 +1,4 @@ -# TypePython +# ChatCompletionCreateParamsTypePython ## Values diff --git a/docs/models/chatstreamcompletioncreateparams.md b/docs/models/chatstreamcompletioncreateparams.md new file mode 100644 index 0000000..ce7a8c4 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparams.md @@ -0,0 +1,34 @@ +# ChatStreamCompletionCreateParams + +Chat completion request parameters + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | +| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | | +| `messages` | List[[models.ChatCompletionMessageParam](../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello, how are you?"
}
] | +| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | | +| `reasoning` | [OptionalNullable[models.ChatStreamCompletionCreateParamsReasoning]](../models/chatstreamcompletioncreateparamsreasoning.md) | :heavy_minus_sign: | Reasoning configuration | | +| `response_format` | [Optional[models.ChatStreamCompletionCreateParamsResponseFormatUnion]](../models/chatstreamcompletioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | Response format configuration | | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | | +| `stop` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStop]](../models/chatstreamcompletioncreateparamsstop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | | +| `stream_options` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions]](../models/chatstreamcompletioncreateparamsstreamoptions.md) | :heavy_minus_sign: | N/A | | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | | +| `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | | +| `tools` | List[[models.ChatCompletionTool](../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | | +| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | | +| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | | +| `reasoning_effort` | [OptionalNullable[models.ChatStreamCompletionCreateParamsReasoningEffort]](../models/chatstreamcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | | +| `provider` | [OptionalNullable[models.ChatStreamCompletionCreateParamsProvider]](../models/chatstreamcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[models.ChatStreamCompletionCreateParamsPluginUnion](../models/chatstreamcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsaudio.md b/docs/models/chatstreamcompletioncreateparamsaudio.md new file mode 100644 index 0000000..af8432b --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsaudio.md @@ -0,0 +1,23 @@ +# ChatStreamCompletionCreateParamsAudio + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamscompletion.md b/docs/models/chatstreamcompletioncreateparamscompletion.md new file mode 100644 index 0000000..ce56e0b --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamscompletion.md @@ -0,0 +1,23 @@ +# ChatStreamCompletionCreateParamsCompletion + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamsdatacollection.md b/docs/models/chatstreamcompletioncreateparamsdatacollection.md new file mode 100644 index 0000000..9972e0c --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsdatacollection.md @@ -0,0 +1,14 @@ +# ChatStreamCompletionCreateParamsDataCollection + +Data collection setting. If no available model provider meets the requirement, your request will return an error. +- allow: (default) allow providers which store user data non-transiently and may train on it +- deny: use only providers which do not collect user data. + + + +## Values + +| Name | Value | +| ------- | ------- | +| `DENY` | deny | +| `ALLOW` | allow | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamseffort.md b/docs/models/chatstreamcompletioncreateparamseffort.md new file mode 100644 index 0000000..3a250fe --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamseffort.md @@ -0,0 +1,13 @@ +# ChatStreamCompletionCreateParamsEffort + +OpenAI-style reasoning effort setting + + +## Values + +| Name | Value | +| --------- | --------- | +| `HIGH` | high | +| `MEDIUM` | medium | +| `LOW` | low | +| `MINIMAL` | minimal | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsengine.md b/docs/models/chatstreamcompletioncreateparamsengine.md new file mode 100644 index 0000000..eab43e0 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsengine.md @@ -0,0 +1,9 @@ +# ChatStreamCompletionCreateParamsEngine + + +## Values + +| Name | Value | +| -------- | -------- | +| `NATIVE` | native | +| `EXA` | exa | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsidchainofthought.md b/docs/models/chatstreamcompletioncreateparamsidchainofthought.md new file mode 100644 index 0000000..b27f206 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsidchainofthought.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsIDChainOfThought + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `CHAIN_OF_THOUGHT` | chain-of-thought | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsidfileparser.md b/docs/models/chatstreamcompletioncreateparamsidfileparser.md new file mode 100644 index 0000000..1f968ce --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsidfileparser.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsIDFileParser + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `FILE_PARSER` | file-parser | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsidmoderation.md b/docs/models/chatstreamcompletioncreateparamsidmoderation.md new file mode 100644 index 0000000..3d87f7f --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsidmoderation.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsIDModeration + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `MODERATION` | moderation | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsidweb.md b/docs/models/chatstreamcompletioncreateparamsidweb.md new file mode 100644 index 0000000..19e697e --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsidweb.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsIDWeb + + +## Values + +| Name | Value | +| ----- | ----- | +| `WEB` | web | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsignoreenum.md b/docs/models/chatstreamcompletioncreateparamsignoreenum.md new file mode 100644 index 0000000..e46f946 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsignoreenum.md @@ -0,0 +1,85 @@ +# ChatStreamCompletionCreateParamsIgnoreEnum + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `ANY_SCALE` | AnyScale | +| `CENT_ML` | Cent-ML | +| `HUGGING_FACE` | HuggingFace | +| `HYPERBOLIC_2` | Hyperbolic 2 | +| `LEPTON` | Lepton | +| `LYNN_2` | Lynn 2 | +| `LYNN` | Lynn | +| `MANCER` | Mancer | +| `MODAL` | Modal | +| `OCTO_AI` | OctoAI | +| `RECURSAL` | Recursal | +| `REFLECTION` | Reflection | +| `REPLICATE` | Replicate | +| `SAMBA_NOVA_2` | SambaNova 2 | +| `SF_COMPUTE` | SF Compute | +| `TOGETHER_2` | Together 2 | +| `ONE_DOT_AI` | 01.AI | +| `AI21` | AI21 | +| `AION_LABS` | AionLabs | +| `ALIBABA` | Alibaba | +| `AMAZON_BEDROCK` | Amazon Bedrock | +| `ANTHROPIC` | Anthropic | +| `ATLAS_CLOUD` | AtlasCloud | +| `ATOMA` | Atoma | +| `AVIAN` | Avian | +| `AZURE` | Azure | +| `BASE_TEN` | BaseTen | +| `CEREBRAS` | Cerebras | +| `CHUTES` | Chutes | +| `CLOUDFLARE` | Cloudflare | +| `COHERE` | Cohere | +| `CROF_AI` | CrofAI | +| `CRUSOE` | Crusoe | +| `DEEP_INFRA` | DeepInfra | +| `DEEP_SEEK` | DeepSeek | +| `ENFER` | Enfer | +| `FEATHERLESS` | Featherless | +| `FIREWORKS` | Fireworks | +| `FRIENDLI` | Friendli | +| `GMI_CLOUD` | GMICloud | +| `GOOGLE` | Google | +| `GOOGLE_AI_STUDIO` | Google AI Studio | +| `GROQ` | Groq | +| `HYPERBOLIC` | Hyperbolic | +| `INCEPTION` | Inception | +| `INFERENCE_NET` | InferenceNet | +| `INFERMATIC` | Infermatic | +| `INFLECTION` | Inflection | +| `INO_CLOUD` | InoCloud | +| `KLUSTER` | Kluster | +| `LAMBDA` | Lambda | +| `LIQUID` | Liquid | +| `MANCER_2` | Mancer 2 | +| `META` | Meta | +| `MINIMAX` | Minimax | +| `MISTRAL` | Mistral | +| `MOONSHOT_AI` | Moonshot AI | +| `MORPH` | Morph | +| `N_COMPASS` | NCompass | +| `NEBIUS` | Nebius | +| `NEXT_BIT` | NextBit | +| `NINETEEN` | Nineteen | +| `NOVITA` | Novita | +| `OPEN_AI` | OpenAI | +| `OPEN_INFERENCE` | OpenInference | +| `PARASAIL` | Parasail | +| `PERPLEXITY` | Perplexity | +| `PHALA` | Phala | +| `SAMBA_NOVA` | SambaNova | +| `STEALTH` | Stealth | +| `SWITCHPOINT` | Switchpoint | +| `TARGON` | Targon | +| `TOGETHER` | Together | +| `UBICLOUD` | Ubicloud | +| `VENICE` | Venice | +| `WAND_B` | WandB | +| `X_AI` | xAI | +| `Z_AI` | Z.AI | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsignoreunion.md b/docs/models/chatstreamcompletioncreateparamsignoreunion.md new file mode 100644 index 0000000..46fc295 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsignoreunion.md @@ -0,0 +1,17 @@ +# ChatStreamCompletionCreateParamsIgnoreUnion + + +## Supported Types + +### `models.ChatStreamCompletionCreateParamsIgnoreEnum` + +```python +value: models.ChatStreamCompletionCreateParamsIgnoreEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamsimage.md b/docs/models/chatstreamcompletioncreateparamsimage.md new file mode 100644 index 0000000..29e9b4b --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsimage.md @@ -0,0 +1,23 @@ +# ChatStreamCompletionCreateParamsImage + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamsjsonschema.md b/docs/models/chatstreamcompletioncreateparamsjsonschema.md new file mode 100644 index 0000000..8a7dc08 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsjsonschema.md @@ -0,0 +1,11 @@ +# ChatStreamCompletionCreateParamsJSONSchema + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) | +| `description` | *Optional[str]* | :heavy_minus_sign: | Schema description for the model | +| `schema_` | [Optional[models.ResponseFormatJSONSchemaSchema]](../models/responseformatjsonschemaschema.md) | :heavy_minus_sign: | The schema for the response format, described as a JSON Schema object | +| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable strict schema adherence | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsmaxprice.md b/docs/models/chatstreamcompletioncreateparamsmaxprice.md new file mode 100644 index 0000000..a631f50 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsmaxprice.md @@ -0,0 +1,14 @@ +# ChatStreamCompletionCreateParamsMaxPrice + +The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `prompt` | [Optional[models.ChatStreamCompletionCreateParamsPrompt]](../models/chatstreamcompletioncreateparamsprompt.md) | :heavy_minus_sign: | N/A | +| `completion` | [Optional[models.ChatStreamCompletionCreateParamsCompletion]](../models/chatstreamcompletioncreateparamscompletion.md) | :heavy_minus_sign: | N/A | +| `image` | [Optional[models.ChatStreamCompletionCreateParamsImage]](../models/chatstreamcompletioncreateparamsimage.md) | :heavy_minus_sign: | N/A | +| `audio` | [Optional[models.ChatStreamCompletionCreateParamsAudio]](../models/chatstreamcompletioncreateparamsaudio.md) | :heavy_minus_sign: | N/A | +| `request` | [Optional[models.ChatStreamCompletionCreateParamsRequest]](../models/chatstreamcompletioncreateparamsrequest.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsonlyenum.md b/docs/models/chatstreamcompletioncreateparamsonlyenum.md new file mode 100644 index 0000000..e038932 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsonlyenum.md @@ -0,0 +1,85 @@ +# ChatStreamCompletionCreateParamsOnlyEnum + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `ANY_SCALE` | AnyScale | +| `CENT_ML` | Cent-ML | +| `HUGGING_FACE` | HuggingFace | +| `HYPERBOLIC_2` | Hyperbolic 2 | +| `LEPTON` | Lepton | +| `LYNN_2` | Lynn 2 | +| `LYNN` | Lynn | +| `MANCER` | Mancer | +| `MODAL` | Modal | +| `OCTO_AI` | OctoAI | +| `RECURSAL` | Recursal | +| `REFLECTION` | Reflection | +| `REPLICATE` | Replicate | +| `SAMBA_NOVA_2` | SambaNova 2 | +| `SF_COMPUTE` | SF Compute | +| `TOGETHER_2` | Together 2 | +| `ONE_DOT_AI` | 01.AI | +| `AI21` | AI21 | +| `AION_LABS` | AionLabs | +| `ALIBABA` | Alibaba | +| `AMAZON_BEDROCK` | Amazon Bedrock | +| `ANTHROPIC` | Anthropic | +| `ATLAS_CLOUD` | AtlasCloud | +| `ATOMA` | Atoma | +| `AVIAN` | Avian | +| `AZURE` | Azure | +| `BASE_TEN` | BaseTen | +| `CEREBRAS` | Cerebras | +| `CHUTES` | Chutes | +| `CLOUDFLARE` | Cloudflare | +| `COHERE` | Cohere | +| `CROF_AI` | CrofAI | +| `CRUSOE` | Crusoe | +| `DEEP_INFRA` | DeepInfra | +| `DEEP_SEEK` | DeepSeek | +| `ENFER` | Enfer | +| `FEATHERLESS` | Featherless | +| `FIREWORKS` | Fireworks | +| `FRIENDLI` | Friendli | +| `GMI_CLOUD` | GMICloud | +| `GOOGLE` | Google | +| `GOOGLE_AI_STUDIO` | Google AI Studio | +| `GROQ` | Groq | +| `HYPERBOLIC` | Hyperbolic | +| `INCEPTION` | Inception | +| `INFERENCE_NET` | InferenceNet | +| `INFERMATIC` | Infermatic | +| `INFLECTION` | Inflection | +| `INO_CLOUD` | InoCloud | +| `KLUSTER` | Kluster | +| `LAMBDA` | Lambda | +| `LIQUID` | Liquid | +| `MANCER_2` | Mancer 2 | +| `META` | Meta | +| `MINIMAX` | Minimax | +| `MISTRAL` | Mistral | +| `MOONSHOT_AI` | Moonshot AI | +| `MORPH` | Morph | +| `N_COMPASS` | NCompass | +| `NEBIUS` | Nebius | +| `NEXT_BIT` | NextBit | +| `NINETEEN` | Nineteen | +| `NOVITA` | Novita | +| `OPEN_AI` | OpenAI | +| `OPEN_INFERENCE` | OpenInference | +| `PARASAIL` | Parasail | +| `PERPLEXITY` | Perplexity | +| `PHALA` | Phala | +| `SAMBA_NOVA` | SambaNova | +| `STEALTH` | Stealth | +| `SWITCHPOINT` | Switchpoint | +| `TARGON` | Targon | +| `TOGETHER` | Together | +| `UBICLOUD` | Ubicloud | +| `VENICE` | Venice | +| `WAND_B` | WandB | +| `X_AI` | xAI | +| `Z_AI` | Z.AI | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsonlyunion.md b/docs/models/chatstreamcompletioncreateparamsonlyunion.md new file mode 100644 index 0000000..18f6d13 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsonlyunion.md @@ -0,0 +1,17 @@ +# ChatStreamCompletionCreateParamsOnlyUnion + + +## Supported Types + +### `models.ChatStreamCompletionCreateParamsOnlyEnum` + +```python +value: models.ChatStreamCompletionCreateParamsOnlyEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamsorderenum.md b/docs/models/chatstreamcompletioncreateparamsorderenum.md new file mode 100644 index 0000000..2b1105c --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsorderenum.md @@ -0,0 +1,85 @@ +# ChatStreamCompletionCreateParamsOrderEnum + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `ANY_SCALE` | AnyScale | +| `CENT_ML` | Cent-ML | +| `HUGGING_FACE` | HuggingFace | +| `HYPERBOLIC_2` | Hyperbolic 2 | +| `LEPTON` | Lepton | +| `LYNN_2` | Lynn 2 | +| `LYNN` | Lynn | +| `MANCER` | Mancer | +| `MODAL` | Modal | +| `OCTO_AI` | OctoAI | +| `RECURSAL` | Recursal | +| `REFLECTION` | Reflection | +| `REPLICATE` | Replicate | +| `SAMBA_NOVA_2` | SambaNova 2 | +| `SF_COMPUTE` | SF Compute | +| `TOGETHER_2` | Together 2 | +| `ONE_DOT_AI` | 01.AI | +| `AI21` | AI21 | +| `AION_LABS` | AionLabs | +| `ALIBABA` | Alibaba | +| `AMAZON_BEDROCK` | Amazon Bedrock | +| `ANTHROPIC` | Anthropic | +| `ATLAS_CLOUD` | AtlasCloud | +| `ATOMA` | Atoma | +| `AVIAN` | Avian | +| `AZURE` | Azure | +| `BASE_TEN` | BaseTen | +| `CEREBRAS` | Cerebras | +| `CHUTES` | Chutes | +| `CLOUDFLARE` | Cloudflare | +| `COHERE` | Cohere | +| `CROF_AI` | CrofAI | +| `CRUSOE` | Crusoe | +| `DEEP_INFRA` | DeepInfra | +| `DEEP_SEEK` | DeepSeek | +| `ENFER` | Enfer | +| `FEATHERLESS` | Featherless | +| `FIREWORKS` | Fireworks | +| `FRIENDLI` | Friendli | +| `GMI_CLOUD` | GMICloud | +| `GOOGLE` | Google | +| `GOOGLE_AI_STUDIO` | Google AI Studio | +| `GROQ` | Groq | +| `HYPERBOLIC` | Hyperbolic | +| `INCEPTION` | Inception | +| `INFERENCE_NET` | InferenceNet | +| `INFERMATIC` | Infermatic | +| `INFLECTION` | Inflection | +| `INO_CLOUD` | InoCloud | +| `KLUSTER` | Kluster | +| `LAMBDA` | Lambda | +| `LIQUID` | Liquid | +| `MANCER_2` | Mancer 2 | +| `META` | Meta | +| `MINIMAX` | Minimax | +| `MISTRAL` | Mistral | +| `MOONSHOT_AI` | Moonshot AI | +| `MORPH` | Morph | +| `N_COMPASS` | NCompass | +| `NEBIUS` | Nebius | +| `NEXT_BIT` | NextBit | +| `NINETEEN` | Nineteen | +| `NOVITA` | Novita | +| `OPEN_AI` | OpenAI | +| `OPEN_INFERENCE` | OpenInference | +| `PARASAIL` | Parasail | +| `PERPLEXITY` | Perplexity | +| `PHALA` | Phala | +| `SAMBA_NOVA` | SambaNova | +| `STEALTH` | Stealth | +| `SWITCHPOINT` | Switchpoint | +| `TARGON` | Targon | +| `TOGETHER` | Together | +| `UBICLOUD` | Ubicloud | +| `VENICE` | Venice | +| `WAND_B` | WandB | +| `X_AI` | xAI | +| `Z_AI` | Z.AI | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsorderunion.md b/docs/models/chatstreamcompletioncreateparamsorderunion.md new file mode 100644 index 0000000..ff57c40 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsorderunion.md @@ -0,0 +1,17 @@ +# ChatStreamCompletionCreateParamsOrderUnion + + +## Supported Types + +### `models.ChatStreamCompletionCreateParamsOrderEnum` + +```python +value: models.ChatStreamCompletionCreateParamsOrderEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamspdf.md b/docs/models/chatstreamcompletioncreateparamspdf.md new file mode 100644 index 0000000..60c51a2 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamspdf.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsPdf + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `engine` | [Optional[models.ChatStreamCompletionCreateParamsPdfEngine]](../models/chatstreamcompletioncreateparamspdfengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamspdfengine.md b/docs/models/chatstreamcompletioncreateparamspdfengine.md new file mode 100644 index 0000000..709c8f0 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamspdfengine.md @@ -0,0 +1,10 @@ +# ChatStreamCompletionCreateParamsPdfEngine + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `MISTRAL_OCR` | mistral-ocr | +| `PDF_TEXT` | pdf-text | +| `NATIVE` | native | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamspluginchainofthought.md b/docs/models/chatstreamcompletioncreateparamspluginchainofthought.md new file mode 100644 index 0000000..6f31a2d --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamspluginchainofthought.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsPluginChainOfThought + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `id` | [models.ChatStreamCompletionCreateParamsIDChainOfThought](../models/chatstreamcompletioncreateparamsidchainofthought.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamspluginfileparser.md b/docs/models/chatstreamcompletioncreateparamspluginfileparser.md new file mode 100644 index 0000000..37e3b19 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamspluginfileparser.md @@ -0,0 +1,10 @@ +# ChatStreamCompletionCreateParamsPluginFileParser + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `id` | [models.ChatStreamCompletionCreateParamsIDFileParser](../models/chatstreamcompletioncreateparamsidfileparser.md) | :heavy_check_mark: | N/A | +| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `pdf` | [Optional[models.ChatStreamCompletionCreateParamsPdf]](../models/chatstreamcompletioncreateparamspdf.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamspluginmoderation.md b/docs/models/chatstreamcompletioncreateparamspluginmoderation.md new file mode 100644 index 0000000..16e8729 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamspluginmoderation.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsPluginModeration + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `id` | [models.ChatStreamCompletionCreateParamsIDModeration](../models/chatstreamcompletioncreateparamsidmoderation.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamspluginunion.md b/docs/models/chatstreamcompletioncreateparamspluginunion.md new file mode 100644 index 0000000..47101cc --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamspluginunion.md @@ -0,0 +1,29 @@ +# ChatStreamCompletionCreateParamsPluginUnion + + +## Supported Types + +### `models.ChatStreamCompletionCreateParamsPluginModeration` + +```python +value: models.ChatStreamCompletionCreateParamsPluginModeration = /* values here */ +``` + +### `models.ChatStreamCompletionCreateParamsPluginWeb` + +```python +value: models.ChatStreamCompletionCreateParamsPluginWeb = /* values here */ +``` + +### `models.ChatStreamCompletionCreateParamsPluginChainOfThought` + +```python +value: models.ChatStreamCompletionCreateParamsPluginChainOfThought = /* values here */ +``` + +### `models.ChatStreamCompletionCreateParamsPluginFileParser` + +```python +value: models.ChatStreamCompletionCreateParamsPluginFileParser = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamspluginweb.md b/docs/models/chatstreamcompletioncreateparamspluginweb.md new file mode 100644 index 0000000..28d113d --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamspluginweb.md @@ -0,0 +1,11 @@ +# ChatStreamCompletionCreateParamsPluginWeb + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `id` | [models.ChatStreamCompletionCreateParamsIDWeb](../models/chatstreamcompletioncreateparamsidweb.md) | :heavy_check_mark: | N/A | +| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `engine` | [Optional[models.ChatStreamCompletionCreateParamsEngine]](../models/chatstreamcompletioncreateparamsengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsprompt.md b/docs/models/chatstreamcompletioncreateparamsprompt.md new file mode 100644 index 0000000..dbb7049 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsprompt.md @@ -0,0 +1,23 @@ +# ChatStreamCompletionCreateParamsPrompt + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamsprovider.md b/docs/models/chatstreamcompletioncreateparamsprovider.md new file mode 100644 index 0000000..69bc3d2 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsprovider.md @@ -0,0 +1,18 @@ +# ChatStreamCompletionCreateParamsProvider + +When multiple model providers are available, optionally indicate your routing preference. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to allow backup providers to serve requests
- true: (default) when the primary provider (or your custom providers in "order") is unavailable, use the next best provider.
- false: use only the primary/custom provider, and return the upstream error if it's unavailable.
| +| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest. | +| `data_collection` | [OptionalNullable[models.ChatStreamCompletionCreateParamsDataCollection]](../models/chatstreamcompletioncreateparamsdatacollection.md) | :heavy_minus_sign: | Data collection setting. If no available model provider meets the requirement, your request will return an error.
- allow: (default) allow providers which store user data non-transiently and may train on it
- deny: use only providers which do not collect user data.
| +| `order` | List[[models.ChatStreamCompletionCreateParamsOrderUnion](../models/chatstreamcompletioncreateparamsorderunion.md)] | :heavy_minus_sign: | An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message. | +| `only` | List[[models.ChatStreamCompletionCreateParamsOnlyUnion](../models/chatstreamcompletioncreateparamsonlyunion.md)] | :heavy_minus_sign: | List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. | +| `ignore` | List[[models.ChatStreamCompletionCreateParamsIgnoreUnion](../models/chatstreamcompletioncreateparamsignoreunion.md)] | :heavy_minus_sign: | List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. | +| `quantizations` | List[[models.ChatStreamCompletionCreateParamsQuantization](../models/chatstreamcompletioncreateparamsquantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | +| `sort` | [OptionalNullable[models.ChatStreamCompletionCreateParamsSort]](../models/chatstreamcompletioncreateparamssort.md) | :heavy_minus_sign: | The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. | +| `max_price` | [Optional[models.ChatStreamCompletionCreateParamsMaxPrice]](../models/chatstreamcompletioncreateparamsmaxprice.md) | :heavy_minus_sign: | The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsquantization.md b/docs/models/chatstreamcompletioncreateparamsquantization.md new file mode 100644 index 0000000..180a43e --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsquantization.md @@ -0,0 +1,16 @@ +# ChatStreamCompletionCreateParamsQuantization + + +## Values + +| Name | Value | +| --------- | --------- | +| `INT4` | int4 | +| `INT8` | int8 | +| `FP4` | fp4 | +| `FP6` | fp6 | +| `FP8` | fp8 | +| `FP16` | fp16 | +| `BF16` | bf16 | +| `FP32` | fp32 | +| `UNKNOWN` | unknown | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsreasoning.md b/docs/models/chatstreamcompletioncreateparamsreasoning.md new file mode 100644 index 0000000..1d001f6 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsreasoning.md @@ -0,0 +1,13 @@ +# ChatStreamCompletionCreateParamsReasoning + +Reasoning configuration + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Enables reasoning with default settings. Only work for some models. | +| `effort` | [OptionalNullable[models.ChatStreamCompletionCreateParamsEffort]](../models/chatstreamcompletioncreateparamseffort.md) | :heavy_minus_sign: | OpenAI-style reasoning effort setting | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | non-OpenAI-style reasoning effort setting | +| `exclude` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsreasoningeffort.md b/docs/models/chatstreamcompletioncreateparamsreasoningeffort.md new file mode 100644 index 0000000..8d4800a --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsreasoningeffort.md @@ -0,0 +1,13 @@ +# ChatStreamCompletionCreateParamsReasoningEffort + +Reasoning effort + + +## Values + +| Name | Value | +| --------- | --------- | +| `HIGH` | high | +| `MEDIUM` | medium | +| `LOW` | low | +| `MINIMAL` | minimal | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsrequest.md b/docs/models/chatstreamcompletioncreateparamsrequest.md new file mode 100644 index 0000000..ef75853 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsrequest.md @@ -0,0 +1,23 @@ +# ChatStreamCompletionCreateParamsRequest + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamsresponseformatgrammar.md b/docs/models/chatstreamcompletioncreateparamsresponseformatgrammar.md new file mode 100644 index 0000000..d6fb376 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsresponseformatgrammar.md @@ -0,0 +1,11 @@ +# ChatStreamCompletionCreateParamsResponseFormatGrammar + +Custom grammar response format + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `type` | [models.ChatStreamCompletionCreateParamsTypeGrammar](../models/chatstreamcompletioncreateparamstypegrammar.md) | :heavy_check_mark: | N/A | +| `grammar` | *str* | :heavy_check_mark: | Custom grammar for text generation | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsresponseformatjsonobject.md b/docs/models/chatstreamcompletioncreateparamsresponseformatjsonobject.md new file mode 100644 index 0000000..30c9be5 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsresponseformatjsonobject.md @@ -0,0 +1,10 @@ +# ChatStreamCompletionCreateParamsResponseFormatJSONObject + +JSON object response format + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `type` | [models.ChatStreamCompletionCreateParamsTypeJSONObject](../models/chatstreamcompletioncreateparamstypejsonobject.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsresponseformatjsonschema.md b/docs/models/chatstreamcompletioncreateparamsresponseformatjsonschema.md new file mode 100644 index 0000000..63068dd --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsresponseformatjsonschema.md @@ -0,0 +1,11 @@ +# ChatStreamCompletionCreateParamsResponseFormatJSONSchema + +JSON Schema response format for structured outputs + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `type` | [models.ChatStreamCompletionCreateParamsTypeJSONSchema](../models/chatstreamcompletioncreateparamstypejsonschema.md) | :heavy_check_mark: | N/A | +| `json_schema` | [models.ChatStreamCompletionCreateParamsJSONSchema](../models/chatstreamcompletioncreateparamsjsonschema.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsresponseformatpython.md b/docs/models/chatstreamcompletioncreateparamsresponseformatpython.md new file mode 100644 index 0000000..7aa985c --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsresponseformatpython.md @@ -0,0 +1,10 @@ +# ChatStreamCompletionCreateParamsResponseFormatPython + +Python code response format + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `type` | [models.ChatStreamCompletionCreateParamsTypePython](../models/chatstreamcompletioncreateparamstypepython.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsresponseformattext.md b/docs/models/chatstreamcompletioncreateparamsresponseformattext.md new file mode 100644 index 0000000..ba4bcc4 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsresponseformattext.md @@ -0,0 +1,10 @@ +# ChatStreamCompletionCreateParamsResponseFormatText + +Default text response format + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `type` | [models.ChatStreamCompletionCreateParamsTypeText](../models/chatstreamcompletioncreateparamstypetext.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsresponseformatunion.md b/docs/models/chatstreamcompletioncreateparamsresponseformatunion.md new file mode 100644 index 0000000..f6ba15b --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsresponseformatunion.md @@ -0,0 +1,37 @@ +# ChatStreamCompletionCreateParamsResponseFormatUnion + +Response format configuration + + +## Supported Types + +### `models.ChatStreamCompletionCreateParamsResponseFormatText` + +```python +value: models.ChatStreamCompletionCreateParamsResponseFormatText = /* values here */ +``` + +### `models.ChatStreamCompletionCreateParamsResponseFormatJSONObject` + +```python +value: models.ChatStreamCompletionCreateParamsResponseFormatJSONObject = /* values here */ +``` + +### `models.ChatStreamCompletionCreateParamsResponseFormatJSONSchema` + +```python +value: models.ChatStreamCompletionCreateParamsResponseFormatJSONSchema = /* values here */ +``` + +### `models.ChatStreamCompletionCreateParamsResponseFormatGrammar` + +```python +value: models.ChatStreamCompletionCreateParamsResponseFormatGrammar = /* values here */ +``` + +### `models.ChatStreamCompletionCreateParamsResponseFormatPython` + +```python +value: models.ChatStreamCompletionCreateParamsResponseFormatPython = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamssort.md b/docs/models/chatstreamcompletioncreateparamssort.md new file mode 100644 index 0000000..e2f845a --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamssort.md @@ -0,0 +1,12 @@ +# ChatStreamCompletionCreateParamsSort + +The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamsstop.md b/docs/models/chatstreamcompletioncreateparamsstop.md new file mode 100644 index 0000000..d3cd163 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsstop.md @@ -0,0 +1,25 @@ +# ChatStreamCompletionCreateParamsStop + +Stop sequences (up to 4) + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[str]` + +```python +value: List[str] = /* values here */ +``` + +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/models/chatstreamcompletioncreateparamsstreamoptions.md b/docs/models/chatstreamcompletioncreateparamsstreamoptions.md new file mode 100644 index 0000000..c70a614 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamsstreamoptions.md @@ -0,0 +1,10 @@ +# ChatStreamCompletionCreateParamsStreamOptions + +Streaming configuration options + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | +| `include_usage` | *Optional[bool]* | :heavy_minus_sign: | Include usage information in streaming response | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamstypegrammar.md b/docs/models/chatstreamcompletioncreateparamstypegrammar.md new file mode 100644 index 0000000..8e64f10 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamstypegrammar.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsTypeGrammar + + +## Values + +| Name | Value | +| --------- | --------- | +| `GRAMMAR` | grammar | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamstypejsonobject.md b/docs/models/chatstreamcompletioncreateparamstypejsonobject.md new file mode 100644 index 0000000..bb9c748 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamstypejsonobject.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsTypeJSONObject + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `JSON_OBJECT` | json_object | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamstypejsonschema.md b/docs/models/chatstreamcompletioncreateparamstypejsonschema.md new file mode 100644 index 0000000..172f379 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamstypejsonschema.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsTypeJSONSchema + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `JSON_SCHEMA` | json_schema | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamstypepython.md b/docs/models/chatstreamcompletioncreateparamstypepython.md new file mode 100644 index 0000000..4c2a41e --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamstypepython.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsTypePython + + +## Values + +| Name | Value | +| -------- | -------- | +| `PYTHON` | python | \ No newline at end of file diff --git a/docs/models/chatstreamcompletioncreateparamstypetext.md b/docs/models/chatstreamcompletioncreateparamstypetext.md new file mode 100644 index 0000000..2a5cd35 --- /dev/null +++ b/docs/models/chatstreamcompletioncreateparamstypetext.md @@ -0,0 +1,8 @@ +# ChatStreamCompletionCreateParamsTypeText + + +## Values + +| Name | Value | +| ------ | ------ | +| `TEXT` | text | \ No newline at end of file diff --git a/docs/models/ignore.md b/docs/models/ignore.md deleted file mode 100644 index 2115a3b..0000000 --- a/docs/models/ignore.md +++ /dev/null @@ -1,17 +0,0 @@ -# Ignore - - -## Supported Types - -### `models.IgnoreEnum` - -```python -value: models.IgnoreEnum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/docs/models/maxprice.md b/docs/models/maxprice.md deleted file mode 100644 index 6a1e11b..0000000 --- a/docs/models/maxprice.md +++ /dev/null @@ -1,14 +0,0 @@ -# MaxPrice - -The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `prompt` | [Optional[models.Prompt]](../models/prompt.md) | :heavy_minus_sign: | N/A | -| `completion` | [Optional[models.Completion]](../models/completion.md) | :heavy_minus_sign: | N/A | -| `image` | [Optional[models.Image]](../models/image.md) | :heavy_minus_sign: | N/A | -| `audio` | [Optional[models.Audio]](../models/audio.md) | :heavy_minus_sign: | N/A | -| `request` | [Optional[models.Request]](../models/request.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/only.md b/docs/models/only.md deleted file mode 100644 index 85cd513..0000000 --- a/docs/models/only.md +++ /dev/null @@ -1,17 +0,0 @@ -# Only - - -## Supported Types - -### `models.OnlyEnum` - -```python -value: models.OnlyEnum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/docs/models/order.md b/docs/models/order.md deleted file mode 100644 index cfbc63f..0000000 --- a/docs/models/order.md +++ /dev/null @@ -1,17 +0,0 @@ -# Order - - -## Supported Types - -### `models.OrderEnum` - -```python -value: models.OrderEnum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/docs/models/pdf.md b/docs/models/pdf.md deleted file mode 100644 index aa1a388..0000000 --- a/docs/models/pdf.md +++ /dev/null @@ -1,8 +0,0 @@ -# Pdf - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `engine` | [Optional[models.PdfEngine]](../models/pdfengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/plugin.md b/docs/models/plugin.md deleted file mode 100644 index ec50fd4..0000000 --- a/docs/models/plugin.md +++ /dev/null @@ -1,29 +0,0 @@ -# Plugin - - -## Supported Types - -### `models.PluginModeration` - -```python -value: models.PluginModeration = /* values here */ -``` - -### `models.PluginWeb` - -```python -value: models.PluginWeb = /* values here */ -``` - -### `models.PluginChainOfThought` - -```python -value: models.PluginChainOfThought = /* values here */ -``` - -### `models.PluginFileParser` - -```python -value: models.PluginFileParser = /* values here */ -``` - diff --git a/docs/models/pluginchainofthought.md b/docs/models/pluginchainofthought.md deleted file mode 100644 index e5f069d..0000000 --- a/docs/models/pluginchainofthought.md +++ /dev/null @@ -1,8 +0,0 @@ -# PluginChainOfThought - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `id` | [models.IDChainOfThought](../models/idchainofthought.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/pluginfileparser.md b/docs/models/pluginfileparser.md deleted file mode 100644 index c49e7aa..0000000 --- a/docs/models/pluginfileparser.md +++ /dev/null @@ -1,10 +0,0 @@ -# PluginFileParser - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `id` | [models.IDFileParser](../models/idfileparser.md) | :heavy_check_mark: | N/A | -| `max_files` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `pdf` | [Optional[models.Pdf]](../models/pdf.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/pluginmoderation.md b/docs/models/pluginmoderation.md deleted file mode 100644 index 0e58d2f..0000000 --- a/docs/models/pluginmoderation.md +++ /dev/null @@ -1,8 +0,0 @@ -# PluginModeration - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `id` | [models.IDModeration](../models/idmoderation.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/pluginweb.md b/docs/models/pluginweb.md deleted file mode 100644 index 50e2c17..0000000 --- a/docs/models/pluginweb.md +++ /dev/null @@ -1,11 +0,0 @@ -# PluginWeb - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | -| `id` | [models.IDWeb](../models/idweb.md) | :heavy_check_mark: | N/A | -| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `engine` | [Optional[models.Engine]](../models/engine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/reasoning.md b/docs/models/reasoning.md deleted file mode 100644 index b8c6d85..0000000 --- a/docs/models/reasoning.md +++ /dev/null @@ -1,13 +0,0 @@ -# Reasoning - -Reasoning configuration - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Enables reasoning with default settings. Only work for some models. | -| `effort` | [OptionalNullable[models.Effort]](../models/effort.md) | :heavy_minus_sign: | OpenAI-style reasoning effort setting | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | non-OpenAI-style reasoning effort setting | -| `exclude` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/request.md b/docs/models/request.md deleted file mode 100644 index 1456e9b..0000000 --- a/docs/models/request.md +++ /dev/null @@ -1,23 +0,0 @@ -# Request - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - -### `Any` - -```python -value: Any = /* values here */ -``` - diff --git a/docs/models/responseformat.md b/docs/models/responseformat.md deleted file mode 100644 index 1ab9a0b..0000000 --- a/docs/models/responseformat.md +++ /dev/null @@ -1,37 +0,0 @@ -# ResponseFormat - -Response format configuration - - -## Supported Types - -### `models.ResponseFormatText` - -```python -value: models.ResponseFormatText = /* values here */ -``` - -### `models.ResponseFormatJSONObject` - -```python -value: models.ResponseFormatJSONObject = /* values here */ -``` - -### `models.ResponseFormatJSONSchema` - -```python -value: models.ResponseFormatJSONSchema = /* values here */ -``` - -### `models.ResponseFormatGrammar` - -```python -value: models.ResponseFormatGrammar = /* values here */ -``` - -### `models.ResponseFormatPython` - -```python -value: models.ResponseFormatPython = /* values here */ -``` - diff --git a/docs/models/responseformatgrammar.md b/docs/models/responseformatgrammar.md deleted file mode 100644 index 95ac8aa..0000000 --- a/docs/models/responseformatgrammar.md +++ /dev/null @@ -1,11 +0,0 @@ -# ResponseFormatGrammar - -Custom grammar response format - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | -| `type` | [models.TypeGrammar](../models/typegrammar.md) | :heavy_check_mark: | N/A | -| `grammar` | *str* | :heavy_check_mark: | Custom grammar for text generation | \ No newline at end of file diff --git a/docs/models/responseformatjsonobject.md b/docs/models/responseformatjsonobject.md deleted file mode 100644 index 8c1cbdb..0000000 --- a/docs/models/responseformatjsonobject.md +++ /dev/null @@ -1,10 +0,0 @@ -# ResponseFormatJSONObject - -JSON object response format - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `type` | [models.TypeJSONObject](../models/typejsonobject.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/responseformatjsonschema.md b/docs/models/responseformatjsonschema.md deleted file mode 100644 index 90afdaf..0000000 --- a/docs/models/responseformatjsonschema.md +++ /dev/null @@ -1,11 +0,0 @@ -# ResponseFormatJSONSchema - -JSON Schema response format for structured outputs - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `type` | [models.TypeJSONSchema](../models/typejsonschema.md) | :heavy_check_mark: | N/A | -| `json_schema` | [models.JSONSchema](../models/jsonschema.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/responseformatpython.md b/docs/models/responseformatpython.md deleted file mode 100644 index a7285bd..0000000 --- a/docs/models/responseformatpython.md +++ /dev/null @@ -1,10 +0,0 @@ -# ResponseFormatPython - -Python code response format - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -| `type` | [models.TypePython](../models/typepython.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/streamchatcompletionresponsebody.md b/docs/models/streamchatcompletionresponsebody.md new file mode 100644 index 0000000..a0cca72 --- /dev/null +++ b/docs/models/streamchatcompletionresponsebody.md @@ -0,0 +1,10 @@ +# StreamChatCompletionResponseBody + +Successful chat completion response + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `data` | [models.ChatCompletionChunk](../models/chatcompletionchunk.md) | :heavy_check_mark: | Streaming chat completion chunk | \ No newline at end of file diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index 0f7207d..1110d08 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -3,9 +3,12 @@ ## Overview +Chat completion operations + ### Available Operations * [complete](#complete) - Create a chat completion +* [complete_stream](#complete_stream) - Create a chat completion ## complete @@ -39,34 +42,34 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `messages` | List[[models.ChatCompletionMessageParam](../../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello, how are you?"
}
] | -| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | | -| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | | -| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | | -| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | | -| `reasoning` | [OptionalNullable[models.Reasoning]](../../models/reasoning.md) | :heavy_minus_sign: | Reasoning configuration | | -| `response_format` | [Optional[models.ResponseFormat]](../../models/responseformat.md) | :heavy_minus_sign: | Response format configuration | | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | | -| `stop` | [OptionalNullable[models.Stop]](../../models/stop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | | -| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | | -| `stream_options` | [OptionalNullable[models.StreamOptions]](../../models/streamoptions.md) | :heavy_minus_sign: | N/A | | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | | -| `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | | -| `tools` | List[[models.ChatCompletionTool](../../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | | -| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | | -| `model_list` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | | -| `reasoning_effort` | [OptionalNullable[models.ReasoningEffort]](../../models/reasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | | -| `provider` | [OptionalNullable[models.Provider]](../../models/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | -| `plugins` | List[[models.Plugin](../../models/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| `messages` | List[[models.ChatCompletionMessageParam](../../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello, how are you?"
}
] | +| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | | +| `reasoning` | [OptionalNullable[models.ChatCompletionCreateParamsReasoning]](../../models/chatcompletioncreateparamsreasoning.md) | :heavy_minus_sign: | Reasoning configuration | | +| `response_format` | [Optional[models.ChatCompletionCreateParamsResponseFormatUnion]](../../models/chatcompletioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | Response format configuration | | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | | +| `stop` | [OptionalNullable[models.ChatCompletionCreateParamsStop]](../../models/chatcompletioncreateparamsstop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | | +| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | | +| `stream_options` | [OptionalNullable[models.ChatCompletionCreateParamsStreamOptions]](../../models/chatcompletioncreateparamsstreamoptions.md) | :heavy_minus_sign: | N/A | | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | | +| `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | | +| `tools` | List[[models.ChatCompletionTool](../../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | | +| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | | +| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | | +| `reasoning_effort` | [OptionalNullable[models.ChatCompletionCreateParamsReasoningEffort]](../../models/chatcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | | +| `provider` | [OptionalNullable[models.ChatCompletionCreateParamsProvider]](../../models/chatcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[models.ChatCompletionCreateParamsPluginUnion](../../models/chatcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -74,6 +77,79 @@ with OpenRouter( ### Errors +| Error Type | Status Code | Content Type | +| ----------------------------- | ----------------------------- | ----------------------------- | +| errors.ChatCompletionError | 400, 401, 429 | application/json | +| errors.ChatCompletionError | 500 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | + +## complete_stream + +Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes. + +### Example Usage + + +```python +from openrouter import OpenRouter +import os + + +with OpenRouter( + api_key=os.getenv("OPENROUTER_API_KEY", ""), +) as open_router: + + res = open_router.chat.complete_stream(messages=[ + { + "role": "user", + "content": "Hello, how are you?", + }, + ], stream=False, temperature=1, top_p=1) + + with res as event_stream: + for event in event_stream: + # handle event + print(event, flush=True) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | +| `messages` | List[[models.ChatCompletionMessageParam](../../models/chatcompletionmessageparam.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello, how are you?"
}
] | +| `stream` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable streaming response | | +| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | | +| `reasoning` | [OptionalNullable[models.ChatStreamCompletionCreateParamsReasoning]](../../models/chatstreamcompletioncreateparamsreasoning.md) | :heavy_minus_sign: | Reasoning configuration | | +| `response_format` | [Optional[models.ChatStreamCompletionCreateParamsResponseFormatUnion]](../../models/chatstreamcompletioncreateparamsresponseformatunion.md) | :heavy_minus_sign: | Response format configuration | | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | | +| `stop` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStop]](../../models/chatstreamcompletioncreateparamsstop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | | +| `stream_options` | [OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions]](../../models/chatstreamcompletioncreateparamsstreamoptions.md) | :heavy_minus_sign: | N/A | | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | | +| `tool_choice` | [Optional[models.ChatCompletionToolChoiceOption]](../../models/chatcompletiontoolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | | +| `tools` | List[[models.ChatCompletionTool](../../models/chatcompletiontool.md)] | :heavy_minus_sign: | Available tools for function calling | | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | | +| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | | +| `fallback_models` | List[*str*] | :heavy_minus_sign: | Order of models to fallback to for this request | | +| `reasoning_effort` | [OptionalNullable[models.ChatStreamCompletionCreateParamsReasoningEffort]](../../models/chatstreamcompletioncreateparamsreasoningeffort.md) | :heavy_minus_sign: | Reasoning effort | | +| `provider` | [OptionalNullable[models.ChatStreamCompletionCreateParamsProvider]](../../models/chatstreamcompletioncreateparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[models.ChatStreamCompletionCreateParamsPluginUnion](../../models/chatstreamcompletioncreateparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[Union[eventstreaming.EventStream[models.StreamChatCompletionResponseBody], eventstreaming.EventStreamAsync[models.StreamChatCompletionResponseBody]]](../../models/.md)** + +### Errors + | Error Type | Status Code | Content Type | | ----------------------------- | ----------------------------- | ----------------------------- | | errors.ChatCompletionError | 400, 401, 429 | application/json | diff --git a/pyproject.toml b/pyproject.toml index 8c89d6f..c690282 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.3.3" +version = "0.4.1" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Speakeasy" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 7f63fe3..874c890 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.3.3" +__version__: str = "0.4.1" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.694.1" -__user_agent__: str = "speakeasy-sdk/python 0.3.3 2.694.1 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.4.1 2.694.1 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index 1471064..c4dbfd7 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -21,110 +21,7 @@ class CompleteAcceptEnum(str, Enum): class Chat(BaseSDK): - # region sdk-class-body - @overload - def complete( - self, - *, - messages: Union[ - List[models.ChatCompletionMessageParam], - List[models.ChatCompletionMessageParamTypedDict], - ], - model: Optional[str] = None, - stream: Literal[True], - stream_options: OptionalNullable[ - Union[models.StreamOptions, models.StreamOptionsTypedDict] - ] = UNSET, - temperature: OptionalNullable[float] = 1, - tool_choice: Optional[ - Union[ - models.ChatCompletionToolChoiceOption, - models.ChatCompletionToolChoiceOptionTypedDict, - ] - ] = None, - tools: Optional[ - Union[ - List[models.ChatCompletionTool], - List[models.ChatCompletionToolTypedDict], - ] - ] = None, - top_p: OptionalNullable[float] = 1, - user: Optional[str] = None, - model_list: OptionalNullable[List[str]] = UNSET, - reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET, - provider: OptionalNullable[ - Union[models.Provider, models.ProviderTypedDict] - ] = UNSET, - plugins: Optional[ - Union[List[models.Plugin], List[models.PluginTypedDict]] - ] = None, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - accept_header_override: Optional[CompleteAcceptEnum] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> eventstreaming.EventStream[models.ChatCompletionChunkWrapper]: ... - - @overload - def complete( - self, - *, - messages: Union[ - List[models.ChatCompletionMessageParam], - List[models.ChatCompletionMessageParamTypedDict], - ], - model: Optional[str] = None, - frequency_penalty: OptionalNullable[float] = UNSET, - logit_bias: OptionalNullable[Dict[str, float]] = UNSET, - logprobs: OptionalNullable[bool] = UNSET, - top_logprobs: OptionalNullable[float] = UNSET, - max_completion_tokens: OptionalNullable[float] = UNSET, - max_tokens: OptionalNullable[float] = UNSET, - metadata: Optional[Dict[str, str]] = None, - presence_penalty: OptionalNullable[float] = UNSET, - reasoning: OptionalNullable[ - Union[models.Reasoning, models.ReasoningTypedDict] - ] = UNSET, - response_format: Optional[ - Union[models.ResponseFormat, models.ResponseFormatTypedDict] - ] = None, - seed: OptionalNullable[int] = UNSET, - stop: OptionalNullable[Union[models.Stop, models.StopTypedDict]] = UNSET, - stream: Union[Literal[False], None] = None, - stream_options: OptionalNullable[ - Union[models.StreamOptions, models.StreamOptionsTypedDict] - ] = UNSET, - temperature: OptionalNullable[float] = 1, - tool_choice: Optional[ - Union[ - models.ChatCompletionToolChoiceOption, - models.ChatCompletionToolChoiceOptionTypedDict, - ] - ] = None, - tools: Optional[ - Union[ - List[models.ChatCompletionTool], - List[models.ChatCompletionToolTypedDict], - ] - ] = None, - top_p: OptionalNullable[float] = 1, - user: Optional[str] = None, - model_list: OptionalNullable[List[str]] = UNSET, - reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET, - provider: OptionalNullable[ - Union[models.Provider, models.ProviderTypedDict] - ] = UNSET, - plugins: Optional[ - Union[List[models.Plugin], List[models.PluginTypedDict]] - ] = None, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - accept_header_override: Optional[CompleteAcceptEnum] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> models.ChatCompletion: ... - - # endregion sdk-class-body + r"""Chat completion operations""" def complete( self, @@ -143,16 +40,30 @@ class Chat(BaseSDK): metadata: Optional[Dict[str, str]] = None, presence_penalty: OptionalNullable[float] = UNSET, reasoning: OptionalNullable[ - Union[models.Reasoning, models.ReasoningTypedDict] + Union[ + models.ChatCompletionCreateParamsReasoning, + models.ChatCompletionCreateParamsReasoningTypedDict, + ] ] = UNSET, response_format: Optional[ - Union[models.ResponseFormat, models.ResponseFormatTypedDict] + Union[ + models.ChatCompletionCreateParamsResponseFormatUnion, + models.ChatCompletionCreateParamsResponseFormatUnionTypedDict, + ] ] = None, seed: OptionalNullable[int] = UNSET, - stop: OptionalNullable[Union[models.Stop, models.StopTypedDict]] = UNSET, + stop: OptionalNullable[ + Union[ + models.ChatCompletionCreateParamsStop, + models.ChatCompletionCreateParamsStopTypedDict, + ] + ] = UNSET, stream: OptionalNullable[bool] = False, stream_options: OptionalNullable[ - Union[models.StreamOptions, models.StreamOptionsTypedDict] + Union[ + models.ChatCompletionCreateParamsStreamOptions, + models.ChatCompletionCreateParamsStreamOptionsTypedDict, + ] ] = UNSET, temperature: OptionalNullable[float] = 1, tool_choice: Optional[ @@ -169,13 +80,21 @@ class Chat(BaseSDK): ] = None, top_p: OptionalNullable[float] = 1, user: Optional[str] = None, - model_list: OptionalNullable[List[str]] = UNSET, - reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET, + fallback_models: OptionalNullable[List[str]] = UNSET, + reasoning_effort: OptionalNullable[ + models.ChatCompletionCreateParamsReasoningEffort + ] = UNSET, provider: OptionalNullable[ - Union[models.Provider, models.ProviderTypedDict] + Union[ + models.ChatCompletionCreateParamsProvider, + models.ChatCompletionCreateParamsProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[models.Plugin], List[models.PluginTypedDict]] + Union[ + List[models.ChatCompletionCreateParamsPluginUnion], + List[models.ChatCompletionCreateParamsPluginUnionTypedDict], + ] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -208,7 +127,7 @@ class Chat(BaseSDK): :param tools: Available tools for function calling :param top_p: Nucleus sampling parameter (0-1) :param user: Unique user identifier - :param model_list: Order of models to fallback to for this request + :param fallback_models: Order of models to fallback to for this request :param reasoning_effort: Reasoning effort :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. @@ -242,16 +161,18 @@ class Chat(BaseSDK): metadata=metadata, presence_penalty=presence_penalty, reasoning=utils.get_pydantic_model( - reasoning, OptionalNullable[models.Reasoning] + reasoning, OptionalNullable[models.ChatCompletionCreateParamsReasoning] ), response_format=utils.get_pydantic_model( - response_format, Optional[models.ResponseFormat] + response_format, + Optional[models.ChatCompletionCreateParamsResponseFormatUnion], ), seed=seed, stop=stop, stream=stream, stream_options=utils.get_pydantic_model( - stream_options, OptionalNullable[models.StreamOptions] + stream_options, + OptionalNullable[models.ChatCompletionCreateParamsStreamOptions], ), temperature=temperature, tool_choice=utils.get_pydantic_model( @@ -262,12 +183,14 @@ class Chat(BaseSDK): ), top_p=top_p, user=user, - model_list=model_list, + fallback_models=fallback_models, reasoning_effort=reasoning_effort, provider=utils.get_pydantic_model( - provider, OptionalNullable[models.Provider] + provider, OptionalNullable[models.ChatCompletionCreateParamsProvider] + ), + plugins=utils.get_pydantic_model( + plugins, Optional[List[models.ChatCompletionCreateParamsPluginUnion]] ), - plugins=utils.get_pydantic_model(plugins, Optional[List[models.Plugin]]), ) req = self._build_request( @@ -375,16 +298,30 @@ class Chat(BaseSDK): metadata: Optional[Dict[str, str]] = None, presence_penalty: OptionalNullable[float] = UNSET, reasoning: OptionalNullable[ - Union[models.Reasoning, models.ReasoningTypedDict] + Union[ + models.ChatCompletionCreateParamsReasoning, + models.ChatCompletionCreateParamsReasoningTypedDict, + ] ] = UNSET, response_format: Optional[ - Union[models.ResponseFormat, models.ResponseFormatTypedDict] + Union[ + models.ChatCompletionCreateParamsResponseFormatUnion, + models.ChatCompletionCreateParamsResponseFormatUnionTypedDict, + ] ] = None, seed: OptionalNullable[int] = UNSET, - stop: OptionalNullable[Union[models.Stop, models.StopTypedDict]] = UNSET, + stop: OptionalNullable[ + Union[ + models.ChatCompletionCreateParamsStop, + models.ChatCompletionCreateParamsStopTypedDict, + ] + ] = UNSET, stream: OptionalNullable[bool] = False, stream_options: OptionalNullable[ - Union[models.StreamOptions, models.StreamOptionsTypedDict] + Union[ + models.ChatCompletionCreateParamsStreamOptions, + models.ChatCompletionCreateParamsStreamOptionsTypedDict, + ] ] = UNSET, temperature: OptionalNullable[float] = 1, tool_choice: Optional[ @@ -401,13 +338,21 @@ class Chat(BaseSDK): ] = None, top_p: OptionalNullable[float] = 1, user: Optional[str] = None, - model_list: OptionalNullable[List[str]] = UNSET, - reasoning_effort: OptionalNullable[models.ReasoningEffort] = UNSET, + fallback_models: OptionalNullable[List[str]] = UNSET, + reasoning_effort: OptionalNullable[ + models.ChatCompletionCreateParamsReasoningEffort + ] = UNSET, provider: OptionalNullable[ - Union[models.Provider, models.ProviderTypedDict] + Union[ + models.ChatCompletionCreateParamsProvider, + models.ChatCompletionCreateParamsProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[models.Plugin], List[models.PluginTypedDict]] + Union[ + List[models.ChatCompletionCreateParamsPluginUnion], + List[models.ChatCompletionCreateParamsPluginUnionTypedDict], + ] ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, @@ -440,7 +385,7 @@ class Chat(BaseSDK): :param tools: Available tools for function calling :param top_p: Nucleus sampling parameter (0-1) :param user: Unique user identifier - :param model_list: Order of models to fallback to for this request + :param fallback_models: Order of models to fallback to for this request :param reasoning_effort: Reasoning effort :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. @@ -474,16 +419,18 @@ class Chat(BaseSDK): metadata=metadata, presence_penalty=presence_penalty, reasoning=utils.get_pydantic_model( - reasoning, OptionalNullable[models.Reasoning] + reasoning, OptionalNullable[models.ChatCompletionCreateParamsReasoning] ), response_format=utils.get_pydantic_model( - response_format, Optional[models.ResponseFormat] + response_format, + Optional[models.ChatCompletionCreateParamsResponseFormatUnion], ), seed=seed, stop=stop, stream=stream, stream_options=utils.get_pydantic_model( - stream_options, OptionalNullable[models.StreamOptions] + stream_options, + OptionalNullable[models.ChatCompletionCreateParamsStreamOptions], ), temperature=temperature, tool_choice=utils.get_pydantic_model( @@ -494,12 +441,14 @@ class Chat(BaseSDK): ), top_p=top_p, user=user, - model_list=model_list, + fallback_models=fallback_models, reasoning_effort=reasoning_effort, provider=utils.get_pydantic_model( - provider, OptionalNullable[models.Provider] + provider, OptionalNullable[models.ChatCompletionCreateParamsProvider] + ), + plugins=utils.get_pydantic_model( + plugins, Optional[List[models.ChatCompletionCreateParamsPluginUnion]] ), - plugins=utils.get_pydantic_model(plugins, Optional[List[models.Plugin]]), ) req = self._build_request_async( @@ -589,3 +538,507 @@ class Chat(BaseSDK): raise errors.OpenRouterDefaultError( "Unexpected response received", http_res, http_res_text ) + + def complete_stream( + self, + *, + messages: Union[ + List[models.ChatCompletionMessageParam], + List[models.ChatCompletionMessageParamTypedDict], + ], + stream: OptionalNullable[bool] = False, + model: Optional[str] = None, + frequency_penalty: OptionalNullable[float] = UNSET, + logit_bias: OptionalNullable[Dict[str, float]] = UNSET, + logprobs: OptionalNullable[bool] = UNSET, + top_logprobs: OptionalNullable[float] = UNSET, + max_completion_tokens: OptionalNullable[float] = UNSET, + max_tokens: OptionalNullable[float] = UNSET, + metadata: Optional[Dict[str, str]] = None, + presence_penalty: OptionalNullable[float] = UNSET, + reasoning: OptionalNullable[ + Union[ + models.ChatStreamCompletionCreateParamsReasoning, + models.ChatStreamCompletionCreateParamsReasoningTypedDict, + ] + ] = UNSET, + response_format: Optional[ + Union[ + models.ChatStreamCompletionCreateParamsResponseFormatUnion, + models.ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict, + ] + ] = None, + seed: OptionalNullable[int] = UNSET, + stop: OptionalNullable[ + Union[ + models.ChatStreamCompletionCreateParamsStop, + models.ChatStreamCompletionCreateParamsStopTypedDict, + ] + ] = UNSET, + stream_options: OptionalNullable[ + Union[ + models.ChatStreamCompletionCreateParamsStreamOptions, + models.ChatStreamCompletionCreateParamsStreamOptionsTypedDict, + ] + ] = UNSET, + temperature: OptionalNullable[float] = 1, + tool_choice: Optional[ + Union[ + models.ChatCompletionToolChoiceOption, + models.ChatCompletionToolChoiceOptionTypedDict, + ] + ] = None, + tools: Optional[ + Union[ + List[models.ChatCompletionTool], + List[models.ChatCompletionToolTypedDict], + ] + ] = None, + top_p: OptionalNullable[float] = 1, + user: Optional[str] = None, + fallback_models: OptionalNullable[List[str]] = UNSET, + reasoning_effort: OptionalNullable[ + models.ChatStreamCompletionCreateParamsReasoningEffort + ] = UNSET, + provider: OptionalNullable[ + Union[ + models.ChatStreamCompletionCreateParamsProvider, + models.ChatStreamCompletionCreateParamsProviderTypedDict, + ] + ] = UNSET, + plugins: Optional[ + Union[ + List[models.ChatStreamCompletionCreateParamsPluginUnion], + List[models.ChatStreamCompletionCreateParamsPluginUnionTypedDict], + ] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> eventstreaming.EventStream[models.StreamChatCompletionResponseBody]: + r"""Create a chat completion + + Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes. + + :param messages: List of messages for the conversation + :param stream: Enable streaming response + :param model: Model to use for completion + :param frequency_penalty: Frequency penalty (-2.0 to 2.0) + :param logit_bias: Token logit bias adjustments + :param logprobs: Return log probabilities + :param top_logprobs: Number of top log probabilities to return (0-20) + :param max_completion_tokens: Maximum tokens in completion + :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens) + :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param reasoning: Reasoning configuration + :param response_format: Response format configuration + :param seed: Random seed for deterministic outputs + :param stop: Stop sequences (up to 4) + :param stream_options: + :param temperature: Sampling temperature (0-2) + :param tool_choice: Tool choice configuration + :param tools: Available tools for function calling + :param top_p: Nucleus sampling parameter (0-1) + :param user: Unique user identifier + :param fallback_models: Order of models to fallback to for this request + :param reasoning_effort: Reasoning effort + :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 retries: Override the default retry configuration 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 http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.ChatStreamCompletionCreateParams( + stream=stream, + messages=utils.get_pydantic_model( + messages, List[models.ChatCompletionMessageParam] + ), + model=model, + frequency_penalty=frequency_penalty, + logit_bias=logit_bias, + logprobs=logprobs, + top_logprobs=top_logprobs, + max_completion_tokens=max_completion_tokens, + max_tokens=max_tokens, + metadata=metadata, + presence_penalty=presence_penalty, + reasoning=utils.get_pydantic_model( + reasoning, + OptionalNullable[models.ChatStreamCompletionCreateParamsReasoning], + ), + response_format=utils.get_pydantic_model( + response_format, + Optional[models.ChatStreamCompletionCreateParamsResponseFormatUnion], + ), + seed=seed, + stop=stop, + stream_options=utils.get_pydantic_model( + stream_options, + OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions], + ), + temperature=temperature, + tool_choice=utils.get_pydantic_model( + tool_choice, Optional[models.ChatCompletionToolChoiceOption] + ), + tools=utils.get_pydantic_model( + tools, Optional[List[models.ChatCompletionTool]] + ), + top_p=top_p, + user=user, + fallback_models=fallback_models, + reasoning_effort=reasoning_effort, + provider=utils.get_pydantic_model( + provider, + OptionalNullable[models.ChatStreamCompletionCreateParamsProvider], + ), + plugins=utils.get_pydantic_model( + plugins, + Optional[List[models.ChatStreamCompletionCreateParamsPluginUnion]], + ), + ) + + req = self._build_request( + method="POST", + path="/chat/completions#stream", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="text/event-stream", + http_headers=http_headers, + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.ChatStreamCompletionCreateParams + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="streamChatCompletion", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], + stream=True, + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "text/event-stream"): + return eventstreaming.EventStream( + http_res, + lambda raw: utils.unmarshal_json( + raw, models.StreamChatCompletionResponseBody + ), + sentinel="[DONE]", + client_ref=self, + ) + if utils.match_response(http_res, ["400", "401", "429"], "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.ChatCompletionErrorData, http_res, http_res_text + ) + raise errors.ChatCompletionError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "500", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.ChatCompletionErrorData, http_res, http_res_text + ) + raise errors.ChatCompletionError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + http_res_text = utils.stream_to_text(http_res) + raise errors.OpenRouterDefaultError( + "Unexpected response received", http_res, http_res_text + ) + + async def complete_stream_async( + self, + *, + messages: Union[ + List[models.ChatCompletionMessageParam], + List[models.ChatCompletionMessageParamTypedDict], + ], + stream: OptionalNullable[bool] = False, + model: Optional[str] = None, + frequency_penalty: OptionalNullable[float] = UNSET, + logit_bias: OptionalNullable[Dict[str, float]] = UNSET, + logprobs: OptionalNullable[bool] = UNSET, + top_logprobs: OptionalNullable[float] = UNSET, + max_completion_tokens: OptionalNullable[float] = UNSET, + max_tokens: OptionalNullable[float] = UNSET, + metadata: Optional[Dict[str, str]] = None, + presence_penalty: OptionalNullable[float] = UNSET, + reasoning: OptionalNullable[ + Union[ + models.ChatStreamCompletionCreateParamsReasoning, + models.ChatStreamCompletionCreateParamsReasoningTypedDict, + ] + ] = UNSET, + response_format: Optional[ + Union[ + models.ChatStreamCompletionCreateParamsResponseFormatUnion, + models.ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict, + ] + ] = None, + seed: OptionalNullable[int] = UNSET, + stop: OptionalNullable[ + Union[ + models.ChatStreamCompletionCreateParamsStop, + models.ChatStreamCompletionCreateParamsStopTypedDict, + ] + ] = UNSET, + stream_options: OptionalNullable[ + Union[ + models.ChatStreamCompletionCreateParamsStreamOptions, + models.ChatStreamCompletionCreateParamsStreamOptionsTypedDict, + ] + ] = UNSET, + temperature: OptionalNullable[float] = 1, + tool_choice: Optional[ + Union[ + models.ChatCompletionToolChoiceOption, + models.ChatCompletionToolChoiceOptionTypedDict, + ] + ] = None, + tools: Optional[ + Union[ + List[models.ChatCompletionTool], + List[models.ChatCompletionToolTypedDict], + ] + ] = None, + top_p: OptionalNullable[float] = 1, + user: Optional[str] = None, + fallback_models: OptionalNullable[List[str]] = UNSET, + reasoning_effort: OptionalNullable[ + models.ChatStreamCompletionCreateParamsReasoningEffort + ] = UNSET, + provider: OptionalNullable[ + Union[ + models.ChatStreamCompletionCreateParamsProvider, + models.ChatStreamCompletionCreateParamsProviderTypedDict, + ] + ] = UNSET, + plugins: Optional[ + Union[ + List[models.ChatStreamCompletionCreateParamsPluginUnion], + List[models.ChatStreamCompletionCreateParamsPluginUnionTypedDict], + ] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> eventstreaming.EventStreamAsync[models.StreamChatCompletionResponseBody]: + r"""Create a chat completion + + Creates a model response for the given chat conversation. Supports both streaming and non-streaming modes. + + :param messages: List of messages for the conversation + :param stream: Enable streaming response + :param model: Model to use for completion + :param frequency_penalty: Frequency penalty (-2.0 to 2.0) + :param logit_bias: Token logit bias adjustments + :param logprobs: Return log probabilities + :param top_logprobs: Number of top log probabilities to return (0-20) + :param max_completion_tokens: Maximum tokens in completion + :param max_tokens: Maximum tokens (deprecated, use max_completion_tokens) + :param metadata: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + :param presence_penalty: Presence penalty (-2.0 to 2.0) + :param reasoning: Reasoning configuration + :param response_format: Response format configuration + :param seed: Random seed for deterministic outputs + :param stop: Stop sequences (up to 4) + :param stream_options: + :param temperature: Sampling temperature (0-2) + :param tool_choice: Tool choice configuration + :param tools: Available tools for function calling + :param top_p: Nucleus sampling parameter (0-1) + :param user: Unique user identifier + :param fallback_models: Order of models to fallback to for this request + :param reasoning_effort: Reasoning effort + :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 retries: Override the default retry configuration 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 http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.ChatStreamCompletionCreateParams( + stream=stream, + messages=utils.get_pydantic_model( + messages, List[models.ChatCompletionMessageParam] + ), + model=model, + frequency_penalty=frequency_penalty, + logit_bias=logit_bias, + logprobs=logprobs, + top_logprobs=top_logprobs, + max_completion_tokens=max_completion_tokens, + max_tokens=max_tokens, + metadata=metadata, + presence_penalty=presence_penalty, + reasoning=utils.get_pydantic_model( + reasoning, + OptionalNullable[models.ChatStreamCompletionCreateParamsReasoning], + ), + response_format=utils.get_pydantic_model( + response_format, + Optional[models.ChatStreamCompletionCreateParamsResponseFormatUnion], + ), + seed=seed, + stop=stop, + stream_options=utils.get_pydantic_model( + stream_options, + OptionalNullable[models.ChatStreamCompletionCreateParamsStreamOptions], + ), + temperature=temperature, + tool_choice=utils.get_pydantic_model( + tool_choice, Optional[models.ChatCompletionToolChoiceOption] + ), + tools=utils.get_pydantic_model( + tools, Optional[List[models.ChatCompletionTool]] + ), + top_p=top_p, + user=user, + fallback_models=fallback_models, + reasoning_effort=reasoning_effort, + provider=utils.get_pydantic_model( + provider, + OptionalNullable[models.ChatStreamCompletionCreateParamsProvider], + ), + plugins=utils.get_pydantic_model( + plugins, + Optional[List[models.ChatStreamCompletionCreateParamsPluginUnion]], + ), + ) + + req = self._build_request_async( + method="POST", + path="/chat/completions#stream", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=True, + request_has_path_params=False, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="text/event-stream", + http_headers=http_headers, + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.ChatStreamCompletionCreateParams + ), + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="streamChatCompletion", + oauth2_scopes=[], + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + ), + request=req, + error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], + stream=True, + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "text/event-stream"): + return eventstreaming.EventStreamAsync( + http_res, + lambda raw: utils.unmarshal_json( + raw, models.StreamChatCompletionResponseBody + ), + sentinel="[DONE]", + client_ref=self, + ) + if utils.match_response(http_res, ["400", "401", "429"], "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.ChatCompletionErrorData, http_res, http_res_text + ) + raise errors.ChatCompletionError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "500", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.ChatCompletionErrorData, http_res, http_res_text + ) + raise errors.ChatCompletionError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "API error occurred", http_res, http_res_text + ) + + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.OpenRouterDefaultError( + "Unexpected response received", http_res, http_res_text + ) diff --git a/src/openrouter/models/__init__.py b/src/openrouter/models/__init__.py index 9ec727c..48f8e53 100644 --- a/src/openrouter/models/__init__.py +++ b/src/openrouter/models/__init__.py @@ -76,79 +76,79 @@ if TYPE_CHECKING: ChatCompletionContentPartTextTypedDict, ) from .chatcompletioncreateparams import ( - Audio, - AudioTypedDict, ChatCompletionCreateParams, + ChatCompletionCreateParamsAudio, + ChatCompletionCreateParamsAudioTypedDict, + ChatCompletionCreateParamsCompletion, + ChatCompletionCreateParamsCompletionTypedDict, + ChatCompletionCreateParamsDataCollection, + ChatCompletionCreateParamsEffort, + ChatCompletionCreateParamsEngine, + ChatCompletionCreateParamsIDChainOfThought, + ChatCompletionCreateParamsIDFileParser, + ChatCompletionCreateParamsIDModeration, + ChatCompletionCreateParamsIDWeb, + ChatCompletionCreateParamsIgnoreEnum, + ChatCompletionCreateParamsIgnoreUnion, + ChatCompletionCreateParamsIgnoreUnionTypedDict, + ChatCompletionCreateParamsImage, + ChatCompletionCreateParamsImageTypedDict, + ChatCompletionCreateParamsJSONSchema, + ChatCompletionCreateParamsJSONSchemaTypedDict, + ChatCompletionCreateParamsMaxPrice, + ChatCompletionCreateParamsMaxPriceTypedDict, + ChatCompletionCreateParamsOnlyEnum, + ChatCompletionCreateParamsOnlyUnion, + ChatCompletionCreateParamsOnlyUnionTypedDict, + ChatCompletionCreateParamsOrderEnum, + ChatCompletionCreateParamsOrderUnion, + ChatCompletionCreateParamsOrderUnionTypedDict, + ChatCompletionCreateParamsPdf, + ChatCompletionCreateParamsPdfEngine, + ChatCompletionCreateParamsPdfTypedDict, + ChatCompletionCreateParamsPluginChainOfThought, + ChatCompletionCreateParamsPluginChainOfThoughtTypedDict, + ChatCompletionCreateParamsPluginFileParser, + ChatCompletionCreateParamsPluginFileParserTypedDict, + ChatCompletionCreateParamsPluginModeration, + ChatCompletionCreateParamsPluginModerationTypedDict, + ChatCompletionCreateParamsPluginUnion, + ChatCompletionCreateParamsPluginUnionTypedDict, + ChatCompletionCreateParamsPluginWeb, + ChatCompletionCreateParamsPluginWebTypedDict, + ChatCompletionCreateParamsPrompt, + ChatCompletionCreateParamsPromptTypedDict, + ChatCompletionCreateParamsProvider, + ChatCompletionCreateParamsProviderTypedDict, + ChatCompletionCreateParamsQuantization, + ChatCompletionCreateParamsReasoning, + ChatCompletionCreateParamsReasoningEffort, + ChatCompletionCreateParamsReasoningTypedDict, + ChatCompletionCreateParamsRequest, + ChatCompletionCreateParamsRequestTypedDict, + ChatCompletionCreateParamsResponseFormatGrammar, + ChatCompletionCreateParamsResponseFormatGrammarTypedDict, + ChatCompletionCreateParamsResponseFormatJSONObject, + ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict, + ChatCompletionCreateParamsResponseFormatJSONSchema, + ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict, + ChatCompletionCreateParamsResponseFormatPython, + ChatCompletionCreateParamsResponseFormatPythonTypedDict, + ChatCompletionCreateParamsResponseFormatText, + ChatCompletionCreateParamsResponseFormatTextTypedDict, + ChatCompletionCreateParamsResponseFormatUnion, + ChatCompletionCreateParamsResponseFormatUnionTypedDict, + ChatCompletionCreateParamsSort, + ChatCompletionCreateParamsStop, + ChatCompletionCreateParamsStopTypedDict, + ChatCompletionCreateParamsStreamOptions, + ChatCompletionCreateParamsStreamOptionsTypedDict, + ChatCompletionCreateParamsTypeGrammar, + ChatCompletionCreateParamsTypeJSONObject, + ChatCompletionCreateParamsTypeJSONSchema, + ChatCompletionCreateParamsTypePython, ChatCompletionCreateParamsTypeText, ChatCompletionCreateParamsTypedDict, - Completion, - CompletionTypedDict, - DataCollection, - Effort, - Engine, - IDChainOfThought, - IDFileParser, - IDModeration, - IDWeb, - Ignore, - IgnoreEnum, - IgnoreTypedDict, - Image, - ImageTypedDict, - JSONSchema, - JSONSchemaTypedDict, - MaxPrice, - MaxPriceTypedDict, - Only, - OnlyEnum, - OnlyTypedDict, - Order, - OrderEnum, - OrderTypedDict, - Pdf, - PdfEngine, - PdfTypedDict, - Plugin, - PluginChainOfThought, - PluginChainOfThoughtTypedDict, - PluginFileParser, - PluginFileParserTypedDict, - PluginModeration, - PluginModerationTypedDict, - PluginTypedDict, - PluginWeb, - PluginWebTypedDict, - Prompt, - PromptTypedDict, - Provider, - ProviderTypedDict, - Quantization, - Reasoning, - ReasoningEffort, - ReasoningTypedDict, - Request, - RequestTypedDict, - ResponseFormat, - ResponseFormatGrammar, - ResponseFormatGrammarTypedDict, - ResponseFormatJSONObject, - ResponseFormatJSONObjectTypedDict, - ResponseFormatJSONSchema, - ResponseFormatJSONSchemaTypedDict, - ResponseFormatPython, - ResponseFormatPythonTypedDict, - ResponseFormatText, - ResponseFormatTextTypedDict, - ResponseFormatTypedDict, - Sort, - Stop, - StopTypedDict, - StreamOptions, - StreamOptionsTypedDict, - TypeGrammar, - TypeJSONObject, - TypeJSONSchema, - TypePython, ) from .chatcompletionerror import Error, ErrorTypedDict from .chatcompletionmessage import ( @@ -221,6 +221,81 @@ if TYPE_CHECKING: ChatCompletionUserMessageParamRole, ChatCompletionUserMessageParamTypedDict, ) + from .chatstreamcompletioncreateparams import ( + ChatStreamCompletionCreateParams, + ChatStreamCompletionCreateParamsAudio, + ChatStreamCompletionCreateParamsAudioTypedDict, + ChatStreamCompletionCreateParamsCompletion, + ChatStreamCompletionCreateParamsCompletionTypedDict, + ChatStreamCompletionCreateParamsDataCollection, + ChatStreamCompletionCreateParamsEffort, + ChatStreamCompletionCreateParamsEngine, + ChatStreamCompletionCreateParamsIDChainOfThought, + ChatStreamCompletionCreateParamsIDFileParser, + ChatStreamCompletionCreateParamsIDModeration, + ChatStreamCompletionCreateParamsIDWeb, + ChatStreamCompletionCreateParamsIgnoreEnum, + ChatStreamCompletionCreateParamsIgnoreUnion, + ChatStreamCompletionCreateParamsIgnoreUnionTypedDict, + ChatStreamCompletionCreateParamsImage, + ChatStreamCompletionCreateParamsImageTypedDict, + ChatStreamCompletionCreateParamsJSONSchema, + ChatStreamCompletionCreateParamsJSONSchemaTypedDict, + ChatStreamCompletionCreateParamsMaxPrice, + ChatStreamCompletionCreateParamsMaxPriceTypedDict, + ChatStreamCompletionCreateParamsOnlyEnum, + ChatStreamCompletionCreateParamsOnlyUnion, + ChatStreamCompletionCreateParamsOnlyUnionTypedDict, + ChatStreamCompletionCreateParamsOrderEnum, + ChatStreamCompletionCreateParamsOrderUnion, + ChatStreamCompletionCreateParamsOrderUnionTypedDict, + ChatStreamCompletionCreateParamsPdf, + ChatStreamCompletionCreateParamsPdfEngine, + ChatStreamCompletionCreateParamsPdfTypedDict, + ChatStreamCompletionCreateParamsPluginChainOfThought, + ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict, + ChatStreamCompletionCreateParamsPluginFileParser, + ChatStreamCompletionCreateParamsPluginFileParserTypedDict, + ChatStreamCompletionCreateParamsPluginModeration, + ChatStreamCompletionCreateParamsPluginModerationTypedDict, + ChatStreamCompletionCreateParamsPluginUnion, + ChatStreamCompletionCreateParamsPluginUnionTypedDict, + ChatStreamCompletionCreateParamsPluginWeb, + ChatStreamCompletionCreateParamsPluginWebTypedDict, + ChatStreamCompletionCreateParamsPrompt, + ChatStreamCompletionCreateParamsPromptTypedDict, + ChatStreamCompletionCreateParamsProvider, + ChatStreamCompletionCreateParamsProviderTypedDict, + ChatStreamCompletionCreateParamsQuantization, + ChatStreamCompletionCreateParamsReasoning, + ChatStreamCompletionCreateParamsReasoningEffort, + ChatStreamCompletionCreateParamsReasoningTypedDict, + ChatStreamCompletionCreateParamsRequest, + ChatStreamCompletionCreateParamsRequestTypedDict, + ChatStreamCompletionCreateParamsResponseFormatGrammar, + ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict, + ChatStreamCompletionCreateParamsResponseFormatJSONObject, + ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict, + ChatStreamCompletionCreateParamsResponseFormatJSONSchema, + ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict, + ChatStreamCompletionCreateParamsResponseFormatPython, + ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict, + ChatStreamCompletionCreateParamsResponseFormatText, + ChatStreamCompletionCreateParamsResponseFormatTextTypedDict, + ChatStreamCompletionCreateParamsResponseFormatUnion, + ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict, + ChatStreamCompletionCreateParamsSort, + ChatStreamCompletionCreateParamsStop, + ChatStreamCompletionCreateParamsStopTypedDict, + ChatStreamCompletionCreateParamsStreamOptions, + ChatStreamCompletionCreateParamsStreamOptionsTypedDict, + ChatStreamCompletionCreateParamsTypeGrammar, + ChatStreamCompletionCreateParamsTypeJSONObject, + ChatStreamCompletionCreateParamsTypeJSONSchema, + ChatStreamCompletionCreateParamsTypePython, + ChatStreamCompletionCreateParamsTypeText, + ChatStreamCompletionCreateParamsTypedDict, + ) from .completionusage import ( CompletionTokensDetails, CompletionTokensDetailsTypedDict, @@ -274,6 +349,10 @@ if TYPE_CHECKING: ResponseFormatJSONSchemaSchemaTypedDict, ) from .security import Security, SecurityTypedDict + from .streamchatcompletionop import ( + StreamChatCompletionResponseBody, + StreamChatCompletionResponseBodyTypedDict, + ) from .urlcitationannotationdetail import ( URLCitation, URLCitationAnnotationDetail, @@ -285,8 +364,6 @@ if TYPE_CHECKING: __all__ = [ "AnnotationDetail", "AnnotationDetailTypedDict", - "Audio", - "AudioTypedDict", "ChatCompletion", "ChatCompletionAssistantMessageParam", "ChatCompletionAssistantMessageParamContent", @@ -327,6 +404,76 @@ __all__ = [ "ChatCompletionContentPartTextTypedDict", "ChatCompletionContentPartTypedDict", "ChatCompletionCreateParams", + "ChatCompletionCreateParamsAudio", + "ChatCompletionCreateParamsAudioTypedDict", + "ChatCompletionCreateParamsCompletion", + "ChatCompletionCreateParamsCompletionTypedDict", + "ChatCompletionCreateParamsDataCollection", + "ChatCompletionCreateParamsEffort", + "ChatCompletionCreateParamsEngine", + "ChatCompletionCreateParamsIDChainOfThought", + "ChatCompletionCreateParamsIDFileParser", + "ChatCompletionCreateParamsIDModeration", + "ChatCompletionCreateParamsIDWeb", + "ChatCompletionCreateParamsIgnoreEnum", + "ChatCompletionCreateParamsIgnoreUnion", + "ChatCompletionCreateParamsIgnoreUnionTypedDict", + "ChatCompletionCreateParamsImage", + "ChatCompletionCreateParamsImageTypedDict", + "ChatCompletionCreateParamsJSONSchema", + "ChatCompletionCreateParamsJSONSchemaTypedDict", + "ChatCompletionCreateParamsMaxPrice", + "ChatCompletionCreateParamsMaxPriceTypedDict", + "ChatCompletionCreateParamsOnlyEnum", + "ChatCompletionCreateParamsOnlyUnion", + "ChatCompletionCreateParamsOnlyUnionTypedDict", + "ChatCompletionCreateParamsOrderEnum", + "ChatCompletionCreateParamsOrderUnion", + "ChatCompletionCreateParamsOrderUnionTypedDict", + "ChatCompletionCreateParamsPdf", + "ChatCompletionCreateParamsPdfEngine", + "ChatCompletionCreateParamsPdfTypedDict", + "ChatCompletionCreateParamsPluginChainOfThought", + "ChatCompletionCreateParamsPluginChainOfThoughtTypedDict", + "ChatCompletionCreateParamsPluginFileParser", + "ChatCompletionCreateParamsPluginFileParserTypedDict", + "ChatCompletionCreateParamsPluginModeration", + "ChatCompletionCreateParamsPluginModerationTypedDict", + "ChatCompletionCreateParamsPluginUnion", + "ChatCompletionCreateParamsPluginUnionTypedDict", + "ChatCompletionCreateParamsPluginWeb", + "ChatCompletionCreateParamsPluginWebTypedDict", + "ChatCompletionCreateParamsPrompt", + "ChatCompletionCreateParamsPromptTypedDict", + "ChatCompletionCreateParamsProvider", + "ChatCompletionCreateParamsProviderTypedDict", + "ChatCompletionCreateParamsQuantization", + "ChatCompletionCreateParamsReasoning", + "ChatCompletionCreateParamsReasoningEffort", + "ChatCompletionCreateParamsReasoningTypedDict", + "ChatCompletionCreateParamsRequest", + "ChatCompletionCreateParamsRequestTypedDict", + "ChatCompletionCreateParamsResponseFormatGrammar", + "ChatCompletionCreateParamsResponseFormatGrammarTypedDict", + "ChatCompletionCreateParamsResponseFormatJSONObject", + "ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict", + "ChatCompletionCreateParamsResponseFormatJSONSchema", + "ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict", + "ChatCompletionCreateParamsResponseFormatPython", + "ChatCompletionCreateParamsResponseFormatPythonTypedDict", + "ChatCompletionCreateParamsResponseFormatText", + "ChatCompletionCreateParamsResponseFormatTextTypedDict", + "ChatCompletionCreateParamsResponseFormatUnion", + "ChatCompletionCreateParamsResponseFormatUnionTypedDict", + "ChatCompletionCreateParamsSort", + "ChatCompletionCreateParamsStop", + "ChatCompletionCreateParamsStopTypedDict", + "ChatCompletionCreateParamsStreamOptions", + "ChatCompletionCreateParamsStreamOptionsTypedDict", + "ChatCompletionCreateParamsTypeGrammar", + "ChatCompletionCreateParamsTypeJSONObject", + "ChatCompletionCreateParamsTypeJSONSchema", + "ChatCompletionCreateParamsTypePython", "ChatCompletionCreateParamsTypeText", "ChatCompletionCreateParamsTypedDict", "ChatCompletionMessage", @@ -375,10 +522,81 @@ __all__ = [ "ChatCompletionUserMessageParamContentTypedDict", "ChatCompletionUserMessageParamRole", "ChatCompletionUserMessageParamTypedDict", - "Completion", + "ChatStreamCompletionCreateParams", + "ChatStreamCompletionCreateParamsAudio", + "ChatStreamCompletionCreateParamsAudioTypedDict", + "ChatStreamCompletionCreateParamsCompletion", + "ChatStreamCompletionCreateParamsCompletionTypedDict", + "ChatStreamCompletionCreateParamsDataCollection", + "ChatStreamCompletionCreateParamsEffort", + "ChatStreamCompletionCreateParamsEngine", + "ChatStreamCompletionCreateParamsIDChainOfThought", + "ChatStreamCompletionCreateParamsIDFileParser", + "ChatStreamCompletionCreateParamsIDModeration", + "ChatStreamCompletionCreateParamsIDWeb", + "ChatStreamCompletionCreateParamsIgnoreEnum", + "ChatStreamCompletionCreateParamsIgnoreUnion", + "ChatStreamCompletionCreateParamsIgnoreUnionTypedDict", + "ChatStreamCompletionCreateParamsImage", + "ChatStreamCompletionCreateParamsImageTypedDict", + "ChatStreamCompletionCreateParamsJSONSchema", + "ChatStreamCompletionCreateParamsJSONSchemaTypedDict", + "ChatStreamCompletionCreateParamsMaxPrice", + "ChatStreamCompletionCreateParamsMaxPriceTypedDict", + "ChatStreamCompletionCreateParamsOnlyEnum", + "ChatStreamCompletionCreateParamsOnlyUnion", + "ChatStreamCompletionCreateParamsOnlyUnionTypedDict", + "ChatStreamCompletionCreateParamsOrderEnum", + "ChatStreamCompletionCreateParamsOrderUnion", + "ChatStreamCompletionCreateParamsOrderUnionTypedDict", + "ChatStreamCompletionCreateParamsPdf", + "ChatStreamCompletionCreateParamsPdfEngine", + "ChatStreamCompletionCreateParamsPdfTypedDict", + "ChatStreamCompletionCreateParamsPluginChainOfThought", + "ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict", + "ChatStreamCompletionCreateParamsPluginFileParser", + "ChatStreamCompletionCreateParamsPluginFileParserTypedDict", + "ChatStreamCompletionCreateParamsPluginModeration", + "ChatStreamCompletionCreateParamsPluginModerationTypedDict", + "ChatStreamCompletionCreateParamsPluginUnion", + "ChatStreamCompletionCreateParamsPluginUnionTypedDict", + "ChatStreamCompletionCreateParamsPluginWeb", + "ChatStreamCompletionCreateParamsPluginWebTypedDict", + "ChatStreamCompletionCreateParamsPrompt", + "ChatStreamCompletionCreateParamsPromptTypedDict", + "ChatStreamCompletionCreateParamsProvider", + "ChatStreamCompletionCreateParamsProviderTypedDict", + "ChatStreamCompletionCreateParamsQuantization", + "ChatStreamCompletionCreateParamsReasoning", + "ChatStreamCompletionCreateParamsReasoningEffort", + "ChatStreamCompletionCreateParamsReasoningTypedDict", + "ChatStreamCompletionCreateParamsRequest", + "ChatStreamCompletionCreateParamsRequestTypedDict", + "ChatStreamCompletionCreateParamsResponseFormatGrammar", + "ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict", + "ChatStreamCompletionCreateParamsResponseFormatJSONObject", + "ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict", + "ChatStreamCompletionCreateParamsResponseFormatJSONSchema", + "ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict", + "ChatStreamCompletionCreateParamsResponseFormatPython", + "ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict", + "ChatStreamCompletionCreateParamsResponseFormatText", + "ChatStreamCompletionCreateParamsResponseFormatTextTypedDict", + "ChatStreamCompletionCreateParamsResponseFormatUnion", + "ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict", + "ChatStreamCompletionCreateParamsSort", + "ChatStreamCompletionCreateParamsStop", + "ChatStreamCompletionCreateParamsStopTypedDict", + "ChatStreamCompletionCreateParamsStreamOptions", + "ChatStreamCompletionCreateParamsStreamOptionsTypedDict", + "ChatStreamCompletionCreateParamsTypeGrammar", + "ChatStreamCompletionCreateParamsTypeJSONObject", + "ChatStreamCompletionCreateParamsTypeJSONSchema", + "ChatStreamCompletionCreateParamsTypePython", + "ChatStreamCompletionCreateParamsTypeText", + "ChatStreamCompletionCreateParamsTypedDict", "CompletionTokensDetails", "CompletionTokensDetailsTypedDict", - "CompletionTypedDict", "CompletionUsage", "CompletionUsageTypedDict", "ContentImageURL", @@ -389,10 +607,7 @@ __all__ = [ "ContentTypeText", "CreateChatCompletionResponse", "CreateChatCompletionResponseTypedDict", - "DataCollection", "Detail", - "Effort", - "Engine", "Error", "ErrorTypedDict", "File", @@ -403,50 +618,12 @@ __all__ = [ "FileAnnotationDetailImageURLTypedDict", "FileAnnotationDetailTypedDict", "FileTypedDict", - "IDChainOfThought", - "IDFileParser", - "IDModeration", - "IDWeb", - "Ignore", - "IgnoreEnum", - "IgnoreTypedDict", - "Image", - "ImageTypedDict", "InputAudio", "InputAudioTypedDict", - "JSONSchema", - "JSONSchemaTypedDict", - "MaxPrice", - "MaxPriceTypedDict", - "Only", - "OnlyEnum", - "OnlyTypedDict", - "Order", - "OrderEnum", - "OrderTypedDict", "Parameters", "ParametersTypedDict", - "Pdf", - "PdfEngine", - "PdfTypedDict", - "Plugin", - "PluginChainOfThought", - "PluginChainOfThoughtTypedDict", - "PluginFileParser", - "PluginFileParserTypedDict", - "PluginModeration", - "PluginModerationTypedDict", - "PluginTypedDict", - "PluginWeb", - "PluginWebTypedDict", - "Prompt", "PromptTokensDetails", "PromptTokensDetailsTypedDict", - "PromptTypedDict", - "Provider", - "ProviderTypedDict", - "Quantization", - "Reasoning", "ReasoningDetail", "ReasoningDetailEncrypted", "ReasoningDetailEncryptedFormat", @@ -461,38 +638,15 @@ __all__ = [ "ReasoningDetailTextType", "ReasoningDetailTextTypedDict", "ReasoningDetailTypedDict", - "ReasoningEffort", - "ReasoningTypedDict", - "Request", - "RequestTypedDict", - "ResponseFormat", - "ResponseFormatGrammar", - "ResponseFormatGrammarTypedDict", - "ResponseFormatJSONObject", - "ResponseFormatJSONObjectTypedDict", - "ResponseFormatJSONSchema", "ResponseFormatJSONSchemaSchema", "ResponseFormatJSONSchemaSchemaTypedDict", - "ResponseFormatJSONSchemaTypedDict", - "ResponseFormatPython", - "ResponseFormatPythonTypedDict", - "ResponseFormatText", - "ResponseFormatTextTypedDict", - "ResponseFormatTypedDict", "Security", "SecurityTypedDict", - "Sort", - "Stop", - "StopTypedDict", - "StreamOptions", - "StreamOptionsTypedDict", + "StreamChatCompletionResponseBody", + "StreamChatCompletionResponseBodyTypedDict", "TopLogprob", "TopLogprobTypedDict", "TypeFile", - "TypeGrammar", - "TypeJSONObject", - "TypeJSONSchema", - "TypePython", "URLCitation", "URLCitationAnnotationDetail", "URLCitationAnnotationDetailType", @@ -547,79 +701,79 @@ _dynamic_imports: dict[str, str] = { "ChatCompletionContentPartText": ".chatcompletioncontentparttext", "ChatCompletionContentPartTextType": ".chatcompletioncontentparttext", "ChatCompletionContentPartTextTypedDict": ".chatcompletioncontentparttext", - "Audio": ".chatcompletioncreateparams", - "AudioTypedDict": ".chatcompletioncreateparams", "ChatCompletionCreateParams": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsAudio": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsAudioTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsCompletion": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsCompletionTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsDataCollection": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsEffort": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsEngine": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsIDChainOfThought": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsIDFileParser": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsIDModeration": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsIDWeb": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsIgnoreEnum": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsIgnoreUnion": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsIgnoreUnionTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsImage": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsImageTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsJSONSchema": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsJSONSchemaTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsMaxPrice": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsMaxPriceTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsOnlyEnum": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsOnlyUnion": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsOnlyUnionTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsOrderEnum": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsOrderUnion": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsOrderUnionTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPdf": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPdfEngine": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPdfTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginChainOfThought": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginChainOfThoughtTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginFileParser": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginFileParserTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginModeration": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginModerationTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginUnion": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginUnionTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginWeb": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPluginWebTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPrompt": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsPromptTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsProvider": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsProviderTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsQuantization": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsReasoning": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsReasoningEffort": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsReasoningTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsRequest": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsRequestTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatGrammar": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatGrammarTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatJSONObject": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatJSONSchema": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatPython": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatPythonTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatText": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatTextTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatUnion": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsResponseFormatUnionTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsSort": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsStop": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsStopTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsStreamOptions": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsStreamOptionsTypedDict": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsTypeGrammar": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsTypeJSONObject": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsTypeJSONSchema": ".chatcompletioncreateparams", + "ChatCompletionCreateParamsTypePython": ".chatcompletioncreateparams", "ChatCompletionCreateParamsTypeText": ".chatcompletioncreateparams", "ChatCompletionCreateParamsTypedDict": ".chatcompletioncreateparams", - "Completion": ".chatcompletioncreateparams", - "CompletionTypedDict": ".chatcompletioncreateparams", - "DataCollection": ".chatcompletioncreateparams", - "Effort": ".chatcompletioncreateparams", - "Engine": ".chatcompletioncreateparams", - "IDChainOfThought": ".chatcompletioncreateparams", - "IDFileParser": ".chatcompletioncreateparams", - "IDModeration": ".chatcompletioncreateparams", - "IDWeb": ".chatcompletioncreateparams", - "Ignore": ".chatcompletioncreateparams", - "IgnoreEnum": ".chatcompletioncreateparams", - "IgnoreTypedDict": ".chatcompletioncreateparams", - "Image": ".chatcompletioncreateparams", - "ImageTypedDict": ".chatcompletioncreateparams", - "JSONSchema": ".chatcompletioncreateparams", - "JSONSchemaTypedDict": ".chatcompletioncreateparams", - "MaxPrice": ".chatcompletioncreateparams", - "MaxPriceTypedDict": ".chatcompletioncreateparams", - "Only": ".chatcompletioncreateparams", - "OnlyEnum": ".chatcompletioncreateparams", - "OnlyTypedDict": ".chatcompletioncreateparams", - "Order": ".chatcompletioncreateparams", - "OrderEnum": ".chatcompletioncreateparams", - "OrderTypedDict": ".chatcompletioncreateparams", - "Pdf": ".chatcompletioncreateparams", - "PdfEngine": ".chatcompletioncreateparams", - "PdfTypedDict": ".chatcompletioncreateparams", - "Plugin": ".chatcompletioncreateparams", - "PluginChainOfThought": ".chatcompletioncreateparams", - "PluginChainOfThoughtTypedDict": ".chatcompletioncreateparams", - "PluginFileParser": ".chatcompletioncreateparams", - "PluginFileParserTypedDict": ".chatcompletioncreateparams", - "PluginModeration": ".chatcompletioncreateparams", - "PluginModerationTypedDict": ".chatcompletioncreateparams", - "PluginTypedDict": ".chatcompletioncreateparams", - "PluginWeb": ".chatcompletioncreateparams", - "PluginWebTypedDict": ".chatcompletioncreateparams", - "Prompt": ".chatcompletioncreateparams", - "PromptTypedDict": ".chatcompletioncreateparams", - "Provider": ".chatcompletioncreateparams", - "ProviderTypedDict": ".chatcompletioncreateparams", - "Quantization": ".chatcompletioncreateparams", - "Reasoning": ".chatcompletioncreateparams", - "ReasoningEffort": ".chatcompletioncreateparams", - "ReasoningTypedDict": ".chatcompletioncreateparams", - "Request": ".chatcompletioncreateparams", - "RequestTypedDict": ".chatcompletioncreateparams", - "ResponseFormat": ".chatcompletioncreateparams", - "ResponseFormatGrammar": ".chatcompletioncreateparams", - "ResponseFormatGrammarTypedDict": ".chatcompletioncreateparams", - "ResponseFormatJSONObject": ".chatcompletioncreateparams", - "ResponseFormatJSONObjectTypedDict": ".chatcompletioncreateparams", - "ResponseFormatJSONSchema": ".chatcompletioncreateparams", - "ResponseFormatJSONSchemaTypedDict": ".chatcompletioncreateparams", - "ResponseFormatPython": ".chatcompletioncreateparams", - "ResponseFormatPythonTypedDict": ".chatcompletioncreateparams", - "ResponseFormatText": ".chatcompletioncreateparams", - "ResponseFormatTextTypedDict": ".chatcompletioncreateparams", - "ResponseFormatTypedDict": ".chatcompletioncreateparams", - "Sort": ".chatcompletioncreateparams", - "Stop": ".chatcompletioncreateparams", - "StopTypedDict": ".chatcompletioncreateparams", - "StreamOptions": ".chatcompletioncreateparams", - "StreamOptionsTypedDict": ".chatcompletioncreateparams", - "TypeGrammar": ".chatcompletioncreateparams", - "TypeJSONObject": ".chatcompletioncreateparams", - "TypeJSONSchema": ".chatcompletioncreateparams", - "TypePython": ".chatcompletioncreateparams", "Error": ".chatcompletionerror", "ErrorTypedDict": ".chatcompletionerror", "ChatCompletionMessage": ".chatcompletionmessage", @@ -670,6 +824,79 @@ _dynamic_imports: dict[str, str] = { "ChatCompletionUserMessageParamContentTypedDict": ".chatcompletionusermessageparam", "ChatCompletionUserMessageParamRole": ".chatcompletionusermessageparam", "ChatCompletionUserMessageParamTypedDict": ".chatcompletionusermessageparam", + "ChatStreamCompletionCreateParams": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsAudio": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsAudioTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsCompletion": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsCompletionTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsDataCollection": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsEffort": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsEngine": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsIDChainOfThought": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsIDFileParser": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsIDModeration": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsIDWeb": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsIgnoreEnum": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsIgnoreUnion": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsIgnoreUnionTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsImage": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsImageTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsJSONSchema": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsJSONSchemaTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsMaxPrice": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsMaxPriceTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsOnlyEnum": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsOnlyUnion": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsOnlyUnionTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsOrderEnum": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsOrderUnion": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsOrderUnionTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPdf": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPdfEngine": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPdfTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginChainOfThought": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginFileParser": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginFileParserTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginModeration": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginModerationTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginUnion": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginUnionTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginWeb": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPluginWebTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPrompt": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsPromptTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsProvider": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsProviderTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsQuantization": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsReasoning": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsReasoningEffort": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsReasoningTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsRequest": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsRequestTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatGrammar": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatJSONObject": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatJSONSchema": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatPython": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatText": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatTextTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatUnion": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsSort": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsStop": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsStopTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsStreamOptions": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsStreamOptionsTypedDict": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsTypeGrammar": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsTypeJSONObject": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsTypeJSONSchema": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsTypePython": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsTypeText": ".chatstreamcompletioncreateparams", + "ChatStreamCompletionCreateParamsTypedDict": ".chatstreamcompletioncreateparams", "CompletionTokensDetails": ".completionusage", "CompletionTokensDetailsTypedDict": ".completionusage", "CompletionUsage": ".completionusage", @@ -711,6 +938,8 @@ _dynamic_imports: dict[str, str] = { "ResponseFormatJSONSchemaSchemaTypedDict": ".responseformatjsonschemaschema", "Security": ".security", "SecurityTypedDict": ".security", + "StreamChatCompletionResponseBody": ".streamchatcompletionop", + "StreamChatCompletionResponseBodyTypedDict": ".streamchatcompletionop", "URLCitation": ".urlcitationannotationdetail", "URLCitationAnnotationDetail": ".urlcitationannotationdetail", "URLCitationAnnotationDetailType": ".urlcitationannotationdetail", diff --git a/src/openrouter/models/chatcompletioncreateparams.py b/src/openrouter/models/chatcompletioncreateparams.py index d7ffef8..75d108c 100644 --- a/src/openrouter/models/chatcompletioncreateparams.py +++ b/src/openrouter/models/chatcompletioncreateparams.py @@ -27,29 +27,29 @@ from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -Effort = Literal["high", "medium", "low", "minimal"] +ChatCompletionCreateParamsEffort = Literal["high", "medium", "low", "minimal"] r"""OpenAI-style reasoning effort setting""" -class ReasoningTypedDict(TypedDict): +class ChatCompletionCreateParamsReasoningTypedDict(TypedDict): r"""Reasoning configuration""" enabled: NotRequired[bool] r"""Enables reasoning with default settings. Only work for some models.""" - effort: NotRequired[Nullable[Effort]] + effort: NotRequired[Nullable[ChatCompletionCreateParamsEffort]] r"""OpenAI-style reasoning effort setting""" max_tokens: NotRequired[Nullable[float]] r"""non-OpenAI-style reasoning effort setting""" exclude: NotRequired[bool] -class Reasoning(BaseModel): +class ChatCompletionCreateParamsReasoning(BaseModel): r"""Reasoning configuration""" enabled: Optional[bool] = None r"""Enables reasoning with default settings. Only work for some models.""" - effort: OptionalNullable[Effort] = UNSET + effort: OptionalNullable[ChatCompletionCreateParamsEffort] = UNSET r"""OpenAI-style reasoning effort setting""" max_tokens: OptionalNullable[float] = UNSET @@ -88,45 +88,45 @@ class Reasoning(BaseModel): return m -TypePython = Literal["python"] +ChatCompletionCreateParamsTypePython = Literal["python"] -class ResponseFormatPythonTypedDict(TypedDict): +class ChatCompletionCreateParamsResponseFormatPythonTypedDict(TypedDict): r"""Python code response format""" - type: TypePython + type: ChatCompletionCreateParamsTypePython -class ResponseFormatPython(BaseModel): +class ChatCompletionCreateParamsResponseFormatPython(BaseModel): r"""Python code response format""" - type: TypePython + type: ChatCompletionCreateParamsTypePython -TypeGrammar = Literal["grammar"] +ChatCompletionCreateParamsTypeGrammar = Literal["grammar"] -class ResponseFormatGrammarTypedDict(TypedDict): +class ChatCompletionCreateParamsResponseFormatGrammarTypedDict(TypedDict): r"""Custom grammar response format""" - type: TypeGrammar + type: ChatCompletionCreateParamsTypeGrammar grammar: str r"""Custom grammar for text generation""" -class ResponseFormatGrammar(BaseModel): +class ChatCompletionCreateParamsResponseFormatGrammar(BaseModel): r"""Custom grammar response format""" - type: TypeGrammar + type: ChatCompletionCreateParamsTypeGrammar grammar: str r"""Custom grammar for text generation""" -TypeJSONSchema = Literal["json_schema"] +ChatCompletionCreateParamsTypeJSONSchema = Literal["json_schema"] -class JSONSchemaTypedDict(TypedDict): +class ChatCompletionCreateParamsJSONSchemaTypedDict(TypedDict): name: str r"""Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)""" description: NotRequired[str] @@ -137,7 +137,7 @@ class JSONSchemaTypedDict(TypedDict): r"""Enable strict schema adherence""" -class JSONSchema(BaseModel): +class ChatCompletionCreateParamsJSONSchema(BaseModel): name: str r"""Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)""" @@ -183,110 +183,114 @@ class JSONSchema(BaseModel): return m -class ResponseFormatJSONSchemaTypedDict(TypedDict): +class ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict(TypedDict): r"""JSON Schema response format for structured outputs""" - type: TypeJSONSchema - json_schema: JSONSchemaTypedDict + type: ChatCompletionCreateParamsTypeJSONSchema + json_schema: ChatCompletionCreateParamsJSONSchemaTypedDict -class ResponseFormatJSONSchema(BaseModel): +class ChatCompletionCreateParamsResponseFormatJSONSchema(BaseModel): r"""JSON Schema response format for structured outputs""" - type: TypeJSONSchema + type: ChatCompletionCreateParamsTypeJSONSchema - json_schema: JSONSchema + json_schema: ChatCompletionCreateParamsJSONSchema -TypeJSONObject = Literal["json_object"] +ChatCompletionCreateParamsTypeJSONObject = Literal["json_object"] -class ResponseFormatJSONObjectTypedDict(TypedDict): +class ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict(TypedDict): r"""JSON object response format""" - type: TypeJSONObject + type: ChatCompletionCreateParamsTypeJSONObject -class ResponseFormatJSONObject(BaseModel): +class ChatCompletionCreateParamsResponseFormatJSONObject(BaseModel): r"""JSON object response format""" - type: TypeJSONObject + type: ChatCompletionCreateParamsTypeJSONObject ChatCompletionCreateParamsTypeText = Literal["text"] -class ResponseFormatTextTypedDict(TypedDict): +class ChatCompletionCreateParamsResponseFormatTextTypedDict(TypedDict): r"""Default text response format""" type: ChatCompletionCreateParamsTypeText -class ResponseFormatText(BaseModel): +class ChatCompletionCreateParamsResponseFormatText(BaseModel): r"""Default text response format""" type: ChatCompletionCreateParamsTypeText -ResponseFormatTypedDict = TypeAliasType( - "ResponseFormatTypedDict", +ChatCompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType( + "ChatCompletionCreateParamsResponseFormatUnionTypedDict", Union[ - ResponseFormatTextTypedDict, - ResponseFormatJSONObjectTypedDict, - ResponseFormatPythonTypedDict, - ResponseFormatJSONSchemaTypedDict, - ResponseFormatGrammarTypedDict, + ChatCompletionCreateParamsResponseFormatTextTypedDict, + ChatCompletionCreateParamsResponseFormatJSONObjectTypedDict, + ChatCompletionCreateParamsResponseFormatPythonTypedDict, + ChatCompletionCreateParamsResponseFormatJSONSchemaTypedDict, + ChatCompletionCreateParamsResponseFormatGrammarTypedDict, ], ) r"""Response format configuration""" -ResponseFormat = TypeAliasType( - "ResponseFormat", +ChatCompletionCreateParamsResponseFormatUnion = TypeAliasType( + "ChatCompletionCreateParamsResponseFormatUnion", Union[ - ResponseFormatText, - ResponseFormatJSONObject, - ResponseFormatPython, - ResponseFormatJSONSchema, - ResponseFormatGrammar, + ChatCompletionCreateParamsResponseFormatText, + ChatCompletionCreateParamsResponseFormatJSONObject, + ChatCompletionCreateParamsResponseFormatPython, + ChatCompletionCreateParamsResponseFormatJSONSchema, + ChatCompletionCreateParamsResponseFormatGrammar, ], ) r"""Response format configuration""" -StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str], Any]) +ChatCompletionCreateParamsStopTypedDict = TypeAliasType( + "ChatCompletionCreateParamsStopTypedDict", Union[str, List[str], Any] +) r"""Stop sequences (up to 4)""" -Stop = TypeAliasType("Stop", Union[str, List[str], Any]) +ChatCompletionCreateParamsStop = TypeAliasType( + "ChatCompletionCreateParamsStop", Union[str, List[str], Any] +) r"""Stop sequences (up to 4)""" -class StreamOptionsTypedDict(TypedDict): +class ChatCompletionCreateParamsStreamOptionsTypedDict(TypedDict): r"""Streaming configuration options""" include_usage: NotRequired[bool] r"""Include usage information in streaming response""" -class StreamOptions(BaseModel): +class ChatCompletionCreateParamsStreamOptions(BaseModel): r"""Streaming configuration options""" include_usage: Optional[bool] = None r"""Include usage information in streaming response""" -ReasoningEffort = Literal["high", "medium", "low", "minimal"] +ChatCompletionCreateParamsReasoningEffort = Literal["high", "medium", "low", "minimal"] r"""Reasoning effort""" -DataCollection = Literal["deny", "allow"] +ChatCompletionCreateParamsDataCollection = Literal["deny", "allow"] r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - deny: use only providers which do not collect user data. """ -OrderEnum = Literal[ +ChatCompletionCreateParamsOrderEnum = Literal[ "AnyScale", "Cent-ML", "HuggingFace", @@ -367,13 +371,19 @@ OrderEnum = Literal[ "Z.AI", ] -OrderTypedDict = TypeAliasType("OrderTypedDict", Union[OrderEnum, str]) +ChatCompletionCreateParamsOrderUnionTypedDict = TypeAliasType( + "ChatCompletionCreateParamsOrderUnionTypedDict", + Union[ChatCompletionCreateParamsOrderEnum, str], +) -Order = TypeAliasType("Order", Union[OrderEnum, str]) +ChatCompletionCreateParamsOrderUnion = TypeAliasType( + "ChatCompletionCreateParamsOrderUnion", + Union[ChatCompletionCreateParamsOrderEnum, str], +) -OnlyEnum = Literal[ +ChatCompletionCreateParamsOnlyEnum = Literal[ "AnyScale", "Cent-ML", "HuggingFace", @@ -454,13 +464,19 @@ OnlyEnum = Literal[ "Z.AI", ] -OnlyTypedDict = TypeAliasType("OnlyTypedDict", Union[OnlyEnum, str]) +ChatCompletionCreateParamsOnlyUnionTypedDict = TypeAliasType( + "ChatCompletionCreateParamsOnlyUnionTypedDict", + Union[ChatCompletionCreateParamsOnlyEnum, str], +) -Only = TypeAliasType("Only", Union[OnlyEnum, str]) +ChatCompletionCreateParamsOnlyUnion = TypeAliasType( + "ChatCompletionCreateParamsOnlyUnion", + Union[ChatCompletionCreateParamsOnlyEnum, str], +) -IgnoreEnum = Literal[ +ChatCompletionCreateParamsIgnoreEnum = Literal[ "AnyScale", "Cent-ML", "HuggingFace", @@ -541,74 +557,100 @@ IgnoreEnum = Literal[ "Z.AI", ] -IgnoreTypedDict = TypeAliasType("IgnoreTypedDict", Union[IgnoreEnum, str]) +ChatCompletionCreateParamsIgnoreUnionTypedDict = TypeAliasType( + "ChatCompletionCreateParamsIgnoreUnionTypedDict", + Union[ChatCompletionCreateParamsIgnoreEnum, str], +) -Ignore = TypeAliasType("Ignore", Union[IgnoreEnum, str]) +ChatCompletionCreateParamsIgnoreUnion = TypeAliasType( + "ChatCompletionCreateParamsIgnoreUnion", + Union[ChatCompletionCreateParamsIgnoreEnum, str], +) -Quantization = Literal[ +ChatCompletionCreateParamsQuantization = Literal[ "int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown" ] -Sort = Literal["price", "throughput", "latency"] +ChatCompletionCreateParamsSort = Literal["price", "throughput", "latency"] r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" -PromptTypedDict = TypeAliasType("PromptTypedDict", Union[float, str, Any]) +ChatCompletionCreateParamsPromptTypedDict = TypeAliasType( + "ChatCompletionCreateParamsPromptTypedDict", Union[float, str, Any] +) -Prompt = TypeAliasType("Prompt", Union[float, str, Any]) +ChatCompletionCreateParamsPrompt = TypeAliasType( + "ChatCompletionCreateParamsPrompt", Union[float, str, Any] +) -CompletionTypedDict = TypeAliasType("CompletionTypedDict", Union[float, str, Any]) +ChatCompletionCreateParamsCompletionTypedDict = TypeAliasType( + "ChatCompletionCreateParamsCompletionTypedDict", Union[float, str, Any] +) -Completion = TypeAliasType("Completion", Union[float, str, Any]) +ChatCompletionCreateParamsCompletion = TypeAliasType( + "ChatCompletionCreateParamsCompletion", Union[float, str, Any] +) -ImageTypedDict = TypeAliasType("ImageTypedDict", Union[float, str, Any]) +ChatCompletionCreateParamsImageTypedDict = TypeAliasType( + "ChatCompletionCreateParamsImageTypedDict", Union[float, str, Any] +) -Image = TypeAliasType("Image", Union[float, str, Any]) +ChatCompletionCreateParamsImage = TypeAliasType( + "ChatCompletionCreateParamsImage", Union[float, str, Any] +) -AudioTypedDict = TypeAliasType("AudioTypedDict", Union[float, str, Any]) +ChatCompletionCreateParamsAudioTypedDict = TypeAliasType( + "ChatCompletionCreateParamsAudioTypedDict", Union[float, str, Any] +) -Audio = TypeAliasType("Audio", Union[float, str, Any]) +ChatCompletionCreateParamsAudio = TypeAliasType( + "ChatCompletionCreateParamsAudio", Union[float, str, Any] +) -RequestTypedDict = TypeAliasType("RequestTypedDict", Union[float, str, Any]) +ChatCompletionCreateParamsRequestTypedDict = TypeAliasType( + "ChatCompletionCreateParamsRequestTypedDict", Union[float, str, Any] +) -Request = TypeAliasType("Request", Union[float, str, Any]) +ChatCompletionCreateParamsRequest = TypeAliasType( + "ChatCompletionCreateParamsRequest", Union[float, str, Any] +) -class MaxPriceTypedDict(TypedDict): +class ChatCompletionCreateParamsMaxPriceTypedDict(TypedDict): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - prompt: NotRequired[PromptTypedDict] - completion: NotRequired[CompletionTypedDict] - image: NotRequired[ImageTypedDict] - audio: NotRequired[AudioTypedDict] - request: NotRequired[RequestTypedDict] + prompt: NotRequired[ChatCompletionCreateParamsPromptTypedDict] + completion: NotRequired[ChatCompletionCreateParamsCompletionTypedDict] + image: NotRequired[ChatCompletionCreateParamsImageTypedDict] + audio: NotRequired[ChatCompletionCreateParamsAudioTypedDict] + request: NotRequired[ChatCompletionCreateParamsRequestTypedDict] -class MaxPrice(BaseModel): +class ChatCompletionCreateParamsMaxPrice(BaseModel): r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - prompt: Optional[Prompt] = None + prompt: Optional[ChatCompletionCreateParamsPrompt] = None - completion: Optional[Completion] = None + completion: Optional[ChatCompletionCreateParamsCompletion] = None - image: Optional[Image] = None + image: Optional[ChatCompletionCreateParamsImage] = None - audio: Optional[Audio] = None + audio: Optional[ChatCompletionCreateParamsAudio] = None - request: Optional[Request] = None + request: Optional[ChatCompletionCreateParamsRequest] = None -class ProviderTypedDict(TypedDict): +class ChatCompletionCreateParamsProviderTypedDict(TypedDict): r"""When multiple model providers are available, optionally indicate your routing preference.""" allow_fallbacks: NotRequired[Nullable[bool]] @@ -619,27 +661,27 @@ class ProviderTypedDict(TypedDict): """ require_parameters: NotRequired[Nullable[bool]] r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" - data_collection: NotRequired[Nullable[DataCollection]] + data_collection: NotRequired[Nullable[ChatCompletionCreateParamsDataCollection]] r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - deny: use only providers which do not collect user data. """ - order: NotRequired[Nullable[List[OrderTypedDict]]] + order: NotRequired[Nullable[List[ChatCompletionCreateParamsOrderUnionTypedDict]]] r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" - only: NotRequired[Nullable[List[OnlyTypedDict]]] + only: NotRequired[Nullable[List[ChatCompletionCreateParamsOnlyUnionTypedDict]]] r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" - ignore: NotRequired[Nullable[List[IgnoreTypedDict]]] + ignore: NotRequired[Nullable[List[ChatCompletionCreateParamsIgnoreUnionTypedDict]]] r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" - quantizations: NotRequired[Nullable[List[Quantization]]] + quantizations: NotRequired[Nullable[List[ChatCompletionCreateParamsQuantization]]] r"""A list of quantization levels to filter the provider by.""" - sort: NotRequired[Nullable[Sort]] + sort: NotRequired[Nullable[ChatCompletionCreateParamsSort]] r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - max_price: NotRequired[MaxPriceTypedDict] + max_price: NotRequired[ChatCompletionCreateParamsMaxPriceTypedDict] r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" -class Provider(BaseModel): +class ChatCompletionCreateParamsProvider(BaseModel): r"""When multiple model providers are available, optionally indicate your routing preference.""" allow_fallbacks: OptionalNullable[bool] = UNSET @@ -652,29 +694,31 @@ class Provider(BaseModel): require_parameters: OptionalNullable[bool] = UNSET r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" - data_collection: OptionalNullable[DataCollection] = UNSET + data_collection: OptionalNullable[ChatCompletionCreateParamsDataCollection] = UNSET r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. - allow: (default) allow providers which store user data non-transiently and may train on it - deny: use only providers which do not collect user data. """ - order: OptionalNullable[List[Order]] = UNSET + order: OptionalNullable[List[ChatCompletionCreateParamsOrderUnion]] = UNSET r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" - only: OptionalNullable[List[Only]] = UNSET + only: OptionalNullable[List[ChatCompletionCreateParamsOnlyUnion]] = UNSET r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" - ignore: OptionalNullable[List[Ignore]] = UNSET + ignore: OptionalNullable[List[ChatCompletionCreateParamsIgnoreUnion]] = UNSET r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" - quantizations: OptionalNullable[List[Quantization]] = UNSET + quantizations: OptionalNullable[List[ChatCompletionCreateParamsQuantization]] = ( + UNSET + ) r"""A list of quantization levels to filter the provider by.""" - sort: OptionalNullable[Sort] = UNSET + sort: OptionalNullable[ChatCompletionCreateParamsSort] = UNSET r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" - max_price: Optional[MaxPrice] = None + max_price: Optional[ChatCompletionCreateParamsMaxPrice] = None r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" @model_serializer(mode="wrap") @@ -727,90 +771,96 @@ class Provider(BaseModel): return m -IDFileParser = Literal["file-parser"] +ChatCompletionCreateParamsIDFileParser = Literal["file-parser"] -PdfEngine = Literal["mistral-ocr", "pdf-text", "native"] +ChatCompletionCreateParamsPdfEngine = Literal["mistral-ocr", "pdf-text", "native"] -class PdfTypedDict(TypedDict): - engine: NotRequired[PdfEngine] +class ChatCompletionCreateParamsPdfTypedDict(TypedDict): + engine: NotRequired[ChatCompletionCreateParamsPdfEngine] -class Pdf(BaseModel): - engine: Optional[PdfEngine] = None +class ChatCompletionCreateParamsPdf(BaseModel): + engine: Optional[ChatCompletionCreateParamsPdfEngine] = None -class PluginFileParserTypedDict(TypedDict): - id: IDFileParser +class ChatCompletionCreateParamsPluginFileParserTypedDict(TypedDict): + id: ChatCompletionCreateParamsIDFileParser max_files: NotRequired[float] - pdf: NotRequired[PdfTypedDict] + pdf: NotRequired[ChatCompletionCreateParamsPdfTypedDict] -class PluginFileParser(BaseModel): - id: IDFileParser +class ChatCompletionCreateParamsPluginFileParser(BaseModel): + id: ChatCompletionCreateParamsIDFileParser max_files: Optional[float] = None - pdf: Optional[Pdf] = None + pdf: Optional[ChatCompletionCreateParamsPdf] = None -IDChainOfThought = Literal["chain-of-thought"] +ChatCompletionCreateParamsIDChainOfThought = Literal["chain-of-thought"] -class PluginChainOfThoughtTypedDict(TypedDict): - id: IDChainOfThought +class ChatCompletionCreateParamsPluginChainOfThoughtTypedDict(TypedDict): + id: ChatCompletionCreateParamsIDChainOfThought -class PluginChainOfThought(BaseModel): - id: IDChainOfThought +class ChatCompletionCreateParamsPluginChainOfThought(BaseModel): + id: ChatCompletionCreateParamsIDChainOfThought -IDWeb = Literal["web"] +ChatCompletionCreateParamsIDWeb = Literal["web"] -Engine = Literal["native", "exa"] +ChatCompletionCreateParamsEngine = Literal["native", "exa"] -class PluginWebTypedDict(TypedDict): - id: IDWeb +class ChatCompletionCreateParamsPluginWebTypedDict(TypedDict): + id: ChatCompletionCreateParamsIDWeb max_results: NotRequired[float] search_prompt: NotRequired[str] - engine: NotRequired[Engine] + engine: NotRequired[ChatCompletionCreateParamsEngine] -class PluginWeb(BaseModel): - id: IDWeb +class ChatCompletionCreateParamsPluginWeb(BaseModel): + id: ChatCompletionCreateParamsIDWeb max_results: Optional[float] = None search_prompt: Optional[str] = None - engine: Optional[Engine] = None + engine: Optional[ChatCompletionCreateParamsEngine] = None -IDModeration = Literal["moderation"] +ChatCompletionCreateParamsIDModeration = Literal["moderation"] -class PluginModerationTypedDict(TypedDict): - id: IDModeration +class ChatCompletionCreateParamsPluginModerationTypedDict(TypedDict): + id: ChatCompletionCreateParamsIDModeration -class PluginModeration(BaseModel): - id: IDModeration +class ChatCompletionCreateParamsPluginModeration(BaseModel): + id: ChatCompletionCreateParamsIDModeration -PluginTypedDict = TypeAliasType( - "PluginTypedDict", +ChatCompletionCreateParamsPluginUnionTypedDict = TypeAliasType( + "ChatCompletionCreateParamsPluginUnionTypedDict", Union[ - PluginModerationTypedDict, - PluginChainOfThoughtTypedDict, - PluginFileParserTypedDict, - PluginWebTypedDict, + ChatCompletionCreateParamsPluginModerationTypedDict, + ChatCompletionCreateParamsPluginChainOfThoughtTypedDict, + ChatCompletionCreateParamsPluginFileParserTypedDict, + ChatCompletionCreateParamsPluginWebTypedDict, ], ) -Plugin = TypeAliasType( - "Plugin", Union[PluginModeration, PluginChainOfThought, PluginFileParser, PluginWeb] +ChatCompletionCreateParamsPluginUnion = TypeAliasType( + "ChatCompletionCreateParamsPluginUnion", + Union[ + ChatCompletionCreateParamsPluginModeration, + ChatCompletionCreateParamsPluginChainOfThought, + ChatCompletionCreateParamsPluginFileParser, + ChatCompletionCreateParamsPluginWeb, + ], ) @@ -837,17 +887,19 @@ class ChatCompletionCreateParamsTypedDict(TypedDict): r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)""" presence_penalty: NotRequired[Nullable[float]] r"""Presence penalty (-2.0 to 2.0)""" - reasoning: NotRequired[Nullable[ReasoningTypedDict]] + reasoning: NotRequired[Nullable[ChatCompletionCreateParamsReasoningTypedDict]] r"""Reasoning configuration""" - response_format: NotRequired[ResponseFormatTypedDict] + response_format: NotRequired[ChatCompletionCreateParamsResponseFormatUnionTypedDict] r"""Response format configuration""" seed: NotRequired[Nullable[int]] r"""Random seed for deterministic outputs""" - stop: NotRequired[Nullable[StopTypedDict]] + stop: NotRequired[Nullable[ChatCompletionCreateParamsStopTypedDict]] r"""Stop sequences (up to 4)""" stream: NotRequired[Nullable[bool]] r"""Enable streaming response""" - stream_options: NotRequired[Nullable[StreamOptionsTypedDict]] + stream_options: NotRequired[ + Nullable[ChatCompletionCreateParamsStreamOptionsTypedDict] + ] temperature: NotRequired[Nullable[float]] r"""Sampling temperature (0-2)""" tool_choice: NotRequired[ChatCompletionToolChoiceOptionTypedDict] @@ -858,13 +910,13 @@ class ChatCompletionCreateParamsTypedDict(TypedDict): r"""Nucleus sampling parameter (0-1)""" user: NotRequired[str] r"""Unique user identifier""" - model_list: NotRequired[Nullable[List[str]]] + fallback_models: NotRequired[Nullable[List[str]]] r"""Order of models to fallback to for this request""" - reasoning_effort: NotRequired[Nullable[ReasoningEffort]] + reasoning_effort: NotRequired[Nullable[ChatCompletionCreateParamsReasoningEffort]] r"""Reasoning effort""" - provider: NotRequired[Nullable[ProviderTypedDict]] + provider: NotRequired[Nullable[ChatCompletionCreateParamsProviderTypedDict]] r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: NotRequired[List[PluginTypedDict]] + plugins: NotRequired[List[ChatCompletionCreateParamsPluginUnionTypedDict]] r"""Plugins you want to enable for this request, including their settings.""" @@ -901,22 +953,22 @@ class ChatCompletionCreateParams(BaseModel): presence_penalty: OptionalNullable[float] = UNSET r"""Presence penalty (-2.0 to 2.0)""" - reasoning: OptionalNullable[Reasoning] = UNSET + reasoning: OptionalNullable[ChatCompletionCreateParamsReasoning] = UNSET r"""Reasoning configuration""" - response_format: Optional[ResponseFormat] = None + response_format: Optional[ChatCompletionCreateParamsResponseFormatUnion] = None r"""Response format configuration""" seed: OptionalNullable[int] = UNSET r"""Random seed for deterministic outputs""" - stop: OptionalNullable[Stop] = UNSET + stop: OptionalNullable[ChatCompletionCreateParamsStop] = UNSET r"""Stop sequences (up to 4)""" stream: OptionalNullable[bool] = False r"""Enable streaming response""" - stream_options: OptionalNullable[StreamOptions] = UNSET + stream_options: OptionalNullable[ChatCompletionCreateParamsStreamOptions] = UNSET temperature: OptionalNullable[float] = 1 r"""Sampling temperature (0-2)""" @@ -933,18 +985,20 @@ class ChatCompletionCreateParams(BaseModel): user: Optional[str] = None r"""Unique user identifier""" - model_list: Annotated[ + fallback_models: Annotated[ OptionalNullable[List[str]], pydantic.Field(alias="models") ] = UNSET r"""Order of models to fallback to for this request""" - reasoning_effort: OptionalNullable[ReasoningEffort] = UNSET + reasoning_effort: OptionalNullable[ChatCompletionCreateParamsReasoningEffort] = ( + UNSET + ) r"""Reasoning effort""" - provider: OptionalNullable[Provider] = UNSET + provider: OptionalNullable[ChatCompletionCreateParamsProvider] = UNSET r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: Optional[List[Plugin]] = None + plugins: Optional[List[ChatCompletionCreateParamsPluginUnion]] = None r"""Plugins you want to enable for this request, including their settings.""" @model_serializer(mode="wrap") @@ -970,7 +1024,7 @@ class ChatCompletionCreateParams(BaseModel): "tools", "top_p", "user", - "model_list", + "fallback_models", "reasoning_effort", "provider", "plugins", @@ -990,7 +1044,7 @@ class ChatCompletionCreateParams(BaseModel): "stream_options", "temperature", "top_p", - "model_list", + "fallback_models", "reasoning_effort", "provider", ] diff --git a/src/openrouter/models/chatstreamcompletioncreateparams.py b/src/openrouter/models/chatstreamcompletioncreateparams.py new file mode 100644 index 0000000..584abc5 --- /dev/null +++ b/src/openrouter/models/chatstreamcompletioncreateparams.py @@ -0,0 +1,1097 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .chatcompletionmessageparam import ( + ChatCompletionMessageParam, + ChatCompletionMessageParamTypedDict, +) +from .chatcompletiontool import ChatCompletionTool, ChatCompletionToolTypedDict +from .chatcompletiontoolchoiceoption import ( + ChatCompletionToolChoiceOption, + ChatCompletionToolChoiceOptionTypedDict, +) +from .responseformatjsonschemaschema import ( + ResponseFormatJSONSchemaSchema, + ResponseFormatJSONSchemaSchemaTypedDict, +) +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) +import pydantic +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +ChatStreamCompletionCreateParamsEffort = Literal["high", "medium", "low", "minimal"] +r"""OpenAI-style reasoning effort setting""" + + +class ChatStreamCompletionCreateParamsReasoningTypedDict(TypedDict): + r"""Reasoning configuration""" + + enabled: NotRequired[bool] + r"""Enables reasoning with default settings. Only work for some models.""" + effort: NotRequired[Nullable[ChatStreamCompletionCreateParamsEffort]] + r"""OpenAI-style reasoning effort setting""" + max_tokens: NotRequired[Nullable[float]] + r"""non-OpenAI-style reasoning effort setting""" + exclude: NotRequired[bool] + + +class ChatStreamCompletionCreateParamsReasoning(BaseModel): + r"""Reasoning configuration""" + + enabled: Optional[bool] = None + r"""Enables reasoning with default settings. Only work for some models.""" + + effort: OptionalNullable[ChatStreamCompletionCreateParamsEffort] = UNSET + r"""OpenAI-style reasoning effort setting""" + + max_tokens: OptionalNullable[float] = UNSET + r"""non-OpenAI-style reasoning effort setting""" + + exclude: Optional[bool] = False + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["enabled", "effort", "max_tokens", "exclude"] + nullable_fields = ["effort", "max_tokens"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + +ChatStreamCompletionCreateParamsTypePython = Literal["python"] + + +class ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict(TypedDict): + r"""Python code response format""" + + type: ChatStreamCompletionCreateParamsTypePython + + +class ChatStreamCompletionCreateParamsResponseFormatPython(BaseModel): + r"""Python code response format""" + + type: ChatStreamCompletionCreateParamsTypePython + + +ChatStreamCompletionCreateParamsTypeGrammar = Literal["grammar"] + + +class ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict(TypedDict): + r"""Custom grammar response format""" + + type: ChatStreamCompletionCreateParamsTypeGrammar + grammar: str + r"""Custom grammar for text generation""" + + +class ChatStreamCompletionCreateParamsResponseFormatGrammar(BaseModel): + r"""Custom grammar response format""" + + type: ChatStreamCompletionCreateParamsTypeGrammar + + grammar: str + r"""Custom grammar for text generation""" + + +ChatStreamCompletionCreateParamsTypeJSONSchema = Literal["json_schema"] + + +class ChatStreamCompletionCreateParamsJSONSchemaTypedDict(TypedDict): + name: str + r"""Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)""" + description: NotRequired[str] + r"""Schema description for the model""" + schema_: NotRequired[ResponseFormatJSONSchemaSchemaTypedDict] + r"""The schema for the response format, described as a JSON Schema object""" + strict: NotRequired[Nullable[bool]] + r"""Enable strict schema adherence""" + + +class ChatStreamCompletionCreateParamsJSONSchema(BaseModel): + name: str + r"""Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)""" + + description: Optional[str] = None + r"""Schema description for the model""" + + schema_: Annotated[ + Optional[ResponseFormatJSONSchemaSchema], pydantic.Field(alias="schema") + ] = None + r"""The schema for the response format, described as a JSON Schema object""" + + strict: OptionalNullable[bool] = UNSET + r"""Enable strict schema adherence""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["description", "schema", "strict"] + nullable_fields = ["strict"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + +class ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict(TypedDict): + r"""JSON Schema response format for structured outputs""" + + type: ChatStreamCompletionCreateParamsTypeJSONSchema + json_schema: ChatStreamCompletionCreateParamsJSONSchemaTypedDict + + +class ChatStreamCompletionCreateParamsResponseFormatJSONSchema(BaseModel): + r"""JSON Schema response format for structured outputs""" + + type: ChatStreamCompletionCreateParamsTypeJSONSchema + + json_schema: ChatStreamCompletionCreateParamsJSONSchema + + +ChatStreamCompletionCreateParamsTypeJSONObject = Literal["json_object"] + + +class ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict(TypedDict): + r"""JSON object response format""" + + type: ChatStreamCompletionCreateParamsTypeJSONObject + + +class ChatStreamCompletionCreateParamsResponseFormatJSONObject(BaseModel): + r"""JSON object response format""" + + type: ChatStreamCompletionCreateParamsTypeJSONObject + + +ChatStreamCompletionCreateParamsTypeText = Literal["text"] + + +class ChatStreamCompletionCreateParamsResponseFormatTextTypedDict(TypedDict): + r"""Default text response format""" + + type: ChatStreamCompletionCreateParamsTypeText + + +class ChatStreamCompletionCreateParamsResponseFormatText(BaseModel): + r"""Default text response format""" + + type: ChatStreamCompletionCreateParamsTypeText + + +ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict", + Union[ + ChatStreamCompletionCreateParamsResponseFormatTextTypedDict, + ChatStreamCompletionCreateParamsResponseFormatJSONObjectTypedDict, + ChatStreamCompletionCreateParamsResponseFormatPythonTypedDict, + ChatStreamCompletionCreateParamsResponseFormatJSONSchemaTypedDict, + ChatStreamCompletionCreateParamsResponseFormatGrammarTypedDict, + ], +) +r"""Response format configuration""" + + +ChatStreamCompletionCreateParamsResponseFormatUnion = TypeAliasType( + "ChatStreamCompletionCreateParamsResponseFormatUnion", + Union[ + ChatStreamCompletionCreateParamsResponseFormatText, + ChatStreamCompletionCreateParamsResponseFormatJSONObject, + ChatStreamCompletionCreateParamsResponseFormatPython, + ChatStreamCompletionCreateParamsResponseFormatJSONSchema, + ChatStreamCompletionCreateParamsResponseFormatGrammar, + ], +) +r"""Response format configuration""" + + +ChatStreamCompletionCreateParamsStopTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsStopTypedDict", Union[str, List[str], Any] +) +r"""Stop sequences (up to 4)""" + + +ChatStreamCompletionCreateParamsStop = TypeAliasType( + "ChatStreamCompletionCreateParamsStop", Union[str, List[str], Any] +) +r"""Stop sequences (up to 4)""" + + +class ChatStreamCompletionCreateParamsStreamOptionsTypedDict(TypedDict): + r"""Streaming configuration options""" + + include_usage: NotRequired[bool] + r"""Include usage information in streaming response""" + + +class ChatStreamCompletionCreateParamsStreamOptions(BaseModel): + r"""Streaming configuration options""" + + include_usage: Optional[bool] = None + r"""Include usage information in streaming response""" + + +ChatStreamCompletionCreateParamsReasoningEffort = Literal[ + "high", "medium", "low", "minimal" +] +r"""Reasoning effort""" + +ChatStreamCompletionCreateParamsDataCollection = Literal["deny", "allow"] +r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. +- allow: (default) allow providers which store user data non-transiently and may train on it +- deny: use only providers which do not collect user data. + +""" + +ChatStreamCompletionCreateParamsOrderEnum = Literal[ + "AnyScale", + "Cent-ML", + "HuggingFace", + "Hyperbolic 2", + "Lepton", + "Lynn 2", + "Lynn", + "Mancer", + "Modal", + "OctoAI", + "Recursal", + "Reflection", + "Replicate", + "SambaNova 2", + "SF Compute", + "Together 2", + "01.AI", + "AI21", + "AionLabs", + "Alibaba", + "Amazon Bedrock", + "Anthropic", + "AtlasCloud", + "Atoma", + "Avian", + "Azure", + "BaseTen", + "Cerebras", + "Chutes", + "Cloudflare", + "Cohere", + "CrofAI", + "Crusoe", + "DeepInfra", + "DeepSeek", + "Enfer", + "Featherless", + "Fireworks", + "Friendli", + "GMICloud", + "Google", + "Google AI Studio", + "Groq", + "Hyperbolic", + "Inception", + "InferenceNet", + "Infermatic", + "Inflection", + "InoCloud", + "Kluster", + "Lambda", + "Liquid", + "Mancer 2", + "Meta", + "Minimax", + "Mistral", + "Moonshot AI", + "Morph", + "NCompass", + "Nebius", + "NextBit", + "Nineteen", + "Novita", + "OpenAI", + "OpenInference", + "Parasail", + "Perplexity", + "Phala", + "SambaNova", + "Stealth", + "Switchpoint", + "Targon", + "Together", + "Ubicloud", + "Venice", + "WandB", + "xAI", + "Z.AI", +] + +ChatStreamCompletionCreateParamsOrderUnionTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsOrderUnionTypedDict", + Union[ChatStreamCompletionCreateParamsOrderEnum, str], +) + + +ChatStreamCompletionCreateParamsOrderUnion = TypeAliasType( + "ChatStreamCompletionCreateParamsOrderUnion", + Union[ChatStreamCompletionCreateParamsOrderEnum, str], +) + + +ChatStreamCompletionCreateParamsOnlyEnum = Literal[ + "AnyScale", + "Cent-ML", + "HuggingFace", + "Hyperbolic 2", + "Lepton", + "Lynn 2", + "Lynn", + "Mancer", + "Modal", + "OctoAI", + "Recursal", + "Reflection", + "Replicate", + "SambaNova 2", + "SF Compute", + "Together 2", + "01.AI", + "AI21", + "AionLabs", + "Alibaba", + "Amazon Bedrock", + "Anthropic", + "AtlasCloud", + "Atoma", + "Avian", + "Azure", + "BaseTen", + "Cerebras", + "Chutes", + "Cloudflare", + "Cohere", + "CrofAI", + "Crusoe", + "DeepInfra", + "DeepSeek", + "Enfer", + "Featherless", + "Fireworks", + "Friendli", + "GMICloud", + "Google", + "Google AI Studio", + "Groq", + "Hyperbolic", + "Inception", + "InferenceNet", + "Infermatic", + "Inflection", + "InoCloud", + "Kluster", + "Lambda", + "Liquid", + "Mancer 2", + "Meta", + "Minimax", + "Mistral", + "Moonshot AI", + "Morph", + "NCompass", + "Nebius", + "NextBit", + "Nineteen", + "Novita", + "OpenAI", + "OpenInference", + "Parasail", + "Perplexity", + "Phala", + "SambaNova", + "Stealth", + "Switchpoint", + "Targon", + "Together", + "Ubicloud", + "Venice", + "WandB", + "xAI", + "Z.AI", +] + +ChatStreamCompletionCreateParamsOnlyUnionTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsOnlyUnionTypedDict", + Union[ChatStreamCompletionCreateParamsOnlyEnum, str], +) + + +ChatStreamCompletionCreateParamsOnlyUnion = TypeAliasType( + "ChatStreamCompletionCreateParamsOnlyUnion", + Union[ChatStreamCompletionCreateParamsOnlyEnum, str], +) + + +ChatStreamCompletionCreateParamsIgnoreEnum = Literal[ + "AnyScale", + "Cent-ML", + "HuggingFace", + "Hyperbolic 2", + "Lepton", + "Lynn 2", + "Lynn", + "Mancer", + "Modal", + "OctoAI", + "Recursal", + "Reflection", + "Replicate", + "SambaNova 2", + "SF Compute", + "Together 2", + "01.AI", + "AI21", + "AionLabs", + "Alibaba", + "Amazon Bedrock", + "Anthropic", + "AtlasCloud", + "Atoma", + "Avian", + "Azure", + "BaseTen", + "Cerebras", + "Chutes", + "Cloudflare", + "Cohere", + "CrofAI", + "Crusoe", + "DeepInfra", + "DeepSeek", + "Enfer", + "Featherless", + "Fireworks", + "Friendli", + "GMICloud", + "Google", + "Google AI Studio", + "Groq", + "Hyperbolic", + "Inception", + "InferenceNet", + "Infermatic", + "Inflection", + "InoCloud", + "Kluster", + "Lambda", + "Liquid", + "Mancer 2", + "Meta", + "Minimax", + "Mistral", + "Moonshot AI", + "Morph", + "NCompass", + "Nebius", + "NextBit", + "Nineteen", + "Novita", + "OpenAI", + "OpenInference", + "Parasail", + "Perplexity", + "Phala", + "SambaNova", + "Stealth", + "Switchpoint", + "Targon", + "Together", + "Ubicloud", + "Venice", + "WandB", + "xAI", + "Z.AI", +] + +ChatStreamCompletionCreateParamsIgnoreUnionTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsIgnoreUnionTypedDict", + Union[ChatStreamCompletionCreateParamsIgnoreEnum, str], +) + + +ChatStreamCompletionCreateParamsIgnoreUnion = TypeAliasType( + "ChatStreamCompletionCreateParamsIgnoreUnion", + Union[ChatStreamCompletionCreateParamsIgnoreEnum, str], +) + + +ChatStreamCompletionCreateParamsQuantization = Literal[ + "int4", "int8", "fp4", "fp6", "fp8", "fp16", "bf16", "fp32", "unknown" +] + +ChatStreamCompletionCreateParamsSort = Literal["price", "throughput", "latency"] +r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + +ChatStreamCompletionCreateParamsPromptTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsPromptTypedDict", Union[float, str, Any] +) + + +ChatStreamCompletionCreateParamsPrompt = TypeAliasType( + "ChatStreamCompletionCreateParamsPrompt", Union[float, str, Any] +) + + +ChatStreamCompletionCreateParamsCompletionTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsCompletionTypedDict", Union[float, str, Any] +) + + +ChatStreamCompletionCreateParamsCompletion = TypeAliasType( + "ChatStreamCompletionCreateParamsCompletion", Union[float, str, Any] +) + + +ChatStreamCompletionCreateParamsImageTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsImageTypedDict", Union[float, str, Any] +) + + +ChatStreamCompletionCreateParamsImage = TypeAliasType( + "ChatStreamCompletionCreateParamsImage", Union[float, str, Any] +) + + +ChatStreamCompletionCreateParamsAudioTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsAudioTypedDict", Union[float, str, Any] +) + + +ChatStreamCompletionCreateParamsAudio = TypeAliasType( + "ChatStreamCompletionCreateParamsAudio", Union[float, str, Any] +) + + +ChatStreamCompletionCreateParamsRequestTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsRequestTypedDict", Union[float, str, Any] +) + + +ChatStreamCompletionCreateParamsRequest = TypeAliasType( + "ChatStreamCompletionCreateParamsRequest", Union[float, str, Any] +) + + +class ChatStreamCompletionCreateParamsMaxPriceTypedDict(TypedDict): + r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" + + prompt: NotRequired[ChatStreamCompletionCreateParamsPromptTypedDict] + completion: NotRequired[ChatStreamCompletionCreateParamsCompletionTypedDict] + image: NotRequired[ChatStreamCompletionCreateParamsImageTypedDict] + audio: NotRequired[ChatStreamCompletionCreateParamsAudioTypedDict] + request: NotRequired[ChatStreamCompletionCreateParamsRequestTypedDict] + + +class ChatStreamCompletionCreateParamsMaxPrice(BaseModel): + r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" + + prompt: Optional[ChatStreamCompletionCreateParamsPrompt] = None + + completion: Optional[ChatStreamCompletionCreateParamsCompletion] = None + + image: Optional[ChatStreamCompletionCreateParamsImage] = None + + audio: Optional[ChatStreamCompletionCreateParamsAudio] = None + + request: Optional[ChatStreamCompletionCreateParamsRequest] = None + + +class ChatStreamCompletionCreateParamsProviderTypedDict(TypedDict): + r"""When multiple model providers are available, optionally indicate your routing preference.""" + + allow_fallbacks: NotRequired[Nullable[bool]] + r"""Whether to allow backup providers to serve requests + - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + + """ + require_parameters: NotRequired[Nullable[bool]] + r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" + data_collection: NotRequired[ + Nullable[ChatStreamCompletionCreateParamsDataCollection] + ] + r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. + - allow: (default) allow providers which store user data non-transiently and may train on it + - deny: use only providers which do not collect user data. + + """ + order: NotRequired[ + Nullable[List[ChatStreamCompletionCreateParamsOrderUnionTypedDict]] + ] + r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" + only: NotRequired[ + Nullable[List[ChatStreamCompletionCreateParamsOnlyUnionTypedDict]] + ] + r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" + ignore: NotRequired[ + Nullable[List[ChatStreamCompletionCreateParamsIgnoreUnionTypedDict]] + ] + r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" + quantizations: NotRequired[ + Nullable[List[ChatStreamCompletionCreateParamsQuantization]] + ] + r"""A list of quantization levels to filter the provider by.""" + sort: NotRequired[Nullable[ChatStreamCompletionCreateParamsSort]] + r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + max_price: NotRequired[ChatStreamCompletionCreateParamsMaxPriceTypedDict] + r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" + + +class ChatStreamCompletionCreateParamsProvider(BaseModel): + r"""When multiple model providers are available, optionally indicate your routing preference.""" + + allow_fallbacks: OptionalNullable[bool] = UNSET + r"""Whether to allow backup providers to serve requests + - true: (default) when the primary provider (or your custom providers in \"order\") is unavailable, use the next best provider. + - false: use only the primary/custom provider, and return the upstream error if it's unavailable. + + """ + + require_parameters: OptionalNullable[bool] = UNSET + r"""Whether to filter providers to only those that support the parameters you've provided. If this setting is omitted or set to false, then providers will receive only the parameters they support, and ignore the rest.""" + + data_collection: OptionalNullable[ + ChatStreamCompletionCreateParamsDataCollection + ] = UNSET + r"""Data collection setting. If no available model provider meets the requirement, your request will return an error. + - allow: (default) allow providers which store user data non-transiently and may train on it + - deny: use only providers which do not collect user data. + + """ + + order: OptionalNullable[List[ChatStreamCompletionCreateParamsOrderUnion]] = UNSET + r"""An ordered list of provider slugs. The router will attempt to use the first provider in the subset of this list that supports your requested model, and fall back to the next if it is unavailable. If no providers are available, the request will fail with an error message.""" + + only: OptionalNullable[List[ChatStreamCompletionCreateParamsOnlyUnion]] = UNSET + r"""List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request.""" + + ignore: OptionalNullable[List[ChatStreamCompletionCreateParamsIgnoreUnion]] = UNSET + r"""List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request.""" + + quantizations: OptionalNullable[ + List[ChatStreamCompletionCreateParamsQuantization] + ] = UNSET + r"""A list of quantization levels to filter the provider by.""" + + sort: OptionalNullable[ChatStreamCompletionCreateParamsSort] = UNSET + r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + + max_price: Optional[ChatStreamCompletionCreateParamsMaxPrice] = None + r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "allow_fallbacks", + "require_parameters", + "data_collection", + "order", + "only", + "ignore", + "quantizations", + "sort", + "max_price", + ] + nullable_fields = [ + "allow_fallbacks", + "require_parameters", + "data_collection", + "order", + "only", + "ignore", + "quantizations", + "sort", + ] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m + + +ChatStreamCompletionCreateParamsIDFileParser = Literal["file-parser"] + +ChatStreamCompletionCreateParamsPdfEngine = Literal["mistral-ocr", "pdf-text", "native"] + + +class ChatStreamCompletionCreateParamsPdfTypedDict(TypedDict): + engine: NotRequired[ChatStreamCompletionCreateParamsPdfEngine] + + +class ChatStreamCompletionCreateParamsPdf(BaseModel): + engine: Optional[ChatStreamCompletionCreateParamsPdfEngine] = None + + +class ChatStreamCompletionCreateParamsPluginFileParserTypedDict(TypedDict): + id: ChatStreamCompletionCreateParamsIDFileParser + max_files: NotRequired[float] + pdf: NotRequired[ChatStreamCompletionCreateParamsPdfTypedDict] + + +class ChatStreamCompletionCreateParamsPluginFileParser(BaseModel): + id: ChatStreamCompletionCreateParamsIDFileParser + + max_files: Optional[float] = None + + pdf: Optional[ChatStreamCompletionCreateParamsPdf] = None + + +ChatStreamCompletionCreateParamsIDChainOfThought = Literal["chain-of-thought"] + + +class ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict(TypedDict): + id: ChatStreamCompletionCreateParamsIDChainOfThought + + +class ChatStreamCompletionCreateParamsPluginChainOfThought(BaseModel): + id: ChatStreamCompletionCreateParamsIDChainOfThought + + +ChatStreamCompletionCreateParamsIDWeb = Literal["web"] + +ChatStreamCompletionCreateParamsEngine = Literal["native", "exa"] + + +class ChatStreamCompletionCreateParamsPluginWebTypedDict(TypedDict): + id: ChatStreamCompletionCreateParamsIDWeb + max_results: NotRequired[float] + search_prompt: NotRequired[str] + engine: NotRequired[ChatStreamCompletionCreateParamsEngine] + + +class ChatStreamCompletionCreateParamsPluginWeb(BaseModel): + id: ChatStreamCompletionCreateParamsIDWeb + + max_results: Optional[float] = None + + search_prompt: Optional[str] = None + + engine: Optional[ChatStreamCompletionCreateParamsEngine] = None + + +ChatStreamCompletionCreateParamsIDModeration = Literal["moderation"] + + +class ChatStreamCompletionCreateParamsPluginModerationTypedDict(TypedDict): + id: ChatStreamCompletionCreateParamsIDModeration + + +class ChatStreamCompletionCreateParamsPluginModeration(BaseModel): + id: ChatStreamCompletionCreateParamsIDModeration + + +ChatStreamCompletionCreateParamsPluginUnionTypedDict = TypeAliasType( + "ChatStreamCompletionCreateParamsPluginUnionTypedDict", + Union[ + ChatStreamCompletionCreateParamsPluginModerationTypedDict, + ChatStreamCompletionCreateParamsPluginChainOfThoughtTypedDict, + ChatStreamCompletionCreateParamsPluginFileParserTypedDict, + ChatStreamCompletionCreateParamsPluginWebTypedDict, + ], +) + + +ChatStreamCompletionCreateParamsPluginUnion = TypeAliasType( + "ChatStreamCompletionCreateParamsPluginUnion", + Union[ + ChatStreamCompletionCreateParamsPluginModeration, + ChatStreamCompletionCreateParamsPluginChainOfThought, + ChatStreamCompletionCreateParamsPluginFileParser, + ChatStreamCompletionCreateParamsPluginWeb, + ], +) + + +class ChatStreamCompletionCreateParamsTypedDict(TypedDict): + r"""Chat completion request parameters""" + + messages: List[ChatCompletionMessageParamTypedDict] + r"""List of messages for the conversation""" + stream: NotRequired[Nullable[bool]] + r"""Enable streaming response""" + model: NotRequired[str] + r"""Model to use for completion""" + frequency_penalty: NotRequired[Nullable[float]] + r"""Frequency penalty (-2.0 to 2.0)""" + logit_bias: NotRequired[Nullable[Dict[str, float]]] + r"""Token logit bias adjustments""" + logprobs: NotRequired[Nullable[bool]] + r"""Return log probabilities""" + top_logprobs: NotRequired[Nullable[float]] + r"""Number of top log probabilities to return (0-20)""" + max_completion_tokens: NotRequired[Nullable[float]] + r"""Maximum tokens in completion""" + max_tokens: NotRequired[Nullable[float]] + r"""Maximum tokens (deprecated, use max_completion_tokens)""" + metadata: NotRequired[Dict[str, str]] + r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)""" + presence_penalty: NotRequired[Nullable[float]] + r"""Presence penalty (-2.0 to 2.0)""" + reasoning: NotRequired[Nullable[ChatStreamCompletionCreateParamsReasoningTypedDict]] + r"""Reasoning configuration""" + response_format: NotRequired[ + ChatStreamCompletionCreateParamsResponseFormatUnionTypedDict + ] + r"""Response format configuration""" + seed: NotRequired[Nullable[int]] + r"""Random seed for deterministic outputs""" + stop: NotRequired[Nullable[ChatStreamCompletionCreateParamsStopTypedDict]] + r"""Stop sequences (up to 4)""" + stream_options: NotRequired[ + Nullable[ChatStreamCompletionCreateParamsStreamOptionsTypedDict] + ] + temperature: NotRequired[Nullable[float]] + r"""Sampling temperature (0-2)""" + tool_choice: NotRequired[ChatCompletionToolChoiceOptionTypedDict] + r"""Tool choice configuration""" + tools: NotRequired[List[ChatCompletionToolTypedDict]] + r"""Available tools for function calling""" + top_p: NotRequired[Nullable[float]] + r"""Nucleus sampling parameter (0-1)""" + user: NotRequired[str] + r"""Unique user identifier""" + fallback_models: NotRequired[Nullable[List[str]]] + r"""Order of models to fallback to for this request""" + reasoning_effort: NotRequired[ + Nullable[ChatStreamCompletionCreateParamsReasoningEffort] + ] + r"""Reasoning effort""" + provider: NotRequired[Nullable[ChatStreamCompletionCreateParamsProviderTypedDict]] + r"""When multiple model providers are available, optionally indicate your routing preference.""" + plugins: NotRequired[List[ChatStreamCompletionCreateParamsPluginUnionTypedDict]] + r"""Plugins you want to enable for this request, including their settings.""" + + +class ChatStreamCompletionCreateParams(BaseModel): + r"""Chat completion request parameters""" + + messages: List[ChatCompletionMessageParam] + r"""List of messages for the conversation""" + + stream: OptionalNullable[bool] = False + r"""Enable streaming response""" + + model: Optional[str] = None + r"""Model to use for completion""" + + frequency_penalty: OptionalNullable[float] = UNSET + r"""Frequency penalty (-2.0 to 2.0)""" + + logit_bias: OptionalNullable[Dict[str, float]] = UNSET + r"""Token logit bias adjustments""" + + logprobs: OptionalNullable[bool] = UNSET + r"""Return log probabilities""" + + top_logprobs: OptionalNullable[float] = UNSET + r"""Number of top log probabilities to return (0-20)""" + + max_completion_tokens: OptionalNullable[float] = UNSET + r"""Maximum tokens in completion""" + + max_tokens: OptionalNullable[float] = UNSET + r"""Maximum tokens (deprecated, use max_completion_tokens)""" + + metadata: Optional[Dict[str, str]] = None + r"""Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)""" + + presence_penalty: OptionalNullable[float] = UNSET + r"""Presence penalty (-2.0 to 2.0)""" + + reasoning: OptionalNullable[ChatStreamCompletionCreateParamsReasoning] = UNSET + r"""Reasoning configuration""" + + response_format: Optional[ChatStreamCompletionCreateParamsResponseFormatUnion] = ( + None + ) + r"""Response format configuration""" + + seed: OptionalNullable[int] = UNSET + r"""Random seed for deterministic outputs""" + + stop: OptionalNullable[ChatStreamCompletionCreateParamsStop] = UNSET + r"""Stop sequences (up to 4)""" + + stream_options: OptionalNullable[ChatStreamCompletionCreateParamsStreamOptions] = ( + UNSET + ) + + temperature: OptionalNullable[float] = 1 + r"""Sampling temperature (0-2)""" + + tool_choice: Optional[ChatCompletionToolChoiceOption] = None + r"""Tool choice configuration""" + + tools: Optional[List[ChatCompletionTool]] = None + r"""Available tools for function calling""" + + top_p: OptionalNullable[float] = 1 + r"""Nucleus sampling parameter (0-1)""" + + user: Optional[str] = None + r"""Unique user identifier""" + + fallback_models: Annotated[ + OptionalNullable[List[str]], pydantic.Field(alias="models") + ] = UNSET + r"""Order of models to fallback to for this request""" + + reasoning_effort: OptionalNullable[ + ChatStreamCompletionCreateParamsReasoningEffort + ] = UNSET + r"""Reasoning effort""" + + provider: OptionalNullable[ChatStreamCompletionCreateParamsProvider] = UNSET + r"""When multiple model providers are available, optionally indicate your routing preference.""" + + plugins: Optional[List[ChatStreamCompletionCreateParamsPluginUnion]] = None + r"""Plugins you want to enable for this request, including their settings.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [ + "stream", + "model", + "frequency_penalty", + "logit_bias", + "logprobs", + "top_logprobs", + "max_completion_tokens", + "max_tokens", + "metadata", + "presence_penalty", + "reasoning", + "response_format", + "seed", + "stop", + "stream_options", + "temperature", + "tool_choice", + "tools", + "top_p", + "user", + "fallback_models", + "reasoning_effort", + "provider", + "plugins", + ] + nullable_fields = [ + "stream", + "frequency_penalty", + "logit_bias", + "logprobs", + "top_logprobs", + "max_completion_tokens", + "max_tokens", + "presence_penalty", + "reasoning", + "seed", + "stop", + "stream_options", + "temperature", + "top_p", + "fallback_models", + "reasoning_effort", + "provider", + ] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/openrouter/models/streamchatcompletionop.py b/src/openrouter/models/streamchatcompletionop.py new file mode 100644 index 0000000..289f952 --- /dev/null +++ b/src/openrouter/models/streamchatcompletionop.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .chatcompletionchunk import ChatCompletionChunk, ChatCompletionChunkTypedDict +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class StreamChatCompletionResponseBodyTypedDict(TypedDict): + r"""Successful chat completion response""" + + data: ChatCompletionChunkTypedDict + r"""Streaming chat completion chunk""" + + +class StreamChatCompletionResponseBody(BaseModel): + r"""Successful chat completion response""" + + data: ChatCompletionChunk + r"""Streaming chat completion chunk""" diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index ab87f24..ac72867 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -24,6 +24,7 @@ class OpenRouter(BaseSDK): """ chat: "Chat" + r"""Chat completion operations""" _sub_sdk_map = { "chat": ("openrouter.chat", "Chat"), } diff --git a/uv.lock b/uv.lock index 71bcb77..3021f9a 100644 --- a/uv.lock +++ b/uv.lock @@ -201,7 +201,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.3.3" +version = "0.4.1" source = { editable = "." } dependencies = [ { name = "httpcore" },