diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 4befa6f..ef05950 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: cfd52247-6a25-4c6d-bbce-fe6fce0cd69d management: - docChecksum: 56062ba1997e25ff8be6529c550e5de9 + docChecksum: ba9a1c22e9c7d5926d71b1e78e16b482 docVersion: 1.0.0 speakeasyVersion: 1.666.0 generationVersion: 2.768.0 - releaseVersion: 0.6.0 - configChecksum: 690b77f47b975e28d7e11a6b96fa1c2f + releaseVersion: 0.7.11 + configChecksum: c2013e97e44ae07d6749ebe461b47299 repoURL: https://github.com/OpenRouterTeam/python-sdk.git installationURL: https://github.com/OpenRouterTeam/python-sdk.git published: true @@ -14,6 +14,7 @@ features: python: acceptHeaders: 3.0.0 additionalDependencies: 1.0.0 + additionalProperties: 1.0.1 constsAndDefaults: 1.0.5 core: 5.23.13 defaultEnabledRetries: 0.2.0 @@ -53,68 +54,97 @@ generatedFiles: - docs/components/architecture.md - docs/components/assistantmessage.md - docs/components/assistantmessagecontent.md - - docs/components/assistantmessageimageurl.md + - docs/components/assistantmessageimages.md + - docs/components/assistantmessageimagesimageurl.md + - docs/components/assistantmessagerole.md - docs/components/badgatewayresponseerrordata.md - docs/components/badrequestresponseerrordata.md + - docs/components/by.md - docs/components/chainid.md - docs/components/chatcompletionfinishreason.md - - docs/components/chaterrorerror.md - docs/components/chatgenerationparams.md + - docs/components/chatgenerationparamsby.md + - docs/components/chatgenerationparamsidautorouter.md + - docs/components/chatgenerationparamsidfileparser.md + - docs/components/chatgenerationparamsidmoderation.md + - docs/components/chatgenerationparamsidresponsehealing.md + - docs/components/chatgenerationparamsidweb.md + - docs/components/chatgenerationparamsignore.md - docs/components/chatgenerationparamsimageconfig.md + - docs/components/chatgenerationparamsmaxprice.md + - docs/components/chatgenerationparamsonly.md + - docs/components/chatgenerationparamsorder.md + - docs/components/chatgenerationparamspartition.md + - docs/components/chatgenerationparamspluginautorouter.md + - docs/components/chatgenerationparamspluginfileparser.md + - docs/components/chatgenerationparamspluginmoderation.md + - docs/components/chatgenerationparamspluginresponsehealing.md + - docs/components/chatgenerationparamspluginunion.md + - docs/components/chatgenerationparamspluginweb.md + - docs/components/chatgenerationparamsprovider.md + - docs/components/chatgenerationparamsprovidersort.md + - docs/components/chatgenerationparamsprovidersortconfig.md + - docs/components/chatgenerationparamsprovidersortconfigenum.md + - docs/components/chatgenerationparamsprovidersortconfigunion.md + - docs/components/chatgenerationparamssortenum.md + - docs/components/chatgenerationparamssortunion.md + - docs/components/chatgenerationparamstrace.md - docs/components/chatgenerationtokenusage.md - docs/components/chatmessagecontentitem.md + - docs/components/chatmessagecontentitem1.md - docs/components/chatmessagecontentitemaudio.md - docs/components/chatmessagecontentitemaudioinputaudio.md + - docs/components/chatmessagecontentitemaudiotype.md - docs/components/chatmessagecontentitemcachecontrol.md + - docs/components/chatmessagecontentitemcachecontroltype.md - docs/components/chatmessagecontentitemimage.md - docs/components/chatmessagecontentitemimagedetail.md - docs/components/chatmessagecontentitemimageimageurl.md + - docs/components/chatmessagecontentitemimagetype.md - docs/components/chatmessagecontentitemtext.md + - docs/components/chatmessagecontentitemtexttype.md - docs/components/chatmessagecontentitemvideo.md - - docs/components/chatmessagecontentitemvideoinputvideo.md - - docs/components/chatmessagecontentitemvideovideourl.md + - docs/components/chatmessagecontentitemvideolegacy.md + - docs/components/chatmessagecontentitemvideolegacytype.md + - docs/components/chatmessagecontentitemvideotype.md - docs/components/chatmessagetokenlogprob.md - docs/components/chatmessagetokenlogprobs.md - docs/components/chatmessagetokenlogprobtoplogprob.md - docs/components/chatmessagetoolcall.md - docs/components/chatmessagetoolcallfunction.md + - docs/components/chatmessagetoolcalltype.md - docs/components/chatresponse.md - docs/components/chatresponsechoice.md + - docs/components/chatresponseobject.md - docs/components/chatstreamingchoice.md - docs/components/chatstreamingmessagechunk.md - docs/components/chatstreamingmessagechunkrole.md - docs/components/chatstreamingmessagetoolcall.md - docs/components/chatstreamingmessagetoolcallfunction.md + - docs/components/chatstreamingmessagetoolcalltype.md - docs/components/chatstreamingresponsechunk.md - - docs/components/chatstreamingresponsechunkdata.md - - docs/components/chatstreamingresponsechunkerror.md + - docs/components/chatstreamingresponsechunkobject.md - docs/components/chatstreamoptions.md - docs/components/code.md - - docs/components/codeenum.md - - docs/components/completion.md - docs/components/completiontokensdetails.md - docs/components/costdetails.md - docs/components/createchargerequest.md + - docs/components/data.md - docs/components/datacollection.md - - docs/components/debug.md + - docs/components/debugoptions.md - docs/components/defaultparameters.md - docs/components/developermessage.md - docs/components/developermessagecontent.md + - docs/components/developermessagerole.md - docs/components/edgenetworktimeoutresponseerrordata.md - docs/components/effort.md - docs/components/endpointstatus.md - - docs/components/engine.md + - docs/components/error.md - docs/components/filecitation.md - docs/components/filecitationtype.md - docs/components/filepath.md - docs/components/filepathtype.md - docs/components/forbiddenresponseerrordata.md - - docs/components/idautorouter.md - - docs/components/idfileparser.md - - docs/components/idmoderation.md - - docs/components/idresponsehealing.md - - docs/components/idweb.md - - docs/components/image.md - docs/components/imagegenerationstatus.md - docs/components/inputmodality.md - docs/components/inputtokensdetails.md @@ -130,12 +160,11 @@ generatedFiles: - docs/components/modelarchitectureinstructtype.md - docs/components/modelgroup.md - docs/components/modelscountresponse.md - - docs/components/modelscountresponsedata.md - docs/components/modelslistresponse.md - docs/components/namedtoolchoice.md - docs/components/namedtoolchoicefunction.md + - docs/components/namedtoolchoicetype.md - docs/components/notfoundresponseerrordata.md - - docs/components/object.md - docs/components/openairesponsesannotation.md - docs/components/openairesponsesincludable.md - docs/components/openairesponsesincompletedetails.md @@ -218,6 +247,7 @@ generatedFiles: - docs/components/openresponsesinputmessageitemtypemessage.md - docs/components/openresponseslogprobs.md - docs/components/openresponsesnonstreamingresponse.md + - docs/components/openresponsesnonstreamingresponseobject.md - docs/components/openresponsesnonstreamingresponsetoolfunction.md - docs/components/openresponsesnonstreamingresponsetoolunion.md - docs/components/openresponsesnonstreamingresponsetype.md @@ -240,14 +270,27 @@ generatedFiles: - docs/components/openresponsesreasoningsummarytextdoneeventtype.md - docs/components/openresponsesreasoningtype.md - docs/components/openresponsesrequest.md + - docs/components/openresponsesrequestidautorouter.md + - docs/components/openresponsesrequestidfileparser.md + - docs/components/openresponsesrequestidmoderation.md + - docs/components/openresponsesrequestidresponsehealing.md + - docs/components/openresponsesrequestidweb.md - docs/components/openresponsesrequestignore.md - docs/components/openresponsesrequestimageconfig.md - docs/components/openresponsesrequestmaxprice.md - docs/components/openresponsesrequestonly.md - docs/components/openresponsesrequestorder.md + - docs/components/openresponsesrequestpluginautorouter.md + - docs/components/openresponsesrequestpluginfileparser.md + - docs/components/openresponsesrequestpluginmoderation.md + - docs/components/openresponsesrequestpluginresponsehealing.md + - docs/components/openresponsesrequestpluginunion.md + - docs/components/openresponsesrequestpluginweb.md + - docs/components/openresponsesrequestprovider.md - docs/components/openresponsesrequestsort.md - docs/components/openresponsesrequesttoolfunction.md - docs/components/openresponsesrequesttoolunion.md + - docs/components/openresponsesrequesttrace.md - docs/components/openresponsesrequesttype.md - docs/components/openresponsesresponsetext.md - docs/components/openresponsesresponsetextverbosity.md @@ -299,29 +342,20 @@ generatedFiles: - docs/components/partition.md - docs/components/payloadtoolargeresponseerrordata.md - docs/components/paymentrequiredresponseerrordata.md - - docs/components/pdf.md - - docs/components/pdfengine.md - docs/components/pdfparserengine.md - docs/components/pdfparseroptions.md - docs/components/percentilelatencycutoffs.md - docs/components/percentilestats.md - docs/components/percentilethroughputcutoffs.md - docs/components/perrequestlimits.md - - docs/components/plugin.md - - docs/components/pluginautorouter.md - - docs/components/pluginfileparser.md - - docs/components/pluginmoderation.md - - docs/components/pluginresponsehealing.md - - docs/components/pluginweb.md - docs/components/preferredmaxlatency.md - docs/components/preferredminthroughput.md - docs/components/pricing.md - - docs/components/prompt.md - docs/components/prompttokensdetails.md - - docs/components/provider.md - docs/components/providername.md - docs/components/provideroverloadedresponseerrordata.md - docs/components/providerpreferences.md + - docs/components/providerpreferencesby.md - docs/components/providerpreferencesignore.md - docs/components/providerpreferencesmaxprice.md - docs/components/providerpreferencesonly.md @@ -329,18 +363,28 @@ generatedFiles: - docs/components/providerpreferencespartition.md - docs/components/providerpreferencesprovidersort.md - docs/components/providerpreferencesprovidersortconfig.md + - docs/components/providerpreferencesprovidersortconfigenum.md + - docs/components/providerpreferencesprovidersortconfigunion.md + - docs/components/providerpreferencessortenum.md - docs/components/providerpreferencessortunion.md - docs/components/providersort.md - docs/components/providersortconfig.md - - docs/components/providersortconfigenum.md - - docs/components/providersortconfigunion.md - - docs/components/providersortunion.md - docs/components/publicendpoint.md - docs/components/publicendpointquantization.md - docs/components/publicpricing.md - docs/components/quantization.md - docs/components/reason.md - docs/components/reasoning.md + - docs/components/reasoningdetailencrypted.md + - docs/components/reasoningdetailencryptedformat.md + - docs/components/reasoningdetailencryptedtype.md + - docs/components/reasoningdetailsummary.md + - docs/components/reasoningdetailsummaryformat.md + - docs/components/reasoningdetailsummarytype.md + - docs/components/reasoningdetailtext.md + - docs/components/reasoningdetailtextformat.md + - docs/components/reasoningdetailtexttype.md + - docs/components/reasoningdetailunion.md - docs/components/reasoningsummarytext.md - docs/components/reasoningsummarytexttype.md - docs/components/reasoningsummaryverbosity.md @@ -349,11 +393,16 @@ generatedFiles: - docs/components/requesttimeoutresponseerrordata.md - docs/components/responseformat.md - docs/components/responseformatjsonobject.md + - docs/components/responseformatjsonobjecttype.md - docs/components/responseformatjsonschema.md - - docs/components/responseformatpython.md + - docs/components/responseformatjsonschematype.md - docs/components/responseformattext.md - docs/components/responseformattextconfig.md - docs/components/responseformattextgrammar.md + - docs/components/responseformattextgrammartype.md + - docs/components/responseformattextpython.md + - docs/components/responseformattextpythontype.md + - docs/components/responseformattexttype.md - docs/components/responseinputaudio.md - docs/components/responseinputaudioformat.md - docs/components/responseinputaudioinputaudio.md @@ -371,8 +420,6 @@ generatedFiles: - docs/components/responseoutputtexttoplogprob.md - docs/components/responseoutputtexttype.md - docs/components/responseserrorfield.md - - docs/components/responsesformatjsonobject.md - - docs/components/responsesformatjsonobjecttype.md - docs/components/responsesformattext.md - docs/components/responsesformattextjsonschemaconfig.md - docs/components/responsesformattextjsonschemaconfigtype.md @@ -411,40 +458,25 @@ generatedFiles: - docs/components/responseswebsearchuserlocationtype.md - docs/components/responsetextconfig.md - docs/components/responsetextconfigverbosity.md - - docs/components/route.md - - docs/components/schema0.md - - docs/components/schema10.md - - docs/components/schema14.md - - docs/components/schema15.md - - docs/components/schema15union.md - - docs/components/schema17.md - - docs/components/schema17autorouter.md - - docs/components/schema17fileparser.md - - docs/components/schema17moderation.md - - docs/components/schema17responsehealing.md - - docs/components/schema17web.md - - docs/components/schema19.md - - docs/components/schema19reasoningencrypted.md - - docs/components/schema19reasoningsummary.md - - docs/components/schema19reasoningtext.md - - docs/components/schema21.md - - docs/components/schema3.md - - docs/components/schema5.md - - docs/components/schema5enum.md - - docs/components/schema8.md - docs/components/security.md - docs/components/servicetier.md - docs/components/serviceunavailableresponseerrordata.md - - docs/components/sortenum.md - docs/components/stop.md - docs/components/systemmessage.md - docs/components/systemmessagecontent.md + - docs/components/systemmessagerole.md - docs/components/tokenizer.md - docs/components/toolcallstatus.md + - docs/components/toolchoiceoption.md + - docs/components/toolchoiceoptionauto.md + - docs/components/toolchoiceoptionnone.md + - docs/components/toolchoiceoptionrequired.md - docs/components/tooldefinitionjson.md - docs/components/tooldefinitionjsonfunction.md + - docs/components/tooldefinitionjsontype.md - docs/components/toolresponsemessage.md - docs/components/toolresponsemessagecontent.md + - docs/components/toolresponsemessagerole.md - docs/components/toomanyrequestsresponseerrordata.md - docs/components/topproviderinfo.md - docs/components/truncation.md @@ -473,16 +505,15 @@ generatedFiles: - docs/components/urlcitationtype.md - docs/components/usermessage.md - docs/components/usermessagecontent.md + - docs/components/usermessagerole.md - docs/components/variables.md - - docs/components/videourl1.md - - docs/components/videourl2.md + - docs/components/videoinput.md - docs/components/websearchengine.md - docs/components/websearchpreviewtooluserlocation.md - docs/components/websearchpreviewtooluserlocationtype.md - docs/components/websearchstatus.md - docs/errors/badgatewayresponseerror.md - docs/errors/badrequestresponseerror.md - - docs/errors/chaterror.md - docs/errors/edgenetworktimeoutresponseerror.md - docs/errors/forbiddenresponseerror.md - docs/errors/internalserverresponseerror.md @@ -646,6 +677,7 @@ generatedFiles: - docs/operations/sendchatcompletionrequestglobals.md - docs/operations/sendchatcompletionrequestrequest.md - docs/operations/sendchatcompletionrequestresponse.md + - docs/operations/sendchatcompletionrequestresponsebody.md - docs/operations/transferintent.md - docs/operations/typeimageurl.md - docs/operations/typetext.md @@ -663,6 +695,7 @@ generatedFiles: - docs/operations/updatekeysrequestbody.md - docs/operations/updatekeysresponse.md - docs/operations/usage.md + - docs/operations/usagelimittype.md - docs/operations/web3data.md - docs/sdks/analytics/README.md - docs/sdks/apikeys/README.md @@ -691,17 +724,12 @@ generatedFiles: - src/openrouter/beta.py - src/openrouter/chat.py - src/openrouter/components/__init__.py - - src/openrouter/components/_schema10.py - - src/openrouter/components/_schema14.py - - src/openrouter/components/_schema17.py - - src/openrouter/components/_schema19.py - - src/openrouter/components/_schema5.py - src/openrouter/components/activityitem.py - src/openrouter/components/assistantmessage.py + - src/openrouter/components/assistantmessageimages.py - src/openrouter/components/badgatewayresponseerrordata.py - src/openrouter/components/badrequestresponseerrordata.py - src/openrouter/components/chatcompletionfinishreason.py - - src/openrouter/components/chaterror.py - src/openrouter/components/chatgenerationparams.py - src/openrouter/components/chatgenerationtokenusage.py - src/openrouter/components/chatmessagecontentitem.py @@ -710,6 +738,7 @@ generatedFiles: - src/openrouter/components/chatmessagecontentitemimage.py - src/openrouter/components/chatmessagecontentitemtext.py - src/openrouter/components/chatmessagecontentitemvideo.py + - src/openrouter/components/chatmessagecontentitemvideolegacy.py - src/openrouter/components/chatmessagetokenlogprob.py - src/openrouter/components/chatmessagetokenlogprobs.py - src/openrouter/components/chatmessagetoolcall.py @@ -722,6 +751,7 @@ generatedFiles: - src/openrouter/components/chatstreamoptions.py - src/openrouter/components/createchargerequest.py - src/openrouter/components/datacollection.py + - src/openrouter/components/debugoptions.py - src/openrouter/components/defaultparameters.py - src/openrouter/components/developermessage.py - src/openrouter/components/edgenetworktimeoutresponseerrordata.py @@ -802,17 +832,23 @@ generatedFiles: - src/openrouter/components/providerpreferences.py - src/openrouter/components/providersort.py - src/openrouter/components/providersortconfig.py - - src/openrouter/components/providersortunion.py - src/openrouter/components/publicendpoint.py - src/openrouter/components/publicpricing.py - src/openrouter/components/quantization.py + - src/openrouter/components/reasoningdetailencrypted.py + - src/openrouter/components/reasoningdetailsummary.py + - src/openrouter/components/reasoningdetailtext.py + - src/openrouter/components/reasoningdetailunion.py - src/openrouter/components/reasoningsummarytext.py - src/openrouter/components/reasoningsummaryverbosity.py - src/openrouter/components/reasoningtextcontent.py - src/openrouter/components/requesttimeoutresponseerrordata.py + - src/openrouter/components/responseformatjsonobject.py - src/openrouter/components/responseformatjsonschema.py + - src/openrouter/components/responseformattext.py - src/openrouter/components/responseformattextconfig.py - src/openrouter/components/responseformattextgrammar.py + - src/openrouter/components/responseformattextpython.py - src/openrouter/components/responseinputaudio.py - src/openrouter/components/responseinputfile.py - src/openrouter/components/responseinputimage.py @@ -820,7 +856,6 @@ generatedFiles: - src/openrouter/components/responseinputvideo.py - src/openrouter/components/responseoutputtext.py - src/openrouter/components/responseserrorfield.py - - src/openrouter/components/responsesformatjsonobject.py - src/openrouter/components/responsesformattext.py - src/openrouter/components/responsesformattextjsonschemaconfig.py - src/openrouter/components/responsesimagegenerationcall.py @@ -838,6 +873,7 @@ generatedFiles: - src/openrouter/components/serviceunavailableresponseerrordata.py - src/openrouter/components/systemmessage.py - src/openrouter/components/toolcallstatus.py + - src/openrouter/components/toolchoiceoption.py - src/openrouter/components/tooldefinitionjson.py - src/openrouter/components/toolresponsemessage.py - src/openrouter/components/toomanyrequestsresponseerrordata.py @@ -846,6 +882,7 @@ generatedFiles: - src/openrouter/components/unprocessableentityresponseerrordata.py - src/openrouter/components/urlcitation.py - src/openrouter/components/usermessage.py + - src/openrouter/components/videoinput.py - src/openrouter/components/websearchengine.py - src/openrouter/components/websearchpreviewtooluserlocation.py - src/openrouter/components/websearchstatus.py @@ -855,7 +892,6 @@ generatedFiles: - src/openrouter/errors/__init__.py - src/openrouter/errors/badgatewayresponse_error.py - src/openrouter/errors/badrequestresponse_error.py - - src/openrouter/errors/chaterror.py - src/openrouter/errors/edgenetworktimeoutresponse_error.py - src/openrouter/errors/forbiddenresponse_error.py - src/openrouter/errors/internalserverresponse_error.py @@ -1266,14 +1302,36 @@ examples: sendChatCompletionRequest: speakeasy-default-send-chat-completion-request: requestBody: - application/json: {"messages": [], "stream": false} + application/json: {"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"}], "stream": false, "temperature": 0.7, "top_p": 1} responses: "200": - application/json: {"id": "", "choices": [], "created": 6524.91, "model": "Silverado", "object": "chat.completion"} + application/json: {"id": "chatcmpl-123", "choices": [{"finish_reason": "stop", "index": 0, "message": {"role": "assistant"}}], "created": 1677652288, "model": "openai/gpt-4", "object": "chat.completion"} "400": - application/json: {"error": {"code": "", "message": ""}} + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} "500": - application/json: {"error": {"code": "", "message": ""}} + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "402": + application/json: {"error": {"code": 402, "message": "Insufficient credits. Add more using https://openrouter.ai/credits"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "408": + application/json: {"error": {"code": 408, "message": "Operation timed out. Please try again later."}} + "413": + application/json: {"error": {"code": 413, "message": "Request payload too large"}} + "422": + application/json: {"error": {"code": 422, "message": "Invalid argument"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "502": + application/json: {"error": {"code": 502, "message": "Provider returned error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + "524": + application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} + "529": + application/json: {"error": {"code": 529, "message": "Provider returned error"}} createCompletions: speakeasy-default-create-completions: requestBody: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index d10e025..de660ae 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -31,7 +31,7 @@ generation: skipResponseBodyAssertions: false preApplyUnionDiscriminators: true python: - version: 0.6.0 + version: 0.7.11 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/in.openapi.yaml b/.speakeasy/in.openapi.yaml index cc8e617..58e595c 100644 --- a/.speakeasy/in.openapi.yaml +++ b/.speakeasy/in.openapi.yaml @@ -10,6 +10,15 @@ info: license: name: MIT url: https://opensource.org/licenses/MIT +servers: + - url: https://openrouter.ai/api/v1 + description: Production server + x-speakeasy-server-id: production +security: + - apiKey: [] +externalDocs: + description: OpenRouter Documentation + url: https://openrouter.ai/docs components: schemas: OpenAIResponsesResponseStatus: @@ -304,6 +313,11 @@ components: - $ref: '#/components/schemas/OutputItemReasoning' - type: object properties: + content: + type: array + nullable: true + items: + $ref: '#/components/schemas/ReasoningTextContent' signature: type: string nullable: true @@ -1117,10 +1131,12 @@ components: - none ReasoningSummaryVerbosity: type: string + nullable: true enum: - auto - concise - detailed + example: auto OpenAIResponsesReasoningConfig: type: object nullable: true @@ -1156,18 +1172,6 @@ components: description: Plain text response format example: type: text - ResponsesFormatJSONObject: - type: object - properties: - type: - type: string - enum: - - json_object - required: - - type - description: JSON object response format - example: - type: json_object ResponsesFormatTextJSONSchemaConfig: type: object properties: @@ -1207,7 +1211,7 @@ components: ResponseFormatTextConfig: anyOf: - $ref: '#/components/schemas/ResponsesFormatText' - - $ref: '#/components/schemas/ResponsesFormatJSONObject' + - $ref: '#/components/schemas/ResponseFormatJSONObject' - $ref: '#/components/schemas/ResponsesFormatTextJSONSchemaConfig' description: Text response format configuration example: @@ -3283,6 +3287,11 @@ components: - $ref: '#/components/schemas/OutputItemReasoning' - type: object properties: + content: + type: array + nullable: true + items: + $ref: '#/components/schemas/ReasoningTextContent' signature: type: string nullable: true @@ -3573,7 +3582,9 @@ components: - Inception - Inceptron - InferenceNet + - Ionstream - Infermatic + - Io Net - Inflection - Liquid - Mara @@ -3631,20 +3642,34 @@ components: - price - throughput - latency + description: The provider sorting strategy (price, throughput, latency) + example: price ProviderSortConfig: type: object properties: by: - anyOf: - - $ref: '#/components/schemas/ProviderSort' - - type: 'null' + type: string + nullable: true + enum: + - price + - throughput + - latency + description: The provider sorting strategy (price, throughput, latency) + example: price partition: - anyOf: - - type: string - enum: - - model - - none - - type: 'null' + type: string + nullable: true + enum: + - model + - none + description: >- + Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback + models remain fallbacks), "none" sorts all endpoints together regardless of model. + example: model + description: The provider sorting strategy (price, throughput, latency) + example: + by: price + partition: model BigNumberUnion: type: string description: Price per million prompt tokens @@ -4094,6 +4119,25 @@ components: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + trace: + type: object + properties: + trace_id: + type: string + trace_name: + type: string + span_name: + type: string + generation_name: + type: string + parent_span_id: + type: string + additionalProperties: + nullable: true + description: >- + Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, + parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured + broadcast destinations. description: Request schema for Responses endpoint example: model: anthropic/claude-4.5-sonnet-20250929 @@ -7191,6 +7235,25 @@ components: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + trace: + type: object + properties: + trace_id: + type: string + trace_name: + type: string + span_name: + type: string + generation_name: + type: string + parent_span_id: + type: string + additionalProperties: + nullable: true + description: >- + Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, + parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured + broadcast destinations. models: type: array items: @@ -7314,6 +7377,1599 @@ components: error: code: 403 message: Only management keys can perform this operation + ChatCompletionFinishReason: + type: string + enum: + - tool_calls + - stop + - length + - content_filter + - error + example: stop + ChatMessageContentItemCacheControl: + type: object + properties: + type: + type: string + enum: + - ephemeral + ttl: + type: string + enum: + - 5m + - 1h + required: + - type + description: Cache control for the content part + example: + type: ephemeral + ttl: 5m + ChatMessageContentItemText: + type: object + properties: + type: + type: string + enum: + - text + text: + type: string + cache_control: + $ref: '#/components/schemas/ChatMessageContentItemCacheControl' + required: + - type + - text + description: Text content part + example: + type: text + text: Hello, world! + ChatMessageContentItemImage: + type: object + properties: + type: + type: string + enum: + - image_url + image_url: + type: object + properties: + url: + type: string + description: 'URL of the image (data: URLs supported)' + detail: + type: string + enum: + - auto + - low + - high + description: Image detail level for vision models + required: + - url + required: + - type + - image_url + description: Image content part for vision models + example: + type: image_url + image_url: + url: https://example.com/image.jpg + detail: auto + ChatMessageContentItemAudio: + type: object + properties: + type: + type: string + enum: + - input_audio + input_audio: + type: object + properties: + data: + type: string + description: Base64 encoded audio data + format: + type: string + description: >- + Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by + provider. + required: + - data + - format + required: + - type + - input_audio + description: Audio input content part. Supported audio formats vary by provider. + example: + type: input_audio + input_audio: + data: SGVsbG8gV29ybGQ= + format: wav + VideoInput: + type: object + properties: + url: + type: string + description: 'URL of the video (data: URLs supported)' + required: + - url + description: Video input object + ChatMessageContentItemVideoLegacy: + type: object + properties: + type: + type: string + enum: + - input_video + video_url: + $ref: '#/components/schemas/VideoInput' + required: + - type + - video_url + description: Video input content part (legacy format - deprecated) + deprecated: true + example: + type: input_video + video_url: + url: https://example.com/video.mp4 + ChatMessageContentItemVideo: + type: object + properties: + type: + type: string + enum: + - video_url + video_url: + $ref: '#/components/schemas/VideoInput' + required: + - type + - video_url + description: Video input content part + example: + type: video_url + video_url: + url: https://example.com/video.mp4 + ChatMessageContentItem: + oneOf: + - $ref: '#/components/schemas/ChatMessageContentItemText' + - $ref: '#/components/schemas/ChatMessageContentItemImage' + - $ref: '#/components/schemas/ChatMessageContentItemAudio' + - oneOf: + - $ref: '#/components/schemas/ChatMessageContentItemVideoLegacy' + - $ref: '#/components/schemas/ChatMessageContentItemVideo' + discriminator: + propertyName: type + mapping: + input_video: '#/components/schemas/ChatMessageContentItemVideoLegacy' + video_url: '#/components/schemas/ChatMessageContentItemVideo' + discriminator: + propertyName: type + description: Content part for chat completion messages + example: + type: text + text: Hello, world! + ChatMessageToolCall: + type: object + properties: + id: + type: string + description: Tool call identifier + type: + type: string + enum: + - function + function: + type: object + properties: + name: + type: string + description: Function name to call + arguments: + type: string + description: Function arguments as JSON string + required: + - name + - arguments + required: + - id + - type + - function + description: Tool call made by the assistant + example: + id: call_abc123 + type: function + function: + name: get_current_weather + arguments: '{"location": "Boston, MA"}' + ReasoningDetailSummary: + type: object + properties: + type: + type: string + enum: + - reasoning.summary + summary: + type: string + id: + type: string + nullable: true + format: + type: string + nullable: true + enum: + - unknown + - openai-responses-v1 + - azure-openai-responses-v1 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + index: + type: number + required: + - type + - summary + description: Reasoning detail summary schema + example: + type: reasoning.summary + summary: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... + ReasoningDetailEncrypted: + type: object + properties: + type: + type: string + enum: + - reasoning.encrypted + data: + type: string + id: + type: string + nullable: true + format: + type: string + nullable: true + enum: + - unknown + - openai-responses-v1 + - azure-openai-responses-v1 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + index: + type: number + required: + - type + - data + description: Reasoning detail encrypted schema + example: + type: reasoning.encrypted + data: encrypted data + ReasoningDetailText: + type: object + properties: + type: + type: string + enum: + - reasoning.text + text: + type: string + nullable: true + signature: + type: string + nullable: true + id: + type: string + nullable: true + format: + type: string + nullable: true + enum: + - unknown + - openai-responses-v1 + - azure-openai-responses-v1 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + index: + type: number + required: + - type + description: Reasoning detail text schema + example: + type: reasoning.text + text: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... + signature: signature + ReasoningDetailUnion: + oneOf: + - $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' + description: Reasoning detail union schema + example: + type: reasoning.summary + summary: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... + AssistantMessageReasoningDetails: + type: array + items: + $ref: '#/components/schemas/ReasoningDetailUnion' + description: Reasoning details for extended thinking models + AssistantMessageImages: + type: array + items: + type: object + properties: + image_url: + type: object + properties: + url: + type: string + description: URL or base64-encoded data of the generated image + required: + - url + required: + - image_url + description: Generated images from image generation models + example: + - image_url: + url: data:image/png;base64,iVBORw0KGgo... + AssistantMessage: + type: object + properties: + role: + type: string + enum: + - assistant + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItem' + - nullable: true + description: Assistant message content + name: + type: string + description: Optional name for the assistant + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatMessageToolCall' + description: Tool calls made by the assistant + refusal: + type: string + nullable: true + description: Refusal message if content was refused + reasoning: + type: string + nullable: true + description: Reasoning output + reasoning_details: + $ref: '#/components/schemas/AssistantMessageReasoningDetails' + images: + $ref: '#/components/schemas/AssistantMessageImages' + required: + - role + description: Assistant message for requests and responses + example: + role: assistant + content: The capital of France is Paris. + ChatMessageTokenLogprob: + type: object + properties: + token: + type: string + description: The token + logprob: + type: number + description: Log probability of the token + bytes: + type: array + nullable: true + items: + type: number + description: UTF-8 bytes of the token + top_logprobs: + type: array + items: + type: object + properties: + token: + type: string + logprob: + type: number + bytes: + type: array + nullable: true + items: + type: number + required: + - token + - logprob + - bytes + description: Top alternative tokens with probabilities + required: + - token + - logprob + - bytes + - top_logprobs + description: Token log probability information + example: + token: ' Hello' + logprob: -0.612345 + bytes: null + top_logprobs: + - token: ' Hello' + logprob: -0.612345 + bytes: null + ChatMessageTokenLogprobs: + type: object + nullable: true + properties: + content: + type: array + nullable: true + items: + $ref: '#/components/schemas/ChatMessageTokenLogprob' + description: Log probabilities for content tokens + refusal: + type: array + nullable: true + items: + $ref: '#/components/schemas/ChatMessageTokenLogprob' + description: Log probabilities for refusal tokens + required: + - content + - refusal + description: Log probabilities for the completion + example: + content: + - token: ' Hello' + logprob: -0.612345 + bytes: null + top_logprobs: [] + refusal: null + ChatResponseChoice: + type: object + properties: + finish_reason: + anyOf: + - $ref: '#/components/schemas/ChatCompletionFinishReason' + - nullable: true + - nullable: true + index: + type: number + description: Choice index + example: 0 + message: + $ref: '#/components/schemas/AssistantMessage' + logprobs: + $ref: '#/components/schemas/ChatMessageTokenLogprobs' + required: + - finish_reason + - index + - message + description: Chat completion choice + example: + finish_reason: stop + index: 0 + message: + role: assistant + content: The capital of France is Paris. + logprobs: null + ChatGenerationTokenUsage: + type: object + properties: + completion_tokens: + type: number + description: Number of tokens in the completion + prompt_tokens: + type: number + description: Number of tokens in the prompt + total_tokens: + type: number + description: Total number of tokens + completion_tokens_details: + type: object + nullable: true + properties: + reasoning_tokens: + type: number + nullable: true + description: Tokens used for reasoning + audio_tokens: + type: number + nullable: true + description: Tokens used for audio output + accepted_prediction_tokens: + type: number + nullable: true + description: Accepted prediction tokens + rejected_prediction_tokens: + type: number + nullable: true + description: Rejected prediction tokens + description: Detailed completion token usage + prompt_tokens_details: + type: object + nullable: true + properties: + cached_tokens: + type: number + description: Cached prompt tokens + cache_write_tokens: + type: number + description: Tokens written to cache. Only returned for models with explicit caching and cache write pricing. + audio_tokens: + type: number + description: Audio input tokens + video_tokens: + type: number + description: Video input tokens + description: Detailed prompt token usage + required: + - completion_tokens + - prompt_tokens + - total_tokens + description: Token usage statistics + example: + completion_tokens: 15 + prompt_tokens: 10 + total_tokens: 25 + completion_tokens_details: + reasoning_tokens: 5 + prompt_tokens_details: + cached_tokens: 2 + ChatResponse: + type: object + properties: + id: + type: string + description: Unique completion identifier + example: chatcmpl-123 + choices: + type: array + items: + $ref: '#/components/schemas/ChatResponseChoice' + description: List of completion choices + created: + type: number + description: Unix timestamp of creation + example: 1677652288 + model: + type: string + description: Model used for completion + example: openai/gpt-4 + object: + type: string + enum: + - chat.completion + system_fingerprint: + type: string + nullable: true + description: System fingerprint + example: fp_44709d6fcb + usage: + $ref: '#/components/schemas/ChatGenerationTokenUsage' + required: + - id + - choices + - created + - model + - object + description: Chat completion response + example: + id: chatcmpl-123 + object: chat.completion + created: 1677652288 + model: openai/gpt-4 + choices: + - index: 0 + message: + role: assistant + content: The capital of France is Paris. + finish_reason: stop + usage: + prompt_tokens: 10 + completion_tokens: 15 + total_tokens: 25 + ChatStreamingMessageToolCall: + type: object + properties: + index: + type: number + description: Tool call index in the array + example: 0 + id: + type: string + description: Tool call identifier + example: call_abc123 + type: + type: string + enum: + - function + description: Tool call type + example: function + function: + type: object + properties: + name: + type: string + description: Function name + example: get_weather + arguments: + type: string + description: Function arguments as JSON string + example: '{"location":' + description: Function call details + required: + - index + description: Tool call delta for streaming responses + example: + index: 0 + id: call_abc123 + type: function + function: + name: get_weather + arguments: '{"location":' + ChatStreamingMessageChunk: + type: object + properties: + role: + type: string + enum: + - assistant + description: The role of the message author + example: assistant + content: + type: string + nullable: true + description: Message content delta + example: Hello + reasoning: + type: string + nullable: true + description: Reasoning content delta + example: I need to + refusal: + type: string + nullable: true + description: Refusal message delta + example: null + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatStreamingMessageToolCall' + description: Tool calls delta + reasoning_details: + $ref: '#/components/schemas/AssistantMessageReasoningDetails' + description: Delta changes in streaming response + example: + role: assistant + content: Hello + ChatStreamingChoice: + type: object + properties: + delta: + $ref: '#/components/schemas/ChatStreamingMessageChunk' + finish_reason: + anyOf: + - $ref: '#/components/schemas/ChatCompletionFinishReason' + - nullable: true + - nullable: true + index: + type: number + description: Choice index + example: 0 + logprobs: + $ref: '#/components/schemas/ChatMessageTokenLogprobs' + required: + - delta + - finish_reason + - index + description: Streaming completion choice chunk + example: + index: 0 + delta: + role: assistant + content: Hello + finish_reason: null + ChatStreamingResponseChunk: + type: object + properties: + id: + type: string + description: Unique chunk identifier + example: chatcmpl-123 + choices: + type: array + items: + $ref: '#/components/schemas/ChatStreamingChoice' + description: List of streaming chunk choices + created: + type: number + description: Unix timestamp of creation + example: 1677652288 + model: + type: string + description: Model used for completion + example: openai/gpt-4 + object: + type: string + enum: + - chat.completion.chunk + system_fingerprint: + type: string + nullable: true + description: System fingerprint + example: fp_44709d6fcb + error: + type: object + properties: + message: + type: string + description: Error message + example: Rate limit exceeded + code: + type: number + description: Error code + example: 429 + required: + - message + - code + description: Error information + example: + message: Rate limit exceeded + code: 429 + usage: + $ref: '#/components/schemas/ChatGenerationTokenUsage' + required: + - id + - choices + - created + - model + - object + description: Streaming chat completion chunk + x-speakeasy-entity: ChatStreamChunk + example: + id: chatcmpl-123 + object: chat.completion.chunk + created: 1677652288 + model: openai/gpt-4 + choices: + - index: 0 + delta: + role: assistant + content: Hello + finish_reason: null + SystemMessage: + type: object + properties: + role: + type: string + enum: + - system + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + description: System message content + example: You are a helpful assistant. + name: + type: string + description: Optional name for the system message + example: Assistant Config + required: + - role + - content + description: System message for setting behavior + example: + role: system + content: You are a helpful assistant. + name: Assistant Config + UserMessage: + type: object + properties: + role: + type: string + enum: + - user + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItem' + description: User message content + example: What is the capital of France? + name: + type: string + description: Optional name for the user + example: User + required: + - role + - content + description: User message + example: + role: user + content: What is the capital of France? + DeveloperMessage: + type: object + properties: + role: + type: string + enum: + - developer + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + description: Developer message content + example: This is a message from the developer. + name: + type: string + description: Optional name for the developer message + example: Developer + required: + - role + - content + description: Developer message + example: + role: developer + content: This is a message from the developer. + ToolResponseMessage: + type: object + properties: + role: + type: string + enum: + - tool + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItem' + description: Tool response content + example: The weather in San Francisco is 72°F and sunny. + tool_call_id: + type: string + description: ID of the assistant message tool call this message responds to + example: call_abc123 + required: + - role + - content + - tool_call_id + description: Tool response message + example: + role: tool + content: The weather in San Francisco is 72°F and sunny. + tool_call_id: call_abc123 + Message: + oneOf: + - $ref: '#/components/schemas/SystemMessage' + - $ref: '#/components/schemas/UserMessage' + - $ref: '#/components/schemas/DeveloperMessage' + - $ref: '#/components/schemas/AssistantMessage' + - $ref: '#/components/schemas/ToolResponseMessage' + discriminator: + propertyName: role + description: Chat completion message with role-based discrimination + example: + role: user + content: What is the capital of France? + ModelName: + type: string + description: Model to use for completion + example: openai/gpt-4 + ModelNames: + type: array + items: + allOf: + - $ref: '#/components/schemas/ModelName' + - description: Available OpenRouter chat completion models + description: Models to use for completion + example: + - openai/gpt-4 + - openai/gpt-4o + ResponseFormatText: + type: object + properties: + type: + type: string + enum: + - text + required: + - type + description: Default text response format + example: + type: text + ResponseFormatJSONObject: + type: object + properties: + type: + type: string + enum: + - json_object + required: + - type + description: JSON object response format + example: + type: json_object + JSONSchemaConfig: + type: object + properties: + name: + type: string + maxLength: 64 + description: Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) + example: math_response + description: + type: string + description: Schema description for the model + example: A mathematical response + schema: + type: object + additionalProperties: + nullable: true + description: JSON Schema object + example: + type: object + properties: + answer: + type: number + required: + - answer + strict: + type: boolean + nullable: true + description: Enable strict schema adherence + example: false + required: + - name + description: JSON Schema configuration object + example: + name: math_response + description: A mathematical response + schema: + type: object + properties: + answer: + type: number + required: + - answer + strict: true + ResponseFormatJSONSchema: + type: object + properties: + type: + type: string + enum: + - json_schema + json_schema: + $ref: '#/components/schemas/JSONSchemaConfig' + required: + - type + - json_schema + description: JSON Schema response format for structured outputs + example: + type: json_schema + json_schema: + name: math_response + schema: + type: object + properties: + answer: + type: number + required: + - answer + ResponseFormatTextGrammar: + type: object + properties: + type: + type: string + enum: + - grammar + grammar: + type: string + description: Custom grammar for text generation + example: root ::= "yes" | "no" + required: + - type + - grammar + description: Custom grammar response format + example: + type: grammar + grammar: root ::= "yes" | "no" + ResponseFormatTextPython: + type: object + properties: + type: + type: string + enum: + - python + required: + - type + description: Python code response format + example: + type: python + ChatStreamOptions: + type: object + nullable: true + properties: + include_usage: + type: boolean + description: 'Deprecated: This field has no effect. Full usage details are always included.' + example: true + deprecated: true + description: Streaming configuration options + example: + include_usage: true + NamedToolChoice: + type: object + properties: + type: + type: string + enum: + - function + function: + type: object + properties: + name: + type: string + description: Function name to call + example: get_weather + required: + - name + required: + - type + - function + description: Named tool choice for specific function + example: + type: function + function: + name: get_weather + ToolChoiceOption: + anyOf: + - type: string + enum: + - none + - type: string + enum: + - auto + - type: string + enum: + - required + - $ref: '#/components/schemas/NamedToolChoice' + description: Tool choice configuration + example: auto + ToolDefinitionJson: + type: object + properties: + type: + type: string + enum: + - function + function: + type: object + properties: + name: + type: string + maxLength: 64 + description: Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) + example: get_weather + description: + type: string + description: Function description for the model + example: Get the current weather for a location + parameters: + type: object + additionalProperties: + nullable: true + description: Function parameters as JSON Schema object + example: + type: object + properties: + location: + type: string + description: City name + required: + - location + strict: + type: boolean + nullable: true + description: Enable strict schema adherence + example: false + required: + - name + description: Function definition for tool calling + example: + name: get_weather + description: Get the current weather for a location + parameters: + type: object + properties: + location: + type: string + description: City name + required: + - location + cache_control: + $ref: '#/components/schemas/ChatMessageContentItemCacheControl' + required: + - type + - function + description: Tool definition for function calling + example: + type: function + function: + name: get_weather + description: Get the current weather for a location + parameters: + type: object + properties: + location: + type: string + description: City name + unit: + type: string + enum: + - celsius + - fahrenheit + required: + - location + DebugOptions: + type: object + properties: + echo_upstream_body: + type: boolean + description: >- + If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only + works with streaming mode. + example: true + description: Debug options for inspecting request transformations (streaming only) + example: + echo_upstream_body: true + ChatGenerationParams: + type: object + properties: + provider: + type: object + nullable: true + properties: + allow_fallbacks: + type: boolean + nullable: true + description: > + 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: + type: boolean + nullable: true + description: >- + 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: + $ref: '#/components/schemas/DataCollection' + zdr: + type: boolean + nullable: true + description: >- + Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that + do not retain prompts will be used. + example: true + enforce_distillable_text: + type: boolean + nullable: true + description: >- + Whether to restrict routing to only models that allow text distillation. When true, only models where + the author has allowed distillation will be used. + example: true + order: + type: array + nullable: true + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + description: >- + 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: + type: array + nullable: true + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + description: >- + List of provider slugs to allow. If provided, this list is merged with your account-wide allowed + provider settings for this request. + ignore: + type: array + nullable: true + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + description: >- + List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored + provider settings for this request. + quantizations: + type: array + nullable: true + items: + $ref: '#/components/schemas/Quantization' + description: A list of quantization levels to filter the provider by. + sort: + allOf: + - $ref: '#/components/schemas/ProviderSort' + - anyOf: + - $ref: '#/components/schemas/ProviderSort' + - $ref: '#/components/schemas/ProviderSortConfig' + - nullable: true + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load + balancing is performed. + max_price: + type: object + properties: + prompt: + $ref: '#/components/schemas/BigNumberUnion' + completion: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens + image: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image + audio: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit + request: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request + description: >- + The object specifying the maximum price you want to pay for this request. USD price per million tokens, + for prompt and completion. + preferred_min_throughput: + $ref: '#/components/schemas/PreferredMinThroughput' + preferred_max_latency: + $ref: '#/components/schemas/PreferredMaxLatency' + additionalProperties: false + description: When multiple model providers are available, optionally indicate your routing preference. + plugins: + type: array + items: + oneOf: + - type: object + properties: + id: + type: string + enum: + - auto-router + enabled: + type: boolean + description: Set to false to disable the auto-router plugin for this request. Defaults to true. + allowed_models: + type: array + items: + type: string + description: >- + List of model patterns to filter which models the auto-router can route between. Supports + wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default + supported models list. + example: + - anthropic/* + - openai/gpt-4o + - google/* + required: + - id + - type: object + properties: + id: + type: string + enum: + - moderation + required: + - id + - type: object + properties: + id: + type: string + enum: + - web + enabled: + type: boolean + description: Set to false to disable the web-search plugin for this request. Defaults to true. + max_results: + type: number + search_prompt: + type: string + engine: + $ref: '#/components/schemas/WebSearchEngine' + required: + - id + - type: object + properties: + id: + type: string + enum: + - file-parser + enabled: + type: boolean + description: Set to false to disable the file-parser plugin for this request. Defaults to true. + pdf: + $ref: '#/components/schemas/PDFParserOptions' + required: + - id + - type: object + properties: + id: + type: string + enum: + - response-healing + enabled: + type: boolean + description: Set to false to disable the response-healing plugin for this request. Defaults to true. + required: + - id + description: Plugins you want to enable for this request, including their settings. + route: + type: string + nullable: true + enum: + - fallback + - sort + deprecated: true + description: >- + **DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for + providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none"). + x-speakeasy-deprecation-message: Use providers.sort.partition instead. + x-speakeasy-ignore: true + x-fern-ignore: true + user: + type: string + description: Unique user identifier + example: user-123 + session_id: + type: string + maxLength: 128 + description: >- + A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for + observability. If provided in both the request body and the x-session-id header, the body value takes + precedence. Maximum of 128 characters. + trace: + type: object + properties: + trace_id: + type: string + trace_name: + type: string + span_name: + type: string + generation_name: + type: string + parent_span_id: + type: string + additionalProperties: + nullable: true + description: >- + Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, + parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured + broadcast destinations. + messages: + type: array + items: + $ref: '#/components/schemas/Message' + minItems: 1 + description: List of messages for the conversation + example: + - role: user + content: Hello! + model: + $ref: '#/components/schemas/ModelName' + models: + $ref: '#/components/schemas/ModelNames' + frequency_penalty: + type: number + nullable: true + minimum: -2 + maximum: 2 + description: Frequency penalty (-2.0 to 2.0) + example: 0 + logit_bias: + type: object + nullable: true + additionalProperties: + type: number + description: Token logit bias adjustments + example: + '50256': -100 + logprobs: + type: boolean + nullable: true + description: Return log probabilities + example: false + top_logprobs: + type: number + nullable: true + minimum: 0 + maximum: 20 + description: Number of top log probabilities to return (0-20) + example: 5 + max_completion_tokens: + type: number + nullable: true + minimum: 1 + description: Maximum tokens in completion + example: 100 + max_tokens: + type: number + nullable: true + minimum: 1 + description: Maximum tokens (deprecated, use max_completion_tokens) + example: 100 + metadata: + type: object + additionalProperties: + type: string + description: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + example: + user_id: user-123 + session_id: session-456 + presence_penalty: + type: number + nullable: true + minimum: -2 + maximum: 2 + description: Presence penalty (-2.0 to 2.0) + example: 0 + reasoning: + type: object + properties: + effort: + type: string + nullable: true + enum: + - xhigh + - high + - medium + - low + - minimal + - none + description: Constrains effort on reasoning for reasoning models + example: medium + summary: + anyOf: + - $ref: '#/components/schemas/ReasoningSummaryVerbosity' + - nullable: true + - nullable: true + description: Configuration options for reasoning models + example: + effort: medium + summary: concise + response_format: + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJSONObject' + - $ref: '#/components/schemas/ResponseFormatJSONSchema' + - $ref: '#/components/schemas/ResponseFormatTextGrammar' + - $ref: '#/components/schemas/ResponseFormatTextPython' + discriminator: + propertyName: type + description: Response format configuration + example: + type: json_object + seed: + type: integer + nullable: true + description: Random seed for deterministic outputs + example: 42 + stop: + anyOf: + - type: string + - type: array + items: + type: string + maxItems: 4 + - nullable: true + description: Stop sequences (up to 4) + example: + - |+ + + stream: + type: boolean + default: false + description: Enable streaming response + example: false + stream_options: + $ref: '#/components/schemas/ChatStreamOptions' + temperature: + type: number + nullable: true + minimum: 0 + maximum: 2 + default: 1 + description: Sampling temperature (0-2) + example: 0.7 + parallel_tool_calls: + type: boolean + nullable: true + tool_choice: + $ref: '#/components/schemas/ToolChoiceOption' + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinitionJson' + description: Available tools for function calling + example: + - type: function + function: + name: get_weather + description: Get weather + top_p: + type: number + nullable: true + minimum: 0 + maximum: 1 + default: 1 + description: Nucleus sampling parameter (0-1) + example: 1 + debug: + $ref: '#/components/schemas/DebugOptions' + image_config: + type: object + additionalProperties: + anyOf: + - type: string + - type: number + - type: array + items: + nullable: true + description: >- + Provider-specific image configuration options. Keys and values vary by model/provider. See + https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. + example: + aspect_ratio: '16:9' + modalities: + type: array + items: + type: string + enum: + - text + - image + description: Output modalities for the response. Supported values are "text" and "image". + example: + - text + - image + required: + - messages + description: Chat completion request parameters + example: + messages: + - role: system + content: You are a helpful assistant. + - role: user + content: What is the capital of France? + model: openai/gpt-4 + temperature: 0.7 + max_tokens: 150 CreateChargeRequest: type: object properties: @@ -7507,7 +9163,6 @@ components: required: - prompt - completion - additionalProperties: false description: Pricing information for the model example: prompt: '0.00003' @@ -8015,7 +9670,6 @@ components: required: - prompt - completion - additionalProperties: false provider_name: $ref: '#/components/schemas/ProviderName' tag: @@ -8212,1260 +9866,6 @@ components: p75: 38.5 p90: 28.3 p99: 15.1 - __schema0: - anyOf: - - type: object - properties: - allow_fallbacks: - description: > - 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. - $ref: '#/components/schemas/__schema1' - require_parameters: - description: >- - 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. - $ref: '#/components/schemas/__schema1' - data_collection: - description: >- - 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. - $ref: '#/components/schemas/__schema3' - zdr: - anyOf: - - type: boolean - - type: 'null' - enforce_distillable_text: - anyOf: - - type: boolean - - type: 'null' - order: - description: >- - 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. - $ref: '#/components/schemas/__schema4' - only: - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed - provider settings for this request. - $ref: '#/components/schemas/__schema4' - ignore: - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored - provider settings for this request. - $ref: '#/components/schemas/__schema4' - quantizations: - description: A list of quantization levels to filter the provider by. - $ref: '#/components/schemas/__schema8' - sort: - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing - is performed. - $ref: '#/components/schemas/__schema9' - max_price: - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million tokens, - for prompt and completion. - $ref: '#/components/schemas/__schema10' - preferred_min_throughput: - description: >- - Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with - percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized - in routing. When using fallback models, this may cause a fallback model to be used instead of the - primary model if it meets the threshold. - $ref: '#/components/schemas/__schema15' - preferred_max_latency: - description: >- - Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with - percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized - in routing. When using fallback models, this may cause a fallback model to be used instead of the - primary model if it meets the threshold. - $ref: '#/components/schemas/__schema15' - additionalProperties: false - - type: 'null' - __schema1: - anyOf: - - type: boolean - - type: 'null' - __schema3: - anyOf: - - type: string - enum: - - deny - - allow - - type: 'null' - __schema4: - anyOf: - - $ref: '#/components/schemas/__schema5' - - type: 'null' - __schema5: - type: array - items: - anyOf: - - type: string - enum: - - AI21 - - AionLabs - - Alibaba - - Ambient - - Amazon Bedrock - - Amazon Nova - - Anthropic - - Arcee AI - - AtlasCloud - - Avian - - Azure - - BaseTen - - BytePlus - - Black Forest Labs - - Cerebras - - Chutes - - Cirrascale - - Clarifai - - Cloudflare - - Cohere - - Crusoe - - DeepInfra - - DeepSeek - - Featherless - - Fireworks - - Friendli - - GMICloud - - Google - - Google AI Studio - - Groq - - Hyperbolic - - Inception - - Inceptron - - InferenceNet - - Infermatic - - Inflection - - Liquid - - Mara - - Mancer 2 - - Minimax - - ModelRun - - Mistral - - Modular - - Moonshot AI - - Morph - - NCompass - - Nebius - - NextBit - - Novita - - Nvidia - - OpenAI - - OpenInference - - Parasail - - Perplexity - - Phala - - Relace - - SambaNova - - Seed - - SiliconFlow - - Sourceful - - StepFun - - Stealth - - StreamLake - - Switchpoint - - Together - - Upstage - - Venice - - WandB - - Xiaomi - - xAI - - Z.AI - - FakeProvider - - type: string - __schema8: - anyOf: - - type: array - items: - type: string - enum: - - int4 - - int8 - - fp4 - - fp6 - - fp8 - - fp16 - - bf16 - - fp32 - - unknown - - type: 'null' - __schema9: - anyOf: - - $ref: '#/components/schemas/ProviderSortUnion' - - type: 'null' - __schema10: - type: object - properties: - prompt: - anyOf: - - $ref: '#/components/schemas/__schema11' - - $ref: '#/components/schemas/ModelName' - - $ref: '#/components/schemas/__schema13' - completion: - anyOf: - - $ref: '#/components/schemas/__schema11' - - $ref: '#/components/schemas/ModelName' - - $ref: '#/components/schemas/__schema13' - image: - $ref: '#/components/schemas/__schema14' - audio: - $ref: '#/components/schemas/__schema14' - request: - $ref: '#/components/schemas/__schema14' - __schema11: - type: number - __schema13: {} - __schema14: - anyOf: - - $ref: '#/components/schemas/__schema11' - - $ref: '#/components/schemas/ModelName' - - $ref: '#/components/schemas/__schema13' - __schema15: - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - __schema17: - type: array - items: - oneOf: - - type: object - properties: - id: - type: string - const: auto-router - enabled: - type: boolean - allowed_models: - type: array - items: - type: string - required: - - id - - type: object - properties: - id: - type: string - const: moderation - required: - - id - - type: object - properties: - id: - type: string - const: web - enabled: - type: boolean - max_results: - type: number - search_prompt: - type: string - engine: - type: string - enum: - - native - - exa - required: - - id - - type: object - properties: - id: - type: string - const: file-parser - enabled: - type: boolean - pdf: - type: object - properties: - engine: - type: string - enum: - - mistral-ocr - - pdf-text - - native - required: - - id - - type: object - properties: - id: - type: string - const: response-healing - enabled: - type: boolean - required: - - id - type: object - __schema18: - type: string - maxLength: 128 - __schema19: - oneOf: - - type: object - properties: - type: - type: string - const: reasoning.summary - summary: - type: string - id: - $ref: '#/components/schemas/__schema20' - format: - $ref: '#/components/schemas/__schema21' - index: - $ref: '#/components/schemas/__schema11' - required: - - type - - summary - - type: object - properties: - type: - type: string - const: reasoning.encrypted - data: - type: string - id: - $ref: '#/components/schemas/__schema20' - format: - $ref: '#/components/schemas/__schema21' - index: - $ref: '#/components/schemas/__schema11' - required: - - type - - data - - type: object - properties: - type: - type: string - const: reasoning.text - text: - anyOf: - - type: string - - type: 'null' - signature: - anyOf: - - type: string - - type: 'null' - id: - $ref: '#/components/schemas/__schema20' - format: - $ref: '#/components/schemas/__schema21' - index: - $ref: '#/components/schemas/__schema11' - required: - - type - type: object - __schema20: - anyOf: - - type: string - - type: 'null' - __schema21: - anyOf: - - type: string - enum: - - unknown - - openai-responses-v1 - - azure-openai-responses-v1 - - xai-responses-v1 - - anthropic-claude-v1 - - google-gemini-v1 - - type: 'null' - __schema25: - anyOf: - - $ref: '#/components/schemas/ChatCompletionFinishReason' - - type: 'null' - ModelName: - type: string - ChatMessageContentItemText: - type: object - properties: - type: - type: string - const: text - text: - type: string - cache_control: - $ref: '#/components/schemas/ChatMessageContentItemCacheControl' - required: - - type - - text - ChatMessageContentItemImage: - type: object - properties: - type: - type: string - const: image_url - image_url: - type: object - properties: - url: - type: string - detail: - type: string - enum: - - auto - - low - - high - required: - - url - required: - - type - - image_url - ChatMessageContentItemAudio: - type: object - properties: - type: - type: string - const: input_audio - input_audio: - type: object - properties: - data: - type: string - format: - type: string - required: - - data - - format - required: - - type - - input_audio - ChatMessageContentItemVideo: - oneOf: - - type: object - properties: - type: - type: string - const: input_video - video_url: - type: object - properties: - url: - type: string - required: - - url - required: - - type - - video_url - - type: object - properties: - type: - type: string - const: video_url - video_url: - type: object - properties: - url: - type: string - required: - - url - required: - - type - - video_url - type: object - ChatMessageContentItem: - oneOf: - - $ref: '#/components/schemas/ChatMessageContentItemText' - - $ref: '#/components/schemas/ChatMessageContentItemImage' - - $ref: '#/components/schemas/ChatMessageContentItemAudio' - - $ref: '#/components/schemas/ChatMessageContentItemVideo' - type: object - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/ChatMessageContentItemText' - image_url: '#/components/schemas/ChatMessageContentItemImage' - input_audio: '#/components/schemas/ChatMessageContentItemAudio' - input_video: '#/components/schemas/ChatMessageContentItemVideo' - video_url: '#/components/schemas/ChatMessageContentItemVideo' - ChatMessageToolCall: - type: object - properties: - id: - type: string - type: - type: string - const: function - function: - type: object - properties: - name: - type: string - arguments: - type: string - required: - - name - - arguments - required: - - id - - type - - function - ChatMessageTokenLogprob: - type: object - properties: - token: - type: string - logprob: - type: number - bytes: - anyOf: - - type: array - items: - type: number - - type: 'null' - top_logprobs: - type: array - items: - type: object - properties: - token: - type: string - logprob: - type: number - bytes: - anyOf: - - type: array - items: - type: number - - type: 'null' - required: - - token - - logprob - - bytes - required: - - token - - logprob - - bytes - - top_logprobs - ChatMessageTokenLogprobs: - type: object - properties: - content: - anyOf: - - type: array - items: - $ref: '#/components/schemas/ChatMessageTokenLogprob' - - type: 'null' - refusal: - anyOf: - - type: array - items: - $ref: '#/components/schemas/ChatMessageTokenLogprob' - - type: 'null' - required: - - content - - refusal - ChatGenerationTokenUsage: - type: object - properties: - completion_tokens: - type: number - prompt_tokens: - type: number - total_tokens: - type: number - completion_tokens_details: - anyOf: - - type: object - properties: - reasoning_tokens: - anyOf: - - type: number - - type: 'null' - audio_tokens: - anyOf: - - type: number - - type: 'null' - accepted_prediction_tokens: - anyOf: - - type: number - - type: 'null' - rejected_prediction_tokens: - anyOf: - - type: number - - type: 'null' - - type: 'null' - prompt_tokens_details: - anyOf: - - type: object - properties: - cached_tokens: - type: number - cache_write_tokens: - type: number - audio_tokens: - type: number - video_tokens: - type: number - - type: 'null' - required: - - completion_tokens - - prompt_tokens - - total_tokens - ChatCompletionFinishReason: - type: string - enum: - - tool_calls - - stop - - length - - content_filter - - error - JSONSchemaConfig: - type: object - properties: - name: - type: string - maxLength: 64 - description: - type: string - schema: - type: object - propertyNames: - type: string - additionalProperties: {} - strict: - anyOf: - - type: boolean - - type: 'null' - required: - - name - ResponseFormatJSONSchema: - type: object - properties: - type: - type: string - const: json_schema - json_schema: - $ref: '#/components/schemas/JSONSchemaConfig' - required: - - type - - json_schema - ResponseFormatTextGrammar: - type: object - properties: - type: - type: string - const: grammar - grammar: - type: string - required: - - type - - grammar - ChatMessageContentItemCacheControl: - type: object - properties: - type: - type: string - const: ephemeral - ttl: - type: string - enum: - - 5m - - 1h - required: - - type - SystemMessage: - type: object - properties: - role: - type: string - const: system - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItemText' - name: - type: string - required: - - role - - content - UserMessage: - type: object - properties: - role: - type: string - const: user - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItem' - name: - type: string - required: - - role - - content - DeveloperMessage: - type: object - properties: - role: - type: string - const: developer - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItemText' - name: - type: string - required: - - role - - content - AssistantMessage: - type: object - properties: - role: - type: string - const: assistant - content: - anyOf: - - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItem' - - type: 'null' - name: - type: string - tool_calls: - type: array - items: - $ref: '#/components/schemas/ChatMessageToolCall' - refusal: - anyOf: - - type: string - - type: 'null' - reasoning: - anyOf: - - type: string - - type: 'null' - reasoning_details: - type: array - items: - $ref: '#/components/schemas/__schema19' - images: - type: array - items: - type: object - properties: - image_url: - type: object - properties: - url: - type: string - required: - - url - required: - - image_url - required: - - role - ToolResponseMessage: - type: object - properties: - role: - type: string - const: tool - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItem' - tool_call_id: - type: string - required: - - role - - content - - tool_call_id - Message: - oneOf: - - $ref: '#/components/schemas/SystemMessage' - - $ref: '#/components/schemas/UserMessage' - - $ref: '#/components/schemas/DeveloperMessage' - - $ref: '#/components/schemas/AssistantMessage' - - $ref: '#/components/schemas/ToolResponseMessage' - type: object - discriminator: - propertyName: role - mapping: - system: '#/components/schemas/SystemMessage' - user: '#/components/schemas/UserMessage' - developer: '#/components/schemas/DeveloperMessage' - assistant: '#/components/schemas/AssistantMessage' - tool: '#/components/schemas/ToolResponseMessage' - ToolDefinitionJson: - type: object - properties: - type: - type: string - const: function - function: - type: object - properties: - name: - type: string - maxLength: 64 - description: - type: string - parameters: - type: object - propertyNames: - type: string - additionalProperties: {} - strict: - anyOf: - - type: boolean - - type: 'null' - required: - - name - required: - - type - - function - NamedToolChoice: - type: object - properties: - type: - type: string - const: function - function: - type: object - properties: - name: - type: string - required: - - name - required: - - type - - function - ToolChoiceOption: - anyOf: - - type: string - const: none - - type: string - const: auto - - type: string - const: required - - $ref: '#/components/schemas/NamedToolChoice' - ChatStreamOptions: - type: object - properties: - include_usage: - type: boolean - ChatGenerationParams: - type: object - properties: - provider: - description: When multiple model providers are available, optionally indicate your routing preference. - $ref: '#/components/schemas/__schema0' - plugins: - description: Plugins you want to enable for this request, including their settings. - $ref: '#/components/schemas/__schema17' - route: - anyOf: - - type: string - enum: - - fallback - - sort - - type: 'null' - user: - type: string - session_id: - description: >- - A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for - observability. If provided in both the request body and the x-session-id header, the body value takes - precedence. Maximum of 128 characters. - $ref: '#/components/schemas/__schema18' - messages: - minItems: 1 - type: array - items: - $ref: '#/components/schemas/Message' - model: - $ref: '#/components/schemas/ModelName' - models: - type: array - items: - $ref: '#/components/schemas/ModelName' - frequency_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - logit_bias: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - logprobs: - anyOf: - - type: boolean - - type: 'null' - top_logprobs: - anyOf: - - type: number - minimum: 0 - maximum: 20 - - type: 'null' - max_completion_tokens: - anyOf: - - type: number - minimum: 1 - - type: 'null' - max_tokens: - anyOf: - - type: number - minimum: 1 - - type: 'null' - metadata: - type: object - propertyNames: - type: string - additionalProperties: - type: string - presence_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - reasoning: - type: object - properties: - effort: - anyOf: - - type: string - enum: - - xhigh - - high - - medium - - low - - minimal - - none - - type: 'null' - summary: - anyOf: - - $ref: '#/components/schemas/ReasoningSummaryVerbosity' - - type: 'null' - response_format: - oneOf: - - type: object - properties: - type: - type: string - const: text - required: - - type - - type: object - properties: - type: - type: string - const: json_object - required: - - type - - $ref: '#/components/schemas/ResponseFormatJSONSchema' - - $ref: '#/components/schemas/ResponseFormatTextGrammar' - - type: object - properties: - type: - type: string - const: python - required: - - type - type: object - seed: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: 'null' - stop: - anyOf: - - anyOf: - - type: string - - maxItems: 4 - type: array - items: - $ref: '#/components/schemas/ModelName' - - type: 'null' - stream: - default: false - type: boolean - stream_options: - anyOf: - - $ref: '#/components/schemas/ChatStreamOptions' - - type: 'null' - temperature: - default: 1 - anyOf: - - type: number - minimum: 0 - maximum: 2 - - type: 'null' - tool_choice: - $ref: '#/components/schemas/ToolChoiceOption' - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinitionJson' - top_p: - default: 1 - anyOf: - - type: number - minimum: 0 - maximum: 1 - - type: 'null' - debug: - type: object - properties: - echo_upstream_body: - type: boolean - image_config: - type: object - propertyNames: - type: string - additionalProperties: - anyOf: - - type: string - - type: number - - type: array - items: {} - modalities: - type: array - items: - type: string - enum: - - text - - image - required: - - messages - ProviderSortUnion: - anyOf: - - $ref: '#/components/schemas/ProviderSort' - - $ref: '#/components/schemas/ProviderSortConfig' - ChatResponseChoice: - type: object - properties: - finish_reason: - $ref: '#/components/schemas/__schema25' - index: - type: number - message: - $ref: '#/components/schemas/AssistantMessage' - logprobs: - anyOf: - - $ref: '#/components/schemas/ChatMessageTokenLogprobs' - - type: 'null' - required: - - finish_reason - - index - - message - ChatStreamingMessageToolCall: - type: object - properties: - index: - type: number - id: - type: string - type: - type: string - const: function - function: - type: object - properties: - name: - type: string - arguments: - type: string - required: - - index - ChatStreamingMessageChunk: - type: object - properties: - role: - type: string - enum: - - assistant - content: - anyOf: - - type: string - - type: 'null' - reasoning: - anyOf: - - type: string - - type: 'null' - refusal: - anyOf: - - type: string - - type: 'null' - tool_calls: - type: array - items: - $ref: '#/components/schemas/ChatStreamingMessageToolCall' - reasoning_details: - type: array - items: - $ref: '#/components/schemas/__schema19' - ChatStreamingChoice: - type: object - properties: - delta: - $ref: '#/components/schemas/ChatStreamingMessageChunk' - finish_reason: - $ref: '#/components/schemas/__schema25' - index: - type: number - logprobs: - anyOf: - - $ref: '#/components/schemas/ChatMessageTokenLogprobs' - - type: 'null' - required: - - delta - - finish_reason - - index - ChatError: - type: object - properties: - error: - type: object - properties: - code: - anyOf: - - anyOf: - - type: string - - type: number - - type: 'null' - message: - type: string - param: - anyOf: - - type: string - - type: 'null' - type: - anyOf: - - type: string - - type: 'null' - required: - - code - - message - additionalProperties: false - required: - - error - additionalProperties: false - ChatResponse: - type: object - properties: - id: - type: string - choices: - type: array - items: - $ref: '#/components/schemas/ChatResponseChoice' - created: - type: number - model: - type: string - object: - type: string - const: chat.completion - system_fingerprint: - anyOf: - - type: string - - type: 'null' - usage: - $ref: '#/components/schemas/ChatGenerationTokenUsage' - required: - - id - - choices - - created - - model - - object - additionalProperties: false - ChatStreamingResponseChunk: - type: object - properties: - data: - type: object - properties: - id: - type: string - choices: - type: array - items: - $ref: '#/components/schemas/ChatStreamingChoice' - created: - type: number - model: - type: string - object: - type: string - const: chat.completion.chunk - system_fingerprint: - anyOf: - - type: string - - type: 'null' - error: - type: object - properties: - message: - type: string - code: - type: number - required: - - message - - code - additionalProperties: false - usage: - $ref: '#/components/schemas/ChatGenerationTokenUsage' - required: - - id - - choices - - created - - model - - object - additionalProperties: false - required: - - data - additionalProperties: false parameters: {} securitySchemes: apiKey: @@ -9885,6 +10285,118 @@ paths: application/json: schema: $ref: '#/components/schemas/InternalServerResponse' + /chat/completions: + post: + x-speakeasy-group: chat + x-speakeasy-name-override: send + x-speakeasy-stream-request-field: stream + tags: + - Chat + summary: Create a chat completion + operationId: sendChatCompletionRequest + description: >- + Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming + modes. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChatGenerationParams' + required: true + responses: + '200': + description: Successful chat completion response + content: + application/json: + schema: + $ref: '#/components/schemas/ChatResponse' + text/event-stream: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/ChatStreamingResponseChunk' + required: + - data + x-speakeasy-sse-sentinel: '[DONE]' + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '402': + description: Payment Required - Insufficient credits or quota to complete request + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequiredResponse' + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + '408': + description: Request Timeout - Operation exceeded time limit + content: + application/json: + schema: + $ref: '#/components/schemas/RequestTimeoutResponse' + '413': + description: Payload Too Large - Request payload exceeds size limits + content: + application/json: + schema: + $ref: '#/components/schemas/PayloadTooLargeResponse' + '422': + description: Unprocessable Entity - Semantic validation failure + content: + application/json: + schema: + $ref: '#/components/schemas/UnprocessableEntityResponse' + '429': + description: Too Many Requests - Rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + '502': + description: Bad Gateway - Provider/upstream API failure + content: + application/json: + schema: + $ref: '#/components/schemas/BadGatewayResponse' + '503': + description: Service Unavailable - Service temporarily unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + '524': + description: Infrastructure Timeout - Request timed out at our edge network + content: + application/json: + schema: + $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + '529': + description: Provider Overloaded - Provider is temporarily overloaded + content: + application/json: + schema: + $ref: '#/components/schemas/ProviderOverloadedResponse' /credits: get: x-speakeasy-name-override: getCredits @@ -10557,7 +11069,9 @@ paths: - Inception - Inceptron - InferenceNet + - Ionstream - Infermatic + - Io Net - Inflection - Liquid - Mara @@ -13710,6 +14224,29 @@ paths: nullable: true format: date-time description: Optional expiration time for the API key to be created + key_label: + type: string + maxLength: 100 + description: Optional custom label for the API key. Defaults to the app name if not provided. + example: My Custom Key + usage_limit_type: + type: string + enum: + - daily + - weekly + - monthly + description: Optional credit limit reset interval. When set, the credit limit resets on this interval. + example: monthly + spawn_agent: + type: string + description: Agent identifier for spawn telemetry + x-speakeasy-ignore: true + x-fern-ignore: true + spawn_cloud: + type: string + description: Cloud identifier for spawn telemetry + x-speakeasy-ignore: true + x-fern-ignore: true required: - callback_url example: @@ -13771,70 +14308,6 @@ paths: schema: $ref: '#/components/schemas/InternalServerResponse' operationId: createAuthKeysCode - /chat/completions: - post: - summary: Create a chat completion - operationId: sendChatCompletionRequest - x-speakeasy-group: chat - x-speakeasy-name-override: send - x-speakeasy-stream-request-field: stream - description: >- - Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming - modes. - tags: - - Chat - requestBody: - required: true - description: Chat completion request parameters - content: - application/json: - schema: - $ref: '#/components/schemas/ChatGenerationParams' - responses: - '200': - description: Successful chat completion response - content: - application/json: - schema: - $ref: '#/components/schemas/ChatResponse' - description: Chat completion response - text/event-stream: - x-speakeasy-sse-sentinel: '[DONE]' - schema: - $ref: '#/components/schemas/ChatStreamingResponseChunk' - '400': - description: Bad request - invalid parameters - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '401': - description: Unauthorized - invalid API key - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '429': - description: Too many requests - rate limit exceeded - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' -servers: - - url: https://openrouter.ai/api/v1 - description: Production server - x-speakeasy-server-id: production -security: - - apiKey: [] -externalDocs: - description: OpenRouter Documentation - url: https://openrouter.ai/docs tags: - name: API Keys description: API key management endpoints diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index f33f4fa..23a2512 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -10,6 +10,15 @@ info: license: name: MIT url: https://opensource.org/licenses/MIT +servers: + - url: https://openrouter.ai/api/v1 + description: Production server + x-speakeasy-server-id: production +security: + - apiKey: [] +externalDocs: + description: OpenRouter Documentation + url: https://openrouter.ai/docs components: schemas: OpenAIResponsesResponseStatus: @@ -305,6 +314,11 @@ components: - $ref: '#/components/schemas/OutputItemReasoning' - type: object properties: + content: + type: array + nullable: true + items: + $ref: '#/components/schemas/ReasoningTextContent' signature: type: string nullable: true @@ -1128,10 +1142,12 @@ components: x-speakeasy-unknown-values: allow ReasoningSummaryVerbosity: type: string + nullable: true enum: - auto - concise - detailed + example: auto x-speakeasy-unknown-values: allow OpenAIResponsesReasoningConfig: type: object @@ -1170,18 +1186,6 @@ components: description: Plain text response format example: type: text - ResponsesFormatJSONObject: - type: object - properties: - type: - type: string - enum: - - json_object - required: - - type - description: JSON object response format - example: - type: json_object ResponsesFormatTextJSONSchemaConfig: type: object properties: @@ -1221,7 +1225,7 @@ components: ResponseFormatTextConfig: anyOf: - $ref: '#/components/schemas/ResponsesFormatText' - - $ref: '#/components/schemas/ResponsesFormatJSONObject' + - $ref: '#/components/schemas/ResponseFormatJSONObject' - $ref: '#/components/schemas/ResponsesFormatTextJSONSchemaConfig' description: Text response format configuration example: @@ -3299,6 +3303,11 @@ components: - $ref: '#/components/schemas/OutputItemReasoning' - type: object properties: + content: + type: array + nullable: true + items: + $ref: '#/components/schemas/ReasoningTextContent' signature: type: string nullable: true @@ -3592,7 +3601,9 @@ components: - Inception - Inceptron - InferenceNet + - Ionstream - Infermatic + - Io Net - Inflection - Liquid - Mara @@ -3652,22 +3663,36 @@ components: - price - throughput - latency + description: The provider sorting strategy (price, throughput, latency) + example: price x-speakeasy-unknown-values: allow ProviderSortConfig: type: object properties: by: - anyOf: - - $ref: '#/components/schemas/ProviderSort' - - type: 'null' + type: string + nullable: true + enum: + - price + - throughput + - latency + description: The provider sorting strategy (price, throughput, latency) + example: price + x-speakeasy-unknown-values: allow partition: - anyOf: - - type: string - enum: - - model - - none - x-speakeasy-unknown-values: allow - - type: 'null' + type: string + nullable: true + enum: + - model + - none + description: >- + Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model. + example: model + x-speakeasy-unknown-values: allow + description: The provider sorting strategy (price, throughput, latency) + example: + by: price + partition: model BigNumberUnion: type: string description: Price per million prompt tokens @@ -4097,6 +4122,23 @@ components: maxLength: 128 description: >- A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + trace: + type: object + properties: + trace_id: + type: string + trace_name: + type: string + span_name: + type: string + generation_name: + type: string + parent_span_id: + type: string + additionalProperties: + nullable: true + description: >- + Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. description: Request schema for Responses endpoint example: model: anthropic/claude-4.5-sonnet-20250929 @@ -7209,6 +7251,23 @@ components: maxLength: 128 description: >- A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + trace: + type: object + properties: + trace_id: + type: string + trace_name: + type: string + span_name: + type: string + generation_name: + type: string + parent_span_id: + type: string + additionalProperties: + nullable: true + description: >- + Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. models: type: array items: @@ -7332,6 +7391,1588 @@ components: error: code: 403 message: Only management keys can perform this operation + ChatCompletionFinishReason: + type: string + enum: + - tool_calls + - stop + - length + - content_filter + - error + example: stop + x-speakeasy-unknown-values: allow + ChatMessageContentItemCacheControl: + type: object + properties: + type: + type: string + enum: + - ephemeral + ttl: + type: string + enum: + - 5m + - 1h + x-speakeasy-unknown-values: allow + required: + - type + description: Cache control for the content part + example: + type: ephemeral + ttl: 5m + ChatMessageContentItemText: + type: object + properties: + type: + type: string + enum: + - text + text: + type: string + cache_control: + $ref: '#/components/schemas/ChatMessageContentItemCacheControl' + required: + - type + - text + description: Text content part + example: + type: text + text: Hello, world! + ChatMessageContentItemImage: + type: object + properties: + type: + type: string + enum: + - image_url + image_url: + type: object + properties: + url: + type: string + description: 'URL of the image (data: URLs supported)' + detail: + type: string + enum: + - auto + - low + - high + description: Image detail level for vision models + x-speakeasy-unknown-values: allow + required: + - url + required: + - type + - image_url + description: Image content part for vision models + example: + type: image_url + image_url: + url: https://example.com/image.jpg + detail: auto + ChatMessageContentItemAudio: + type: object + properties: + type: + type: string + enum: + - input_audio + input_audio: + type: object + properties: + data: + type: string + description: Base64 encoded audio data + format: + type: string + description: >- + Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by provider. + required: + - data + - format + required: + - type + - input_audio + description: Audio input content part. Supported audio formats vary by provider. + example: + type: input_audio + input_audio: + data: SGVsbG8gV29ybGQ= + format: wav + VideoInput: + type: object + properties: + url: + type: string + description: 'URL of the video (data: URLs supported)' + required: + - url + description: Video input object + ChatMessageContentItemVideoLegacy: + type: object + properties: + type: + type: string + enum: + - input_video + video_url: + $ref: '#/components/schemas/VideoInput' + required: + - type + - video_url + description: Video input content part (legacy format - deprecated) + deprecated: true + example: + type: input_video + video_url: + url: https://example.com/video.mp4 + ChatMessageContentItemVideo: + type: object + properties: + type: + type: string + enum: + - video_url + video_url: + $ref: '#/components/schemas/VideoInput' + required: + - type + - video_url + description: Video input content part + example: + type: video_url + video_url: + url: https://example.com/video.mp4 + ChatMessageContentItem: + oneOf: + - $ref: '#/components/schemas/ChatMessageContentItemText' + - $ref: '#/components/schemas/ChatMessageContentItemImage' + - $ref: '#/components/schemas/ChatMessageContentItemAudio' + - oneOf: + - $ref: '#/components/schemas/ChatMessageContentItemVideoLegacy' + - $ref: '#/components/schemas/ChatMessageContentItemVideo' + discriminator: + propertyName: type + mapping: + input_video: '#/components/schemas/ChatMessageContentItemVideoLegacy' + video_url: '#/components/schemas/ChatMessageContentItemVideo' + discriminator: + propertyName: type + description: Content part for chat completion messages + example: + type: text + text: Hello, world! + ChatMessageToolCall: + type: object + properties: + id: + type: string + description: Tool call identifier + type: + type: string + enum: + - function + function: + type: object + properties: + name: + type: string + description: Function name to call + arguments: + type: string + description: Function arguments as JSON string + required: + - name + - arguments + required: + - id + - type + - function + description: Tool call made by the assistant + example: + id: call_abc123 + type: function + function: + name: get_current_weather + arguments: '{"location": "Boston, MA"}' + ReasoningDetailSummary: + type: object + properties: + type: + type: string + enum: + - reasoning.summary + summary: + type: string + id: + type: string + nullable: true + format: + type: string + nullable: true + enum: + - unknown + - openai-responses-v1 + - azure-openai-responses-v1 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + x-speakeasy-unknown-values: allow + index: + type: number + required: + - type + - summary + description: Reasoning detail summary schema + example: + type: reasoning.summary + summary: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... + ReasoningDetailEncrypted: + type: object + properties: + type: + type: string + enum: + - reasoning.encrypted + data: + type: string + id: + type: string + nullable: true + format: + type: string + nullable: true + enum: + - unknown + - openai-responses-v1 + - azure-openai-responses-v1 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + x-speakeasy-unknown-values: allow + index: + type: number + required: + - type + - data + description: Reasoning detail encrypted schema + example: + type: reasoning.encrypted + data: encrypted data + ReasoningDetailText: + type: object + properties: + type: + type: string + enum: + - reasoning.text + text: + type: string + nullable: true + signature: + type: string + nullable: true + id: + type: string + nullable: true + format: + type: string + nullable: true + enum: + - unknown + - openai-responses-v1 + - azure-openai-responses-v1 + - xai-responses-v1 + - anthropic-claude-v1 + - google-gemini-v1 + x-speakeasy-unknown-values: allow + index: + type: number + required: + - type + description: Reasoning detail text schema + example: + type: reasoning.text + text: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... + signature: signature + ReasoningDetailUnion: + oneOf: + - $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' + description: Reasoning detail union schema + example: + type: reasoning.summary + summary: The model analyzed the problem by first identifying key constraints, then evaluating possible solutions... + AssistantMessageReasoningDetails: + type: array + items: + $ref: '#/components/schemas/ReasoningDetailUnion' + description: Reasoning details for extended thinking models + AssistantMessageImages: + type: array + items: + type: object + properties: + image_url: + type: object + properties: + url: + type: string + description: URL or base64-encoded data of the generated image + required: + - url + required: + - image_url + description: Generated images from image generation models + example: + - image_url: + url: data:image/png;base64,iVBORw0KGgo... + AssistantMessage: + type: object + properties: + role: + type: string + enum: + - assistant + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItem' + - nullable: true + description: Assistant message content + name: + type: string + description: Optional name for the assistant + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatMessageToolCall' + description: Tool calls made by the assistant + refusal: + type: string + nullable: true + description: Refusal message if content was refused + reasoning: + type: string + nullable: true + description: Reasoning output + reasoning_details: + $ref: '#/components/schemas/AssistantMessageReasoningDetails' + images: + $ref: '#/components/schemas/AssistantMessageImages' + required: + - role + description: Assistant message for requests and responses + example: + role: assistant + content: The capital of France is Paris. + ChatMessageTokenLogprob: + type: object + properties: + token: + type: string + description: The token + logprob: + type: number + description: Log probability of the token + bytes: + type: array + nullable: true + items: + type: number + description: UTF-8 bytes of the token + top_logprobs: + type: array + items: + type: object + properties: + token: + type: string + logprob: + type: number + bytes: + type: array + nullable: true + items: + type: number + required: + - token + - logprob + - bytes + description: Top alternative tokens with probabilities + required: + - token + - logprob + - bytes + - top_logprobs + description: Token log probability information + example: + token: ' Hello' + logprob: -0.612345 + bytes: null + top_logprobs: + - token: ' Hello' + logprob: -0.612345 + bytes: null + ChatMessageTokenLogprobs: + type: object + nullable: true + properties: + content: + type: array + nullable: true + items: + $ref: '#/components/schemas/ChatMessageTokenLogprob' + description: Log probabilities for content tokens + refusal: + type: array + nullable: true + items: + $ref: '#/components/schemas/ChatMessageTokenLogprob' + description: Log probabilities for refusal tokens + required: + - content + - refusal + description: Log probabilities for the completion + example: + content: + - token: ' Hello' + logprob: -0.612345 + bytes: null + top_logprobs: [] + refusal: null + ChatResponseChoice: + type: object + properties: + finish_reason: + anyOf: + - $ref: '#/components/schemas/ChatCompletionFinishReason' + - nullable: true + - nullable: true + index: + type: number + description: Choice index + example: 0 + message: + $ref: '#/components/schemas/AssistantMessage' + logprobs: + $ref: '#/components/schemas/ChatMessageTokenLogprobs' + required: + - finish_reason + - index + - message + description: Chat completion choice + example: + finish_reason: stop + index: 0 + message: + role: assistant + content: The capital of France is Paris. + logprobs: null + ChatGenerationTokenUsage: + type: object + properties: + completion_tokens: + type: number + description: Number of tokens in the completion + prompt_tokens: + type: number + description: Number of tokens in the prompt + total_tokens: + type: number + description: Total number of tokens + completion_tokens_details: + type: object + nullable: true + properties: + reasoning_tokens: + type: number + nullable: true + description: Tokens used for reasoning + audio_tokens: + type: number + nullable: true + description: Tokens used for audio output + accepted_prediction_tokens: + type: number + nullable: true + description: Accepted prediction tokens + rejected_prediction_tokens: + type: number + nullable: true + description: Rejected prediction tokens + description: Detailed completion token usage + prompt_tokens_details: + type: object + nullable: true + properties: + cached_tokens: + type: number + description: Cached prompt tokens + cache_write_tokens: + type: number + description: Tokens written to cache. Only returned for models with explicit caching and cache write pricing. + audio_tokens: + type: number + description: Audio input tokens + video_tokens: + type: number + description: Video input tokens + description: Detailed prompt token usage + required: + - completion_tokens + - prompt_tokens + - total_tokens + description: Token usage statistics + example: + completion_tokens: 15 + prompt_tokens: 10 + total_tokens: 25 + completion_tokens_details: + reasoning_tokens: 5 + prompt_tokens_details: + cached_tokens: 2 + ChatResponse: + type: object + properties: + id: + type: string + description: Unique completion identifier + example: chatcmpl-123 + choices: + type: array + items: + $ref: '#/components/schemas/ChatResponseChoice' + description: List of completion choices + created: + type: number + description: Unix timestamp of creation + example: 1677652288 + model: + type: string + description: Model used for completion + example: openai/gpt-4 + object: + type: string + enum: + - chat.completion + system_fingerprint: + type: string + nullable: true + description: System fingerprint + example: fp_44709d6fcb + usage: + $ref: '#/components/schemas/ChatGenerationTokenUsage' + required: + - id + - choices + - created + - model + - object + description: Chat completion response + example: + id: chatcmpl-123 + object: chat.completion + created: 1677652288 + model: openai/gpt-4 + choices: + - index: 0 + message: + role: assistant + content: The capital of France is Paris. + finish_reason: stop + usage: + prompt_tokens: 10 + completion_tokens: 15 + total_tokens: 25 + ChatStreamingMessageToolCall: + type: object + properties: + index: + type: number + description: Tool call index in the array + example: 0 + id: + type: string + description: Tool call identifier + example: call_abc123 + type: + type: string + enum: + - function + description: Tool call type + example: function + function: + type: object + properties: + name: + type: string + description: Function name + example: get_weather + arguments: + type: string + description: Function arguments as JSON string + example: '{"location":' + description: Function call details + required: + - index + description: Tool call delta for streaming responses + example: + index: 0 + id: call_abc123 + type: function + function: + name: get_weather + arguments: '{"location":' + ChatStreamingMessageChunk: + type: object + properties: + role: + type: string + enum: + - assistant + description: The role of the message author + example: assistant + content: + type: string + nullable: true + description: Message content delta + example: Hello + reasoning: + type: string + nullable: true + description: Reasoning content delta + example: I need to + refusal: + type: string + nullable: true + description: Refusal message delta + example: null + tool_calls: + type: array + items: + $ref: '#/components/schemas/ChatStreamingMessageToolCall' + description: Tool calls delta + reasoning_details: + $ref: '#/components/schemas/AssistantMessageReasoningDetails' + description: Delta changes in streaming response + example: + role: assistant + content: Hello + ChatStreamingChoice: + type: object + properties: + delta: + $ref: '#/components/schemas/ChatStreamingMessageChunk' + finish_reason: + anyOf: + - $ref: '#/components/schemas/ChatCompletionFinishReason' + - nullable: true + - nullable: true + index: + type: number + description: Choice index + example: 0 + logprobs: + $ref: '#/components/schemas/ChatMessageTokenLogprobs' + required: + - delta + - finish_reason + - index + description: Streaming completion choice chunk + example: + index: 0 + delta: + role: assistant + content: Hello + finish_reason: null + ChatStreamingResponseChunk: + type: object + properties: + id: + type: string + description: Unique chunk identifier + example: chatcmpl-123 + choices: + type: array + items: + $ref: '#/components/schemas/ChatStreamingChoice' + description: List of streaming chunk choices + created: + type: number + description: Unix timestamp of creation + example: 1677652288 + model: + type: string + description: Model used for completion + example: openai/gpt-4 + object: + type: string + enum: + - chat.completion.chunk + system_fingerprint: + type: string + nullable: true + description: System fingerprint + example: fp_44709d6fcb + error: + type: object + properties: + message: + type: string + description: Error message + example: Rate limit exceeded + code: + type: number + description: Error code + example: 429 + required: + - message + - code + description: Error information + example: + message: Rate limit exceeded + code: 429 + usage: + $ref: '#/components/schemas/ChatGenerationTokenUsage' + required: + - id + - choices + - created + - model + - object + description: Streaming chat completion chunk + x-speakeasy-entity: ChatStreamChunk + example: + id: chatcmpl-123 + object: chat.completion.chunk + created: 1677652288 + model: openai/gpt-4 + choices: + - index: 0 + delta: + role: assistant + content: Hello + finish_reason: null + SystemMessage: + type: object + properties: + role: + type: string + enum: + - system + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + description: System message content + example: You are a helpful assistant. + name: + type: string + description: Optional name for the system message + example: Assistant Config + required: + - role + - content + description: System message for setting behavior + example: + role: system + content: You are a helpful assistant. + name: Assistant Config + UserMessage: + type: object + properties: + role: + type: string + enum: + - user + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItem' + description: User message content + example: What is the capital of France? + name: + type: string + description: Optional name for the user + example: User + required: + - role + - content + description: User message + example: + role: user + content: What is the capital of France? + DeveloperMessage: + type: object + properties: + role: + type: string + enum: + - developer + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItemText' + description: Developer message content + example: This is a message from the developer. + name: + type: string + description: Optional name for the developer message + example: Developer + required: + - role + - content + description: Developer message + example: + role: developer + content: This is a message from the developer. + ToolResponseMessage: + type: object + properties: + role: + type: string + enum: + - tool + content: + anyOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/ChatMessageContentItem' + description: Tool response content + example: The weather in San Francisco is 72°F and sunny. + tool_call_id: + type: string + description: ID of the assistant message tool call this message responds to + example: call_abc123 + required: + - role + - content + - tool_call_id + description: Tool response message + example: + role: tool + content: The weather in San Francisco is 72°F and sunny. + tool_call_id: call_abc123 + Message: + oneOf: + - $ref: '#/components/schemas/SystemMessage' + - $ref: '#/components/schemas/UserMessage' + - $ref: '#/components/schemas/DeveloperMessage' + - $ref: '#/components/schemas/AssistantMessage' + - $ref: '#/components/schemas/ToolResponseMessage' + discriminator: + propertyName: role + description: Chat completion message with role-based discrimination + example: + role: user + content: What is the capital of France? + ModelName: + type: string + description: Model to use for completion + example: openai/gpt-4 + ModelNames: + type: array + items: + allOf: + - $ref: '#/components/schemas/ModelName' + - description: Available OpenRouter chat completion models + description: Models to use for completion + example: + - openai/gpt-4 + - openai/gpt-4o + ResponseFormatText: + type: object + properties: + type: + type: string + enum: + - text + required: + - type + description: Default text response format + example: + type: text + ResponseFormatJSONObject: + type: object + properties: + type: + type: string + enum: + - json_object + required: + - type + description: JSON object response format + example: + type: json_object + JSONSchemaConfig: + type: object + properties: + name: + type: string + maxLength: 64 + description: Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) + example: math_response + description: + type: string + description: Schema description for the model + example: A mathematical response + schema: + type: object + additionalProperties: + nullable: true + description: JSON Schema object + example: + type: object + properties: + answer: + type: number + required: + - answer + strict: + type: boolean + nullable: true + description: Enable strict schema adherence + example: false + required: + - name + description: JSON Schema configuration object + example: + name: math_response + description: A mathematical response + schema: + type: object + properties: + answer: + type: number + required: + - answer + strict: true + ResponseFormatJSONSchema: + type: object + properties: + type: + type: string + enum: + - json_schema + json_schema: + $ref: '#/components/schemas/JSONSchemaConfig' + required: + - type + - json_schema + description: JSON Schema response format for structured outputs + example: + type: json_schema + json_schema: + name: math_response + schema: + type: object + properties: + answer: + type: number + required: + - answer + ResponseFormatTextGrammar: + type: object + properties: + type: + type: string + enum: + - grammar + grammar: + type: string + description: Custom grammar for text generation + example: root ::= "yes" | "no" + required: + - type + - grammar + description: Custom grammar response format + example: + type: grammar + grammar: root ::= "yes" | "no" + ResponseFormatTextPython: + type: object + properties: + type: + type: string + enum: + - python + required: + - type + description: Python code response format + example: + type: python + ChatStreamOptions: + type: object + nullable: true + properties: + include_usage: + type: boolean + description: 'Deprecated: This field has no effect. Full usage details are always included.' + example: true + deprecated: true + description: Streaming configuration options + example: + include_usage: true + NamedToolChoice: + type: object + properties: + type: + type: string + enum: + - function + function: + type: object + properties: + name: + type: string + description: Function name to call + example: get_weather + required: + - name + required: + - type + - function + description: Named tool choice for specific function + example: + type: function + function: + name: get_weather + ToolChoiceOption: + anyOf: + - type: string + enum: + - none + - type: string + enum: + - auto + - type: string + enum: + - required + - $ref: '#/components/schemas/NamedToolChoice' + description: Tool choice configuration + example: auto + ToolDefinitionJson: + type: object + properties: + type: + type: string + enum: + - function + function: + type: object + properties: + name: + type: string + maxLength: 64 + description: Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) + example: get_weather + description: + type: string + description: Function description for the model + example: Get the current weather for a location + parameters: + type: object + additionalProperties: + nullable: true + description: Function parameters as JSON Schema object + example: + type: object + properties: + location: + type: string + description: City name + required: + - location + strict: + type: boolean + nullable: true + description: Enable strict schema adherence + example: false + required: + - name + description: Function definition for tool calling + example: + name: get_weather + description: Get the current weather for a location + parameters: + type: object + properties: + location: + type: string + description: City name + required: + - location + cache_control: + $ref: '#/components/schemas/ChatMessageContentItemCacheControl' + required: + - type + - function + description: Tool definition for function calling + example: + type: function + function: + name: get_weather + description: Get the current weather for a location + parameters: + type: object + properties: + location: + type: string + description: City name + unit: + type: string + enum: + - celsius + - fahrenheit + x-speakeasy-unknown-values: allow + required: + - location + DebugOptions: + type: object + properties: + echo_upstream_body: + type: boolean + description: >- + If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode. + example: true + description: Debug options for inspecting request transformations (streaming only) + example: + echo_upstream_body: true + ChatGenerationParams: + type: object + properties: + provider: + type: object + nullable: true + properties: + allow_fallbacks: + type: boolean + nullable: true + description: > + 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: + type: boolean + nullable: true + description: >- + 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: + $ref: '#/components/schemas/DataCollection' + zdr: + type: boolean + nullable: true + description: >- + Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. + example: true + enforce_distillable_text: + type: boolean + nullable: true + description: >- + Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. + example: true + order: + type: array + nullable: true + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + description: >- + 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: + type: array + nullable: true + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + description: >- + List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. + ignore: + type: array + nullable: true + items: + anyOf: + - $ref: '#/components/schemas/ProviderName' + - type: string + description: >- + List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. + quantizations: + type: array + nullable: true + items: + $ref: '#/components/schemas/Quantization' + description: A list of quantization levels to filter the provider by. + sort: + allOf: + - $ref: '#/components/schemas/ProviderSort' + - anyOf: + - $ref: '#/components/schemas/ProviderSort' + - $ref: '#/components/schemas/ProviderSortConfig' + - nullable: true + description: >- + The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + max_price: + type: object + properties: + prompt: + $ref: '#/components/schemas/BigNumberUnion' + completion: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per million completion tokens + image: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per image + audio: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per audio unit + request: + allOf: + - $ref: '#/components/schemas/BigNumberUnion' + - description: Price per request + description: >- + The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. + preferred_min_throughput: + $ref: '#/components/schemas/PreferredMinThroughput' + preferred_max_latency: + $ref: '#/components/schemas/PreferredMaxLatency' + additionalProperties: false + description: When multiple model providers are available, optionally indicate your routing preference. + plugins: + type: array + items: + oneOf: + - type: object + properties: + id: + type: string + enum: + - auto-router + enabled: + type: boolean + description: Set to false to disable the auto-router plugin for this request. Defaults to true. + allowed_models: + type: array + items: + type: string + description: >- + List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list. + example: + - anthropic/* + - openai/gpt-4o + - google/* + required: + - id + - type: object + properties: + id: + type: string + enum: + - moderation + required: + - id + - type: object + properties: + id: + type: string + enum: + - web + enabled: + type: boolean + description: Set to false to disable the web-search plugin for this request. Defaults to true. + max_results: + type: number + search_prompt: + type: string + engine: + $ref: '#/components/schemas/WebSearchEngine' + required: + - id + - type: object + properties: + id: + type: string + enum: + - file-parser + enabled: + type: boolean + description: Set to false to disable the file-parser plugin for this request. Defaults to true. + pdf: + $ref: '#/components/schemas/PDFParserOptions' + required: + - id + - type: object + properties: + id: + type: string + enum: + - response-healing + enabled: + type: boolean + description: Set to false to disable the response-healing plugin for this request. Defaults to true. + required: + - id + description: Plugins you want to enable for this request, including their settings. + route: + type: string + nullable: true + enum: + - fallback + - sort + deprecated: true + description: >- + **DEPRECATED** Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none"). + x-speakeasy-deprecation-message: Use providers.sort.partition instead. + x-speakeasy-ignore: true + x-fern-ignore: true + x-speakeasy-unknown-values: allow + user: + type: string + description: Unique user identifier + example: user-123 + session_id: + type: string + maxLength: 128 + description: >- + A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + trace: + type: object + properties: + trace_id: + type: string + trace_name: + type: string + span_name: + type: string + generation_name: + type: string + parent_span_id: + type: string + additionalProperties: + nullable: true + description: >- + Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + messages: + type: array + items: + $ref: '#/components/schemas/Message' + minItems: 1 + description: List of messages for the conversation + example: + - role: user + content: Hello! + model: + $ref: '#/components/schemas/ModelName' + models: + $ref: '#/components/schemas/ModelNames' + frequency_penalty: + type: number + nullable: true + minimum: -2 + maximum: 2 + description: Frequency penalty (-2.0 to 2.0) + example: 0 + logit_bias: + type: object + nullable: true + additionalProperties: + type: number + description: Token logit bias adjustments + example: + '50256': -100 + logprobs: + type: boolean + nullable: true + description: Return log probabilities + example: false + top_logprobs: + type: number + nullable: true + minimum: 0 + maximum: 20 + description: Number of top log probabilities to return (0-20) + example: 5 + max_completion_tokens: + type: number + nullable: true + minimum: 1 + description: Maximum tokens in completion + example: 100 + max_tokens: + type: number + nullable: true + minimum: 1 + description: Maximum tokens (deprecated, use max_completion_tokens) + example: 100 + metadata: + type: object + additionalProperties: + type: string + description: Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) + example: + user_id: user-123 + session_id: session-456 + presence_penalty: + type: number + nullable: true + minimum: -2 + maximum: 2 + description: Presence penalty (-2.0 to 2.0) + example: 0 + reasoning: + type: object + properties: + effort: + type: string + nullable: true + enum: + - xhigh + - high + - medium + - low + - minimal + - none + description: Constrains effort on reasoning for reasoning models + example: medium + x-speakeasy-unknown-values: allow + summary: + anyOf: + - $ref: '#/components/schemas/ReasoningSummaryVerbosity' + - nullable: true + - nullable: true + description: Configuration options for reasoning models + example: + effort: medium + summary: concise + response_format: + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJSONObject' + - $ref: '#/components/schemas/ResponseFormatJSONSchema' + - $ref: '#/components/schemas/ResponseFormatTextGrammar' + - $ref: '#/components/schemas/ResponseFormatTextPython' + discriminator: + propertyName: type + description: Response format configuration + example: + type: json_object + seed: + type: integer + nullable: true + description: Random seed for deterministic outputs + example: 42 + stop: + anyOf: + - type: string + - type: array + items: + type: string + maxItems: 4 + - nullable: true + description: Stop sequences (up to 4) + example: + - "" + stream: + type: boolean + default: false + description: Enable streaming response + example: false + stream_options: + $ref: '#/components/schemas/ChatStreamOptions' + temperature: + type: number + nullable: true + minimum: 0 + maximum: 2 + default: 1 + description: Sampling temperature (0-2) + example: 0.7 + parallel_tool_calls: + type: boolean + nullable: true + tool_choice: + $ref: '#/components/schemas/ToolChoiceOption' + tools: + type: array + items: + $ref: '#/components/schemas/ToolDefinitionJson' + description: Available tools for function calling + example: + - type: function + function: + name: get_weather + description: Get weather + top_p: + type: number + nullable: true + minimum: 0 + maximum: 1 + default: 1 + description: Nucleus sampling parameter (0-1) + example: 1 + debug: + $ref: '#/components/schemas/DebugOptions' + image_config: + type: object + additionalProperties: + anyOf: + - type: string + - type: number + - type: array + items: + nullable: true + description: >- + Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. + example: + aspect_ratio: '16:9' + modalities: + type: array + items: + type: string + enum: + - text + - image + x-speakeasy-unknown-values: allow + description: Output modalities for the response. Supported values are "text" and "image". + example: + - text + - image + required: + - messages + description: Chat completion request parameters + example: + messages: + - role: system + content: You are a helpful assistant. + - role: user + content: What is the capital of France? + model: openai/gpt-4 + temperature: 0.7 + max_tokens: 150 CreateChargeRequest: type: object properties: @@ -7517,7 +9158,6 @@ components: required: - prompt - completion - additionalProperties: false description: Pricing information for the model example: prompt: '0.00003' @@ -8031,7 +9671,6 @@ components: required: - prompt - completion - additionalProperties: false provider_name: $ref: '#/components/schemas/ProviderName' tag: @@ -8226,1255 +9865,6 @@ components: p75: 38.5 p90: 28.3 p99: 15.1 - __schema0: - anyOf: - - type: object - properties: - allow_fallbacks: - description: > - 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. - - $ref: '#/components/schemas/__schema1' - require_parameters: - description: >- - 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. - $ref: '#/components/schemas/__schema1' - data_collection: - description: >- - 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. - $ref: '#/components/schemas/__schema3' - zdr: - anyOf: - - type: boolean - - type: 'null' - enforce_distillable_text: - anyOf: - - type: boolean - - type: 'null' - order: - description: >- - 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. - $ref: '#/components/schemas/__schema4' - only: - description: >- - List of provider slugs to allow. If provided, this list is merged with your account-wide allowed provider settings for this request. - $ref: '#/components/schemas/__schema4' - ignore: - description: >- - List of provider slugs to ignore. If provided, this list is merged with your account-wide ignored provider settings for this request. - $ref: '#/components/schemas/__schema4' - quantizations: - description: A list of quantization levels to filter the provider by. - $ref: '#/components/schemas/__schema8' - sort: - description: >- - The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. - $ref: '#/components/schemas/__schema9' - max_price: - description: >- - The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion. - $ref: '#/components/schemas/__schema10' - preferred_min_throughput: - description: >- - Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. - $ref: '#/components/schemas/__schema15' - preferred_max_latency: - description: >- - Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. - $ref: '#/components/schemas/__schema15' - additionalProperties: false - - type: 'null' - __schema1: - anyOf: - - type: boolean - - type: 'null' - __schema3: - anyOf: - - type: string - enum: - - deny - - allow - x-speakeasy-unknown-values: allow - - type: 'null' - __schema4: - anyOf: - - $ref: '#/components/schemas/__schema5' - - type: 'null' - __schema5: - type: array - items: - anyOf: - - type: string - enum: - - AI21 - - AionLabs - - Alibaba - - Ambient - - Amazon Bedrock - - Amazon Nova - - Anthropic - - Arcee AI - - AtlasCloud - - Avian - - Azure - - BaseTen - - BytePlus - - Black Forest Labs - - Cerebras - - Chutes - - Cirrascale - - Clarifai - - Cloudflare - - Cohere - - Crusoe - - DeepInfra - - DeepSeek - - Featherless - - Fireworks - - Friendli - - GMICloud - - Google - - Google AI Studio - - Groq - - Hyperbolic - - Inception - - Inceptron - - InferenceNet - - Infermatic - - Inflection - - Liquid - - Mara - - Mancer 2 - - Minimax - - ModelRun - - Mistral - - Modular - - Moonshot AI - - Morph - - NCompass - - Nebius - - NextBit - - Novita - - Nvidia - - OpenAI - - OpenInference - - Parasail - - Perplexity - - Phala - - Relace - - SambaNova - - Seed - - SiliconFlow - - Sourceful - - StepFun - - Stealth - - StreamLake - - Switchpoint - - Together - - Upstage - - Venice - - WandB - - Xiaomi - - xAI - - Z.AI - - FakeProvider - x-speakeasy-unknown-values: allow - - type: string - __schema8: - anyOf: - - type: array - items: - type: string - enum: - - int4 - - int8 - - fp4 - - fp6 - - fp8 - - fp16 - - bf16 - - fp32 - - unknown - x-speakeasy-unknown-values: allow - - type: 'null' - __schema9: - anyOf: - - $ref: '#/components/schemas/ProviderSortUnion' - - type: 'null' - __schema10: - type: object - properties: - prompt: - anyOf: - - $ref: '#/components/schemas/__schema11' - - $ref: '#/components/schemas/ModelName' - - $ref: '#/components/schemas/__schema13' - completion: - anyOf: - - $ref: '#/components/schemas/__schema11' - - $ref: '#/components/schemas/ModelName' - - $ref: '#/components/schemas/__schema13' - image: - $ref: '#/components/schemas/__schema14' - audio: - $ref: '#/components/schemas/__schema14' - request: - $ref: '#/components/schemas/__schema14' - __schema11: - type: number - __schema13: {} - __schema14: - anyOf: - - $ref: '#/components/schemas/__schema11' - - $ref: '#/components/schemas/ModelName' - - $ref: '#/components/schemas/__schema13' - __schema15: - anyOf: - - anyOf: - - type: number - - type: object - properties: - p50: - anyOf: - - type: number - - type: 'null' - p75: - anyOf: - - type: number - - type: 'null' - p90: - anyOf: - - type: number - - type: 'null' - p99: - anyOf: - - type: number - - type: 'null' - - type: 'null' - __schema17: - type: array - items: - oneOf: - - type: object - properties: - id: - type: string - const: auto-router - enabled: - type: boolean - allowed_models: - type: array - items: - type: string - required: - - id - - type: object - properties: - id: - type: string - const: moderation - required: - - id - - type: object - properties: - id: - type: string - const: web - enabled: - type: boolean - max_results: - type: number - search_prompt: - type: string - engine: - type: string - enum: - - native - - exa - x-speakeasy-unknown-values: allow - required: - - id - - type: object - properties: - id: - type: string - const: file-parser - enabled: - type: boolean - pdf: - type: object - properties: - engine: - type: string - enum: - - mistral-ocr - - pdf-text - - native - x-speakeasy-unknown-values: allow - required: - - id - - type: object - properties: - id: - type: string - const: response-healing - enabled: - type: boolean - required: - - id - type: object - __schema18: - type: string - maxLength: 128 - __schema19: - oneOf: - - type: object - properties: - type: - type: string - const: reasoning.summary - summary: - type: string - id: - $ref: '#/components/schemas/__schema20' - format: - $ref: '#/components/schemas/__schema21' - index: - $ref: '#/components/schemas/__schema11' - required: - - type - - summary - - type: object - properties: - type: - type: string - const: reasoning.encrypted - data: - type: string - id: - $ref: '#/components/schemas/__schema20' - format: - $ref: '#/components/schemas/__schema21' - index: - $ref: '#/components/schemas/__schema11' - required: - - type - - data - - type: object - properties: - type: - type: string - const: reasoning.text - text: - anyOf: - - type: string - - type: 'null' - signature: - anyOf: - - type: string - - type: 'null' - id: - $ref: '#/components/schemas/__schema20' - format: - $ref: '#/components/schemas/__schema21' - index: - $ref: '#/components/schemas/__schema11' - required: - - type - type: object - __schema20: - anyOf: - - type: string - - type: 'null' - __schema21: - anyOf: - - type: string - enum: - - unknown - - openai-responses-v1 - - azure-openai-responses-v1 - - xai-responses-v1 - - anthropic-claude-v1 - - google-gemini-v1 - x-speakeasy-unknown-values: allow - - type: 'null' - __schema25: - anyOf: - - $ref: '#/components/schemas/ChatCompletionFinishReason' - - type: 'null' - ModelName: - type: string - ChatMessageContentItemText: - type: object - properties: - type: - type: string - const: text - text: - type: string - cache_control: - $ref: '#/components/schemas/ChatMessageContentItemCacheControl' - required: - - type - - text - ChatMessageContentItemImage: - type: object - properties: - type: - type: string - const: image_url - image_url: - type: object - properties: - url: - type: string - detail: - type: string - enum: - - auto - - low - - high - x-speakeasy-unknown-values: allow - required: - - url - required: - - type - - image_url - ChatMessageContentItemAudio: - type: object - properties: - type: - type: string - const: input_audio - input_audio: - type: object - properties: - data: - type: string - format: - type: string - required: - - data - - format - required: - - type - - input_audio - ChatMessageContentItemVideo: - oneOf: - - type: object - properties: - type: - type: string - const: input_video - video_url: - type: object - properties: - url: - type: string - required: - - url - required: - - type - - video_url - - type: object - properties: - type: - type: string - const: video_url - video_url: - type: object - properties: - url: - type: string - required: - - url - required: - - type - - video_url - type: object - ChatMessageContentItem: - oneOf: - - $ref: '#/components/schemas/ChatMessageContentItemText' - - $ref: '#/components/schemas/ChatMessageContentItemImage' - - $ref: '#/components/schemas/ChatMessageContentItemAudio' - - $ref: '#/components/schemas/ChatMessageContentItemVideo' - type: object - discriminator: - propertyName: type - mapping: - text: '#/components/schemas/ChatMessageContentItemText' - image_url: '#/components/schemas/ChatMessageContentItemImage' - input_audio: '#/components/schemas/ChatMessageContentItemAudio' - input_video: '#/components/schemas/ChatMessageContentItemVideo' - video_url: '#/components/schemas/ChatMessageContentItemVideo' - ChatMessageToolCall: - type: object - properties: - id: - type: string - type: - type: string - const: function - function: - type: object - properties: - name: - type: string - arguments: - type: string - required: - - name - - arguments - required: - - id - - type - - function - ChatMessageTokenLogprob: - type: object - properties: - token: - type: string - logprob: - type: number - bytes: - anyOf: - - type: array - items: - type: number - - type: 'null' - top_logprobs: - type: array - items: - type: object - properties: - token: - type: string - logprob: - type: number - bytes: - anyOf: - - type: array - items: - type: number - - type: 'null' - required: - - token - - logprob - - bytes - required: - - token - - logprob - - bytes - - top_logprobs - ChatMessageTokenLogprobs: - type: object - properties: - content: - anyOf: - - type: array - items: - $ref: '#/components/schemas/ChatMessageTokenLogprob' - - type: 'null' - refusal: - anyOf: - - type: array - items: - $ref: '#/components/schemas/ChatMessageTokenLogprob' - - type: 'null' - required: - - content - - refusal - ChatGenerationTokenUsage: - type: object - properties: - completion_tokens: - type: number - prompt_tokens: - type: number - total_tokens: - type: number - completion_tokens_details: - anyOf: - - type: object - properties: - reasoning_tokens: - anyOf: - - type: number - - type: 'null' - audio_tokens: - anyOf: - - type: number - - type: 'null' - accepted_prediction_tokens: - anyOf: - - type: number - - type: 'null' - rejected_prediction_tokens: - anyOf: - - type: number - - type: 'null' - - type: 'null' - prompt_tokens_details: - anyOf: - - type: object - properties: - cached_tokens: - type: number - cache_write_tokens: - type: number - audio_tokens: - type: number - video_tokens: - type: number - - type: 'null' - required: - - completion_tokens - - prompt_tokens - - total_tokens - ChatCompletionFinishReason: - type: string - enum: - - tool_calls - - stop - - length - - content_filter - - error - x-speakeasy-unknown-values: allow - JSONSchemaConfig: - type: object - properties: - name: - type: string - maxLength: 64 - description: - type: string - schema: - type: object - propertyNames: - type: string - additionalProperties: {} - strict: - anyOf: - - type: boolean - - type: 'null' - required: - - name - ResponseFormatJSONSchema: - type: object - properties: - type: - type: string - const: json_schema - json_schema: - $ref: '#/components/schemas/JSONSchemaConfig' - required: - - type - - json_schema - ResponseFormatTextGrammar: - type: object - properties: - type: - type: string - const: grammar - grammar: - type: string - required: - - type - - grammar - ChatMessageContentItemCacheControl: - type: object - properties: - type: - type: string - const: ephemeral - ttl: - type: string - enum: - - 5m - - 1h - x-speakeasy-unknown-values: allow - required: - - type - SystemMessage: - type: object - properties: - role: - type: string - const: system - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItemText' - name: - type: string - required: - - role - - content - UserMessage: - type: object - properties: - role: - type: string - const: user - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItem' - name: - type: string - required: - - role - - content - DeveloperMessage: - type: object - properties: - role: - type: string - const: developer - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItemText' - name: - type: string - required: - - role - - content - AssistantMessage: - type: object - properties: - role: - type: string - const: assistant - content: - anyOf: - - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItem' - - type: 'null' - name: - type: string - tool_calls: - type: array - items: - $ref: '#/components/schemas/ChatMessageToolCall' - refusal: - anyOf: - - type: string - - type: 'null' - reasoning: - anyOf: - - type: string - - type: 'null' - reasoning_details: - type: array - items: - $ref: '#/components/schemas/__schema19' - images: - type: array - items: - type: object - properties: - image_url: - type: object - properties: - url: - type: string - required: - - url - required: - - image_url - required: - - role - ToolResponseMessage: - type: object - properties: - role: - type: string - const: tool - content: - anyOf: - - type: string - - type: array - items: - $ref: '#/components/schemas/ChatMessageContentItem' - tool_call_id: - type: string - required: - - role - - content - - tool_call_id - Message: - oneOf: - - $ref: '#/components/schemas/SystemMessage' - - $ref: '#/components/schemas/UserMessage' - - $ref: '#/components/schemas/DeveloperMessage' - - $ref: '#/components/schemas/AssistantMessage' - - $ref: '#/components/schemas/ToolResponseMessage' - type: object - discriminator: - propertyName: role - mapping: - system: '#/components/schemas/SystemMessage' - user: '#/components/schemas/UserMessage' - developer: '#/components/schemas/DeveloperMessage' - assistant: '#/components/schemas/AssistantMessage' - tool: '#/components/schemas/ToolResponseMessage' - ToolDefinitionJson: - type: object - properties: - type: - type: string - const: function - function: - type: object - properties: - name: - type: string - maxLength: 64 - description: - type: string - parameters: - type: object - propertyNames: - type: string - additionalProperties: {} - strict: - anyOf: - - type: boolean - - type: 'null' - required: - - name - required: - - type - - function - NamedToolChoice: - type: object - properties: - type: - type: string - const: function - function: - type: object - properties: - name: - type: string - required: - - name - required: - - type - - function - ToolChoiceOption: - anyOf: - - type: string - const: none - - type: string - const: auto - - type: string - const: required - - $ref: '#/components/schemas/NamedToolChoice' - ChatStreamOptions: - type: object - properties: - include_usage: - type: boolean - ChatGenerationParams: - type: object - properties: - provider: - description: When multiple model providers are available, optionally indicate your routing preference. - $ref: '#/components/schemas/__schema0' - plugins: - description: Plugins you want to enable for this request, including their settings. - $ref: '#/components/schemas/__schema17' - route: - anyOf: - - type: string - enum: - - fallback - - sort - x-speakeasy-unknown-values: allow - - type: 'null' - user: - type: string - session_id: - description: >- - A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. - $ref: '#/components/schemas/__schema18' - messages: - minItems: 1 - type: array - items: - $ref: '#/components/schemas/Message' - model: - $ref: '#/components/schemas/ModelName' - models: - type: array - items: - $ref: '#/components/schemas/ModelName' - frequency_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - logit_bias: - anyOf: - - type: object - propertyNames: - type: string - additionalProperties: - type: number - - type: 'null' - logprobs: - anyOf: - - type: boolean - - type: 'null' - top_logprobs: - anyOf: - - type: number - minimum: 0 - maximum: 20 - - type: 'null' - max_completion_tokens: - anyOf: - - type: number - minimum: 1 - - type: 'null' - max_tokens: - anyOf: - - type: number - minimum: 1 - - type: 'null' - metadata: - type: object - propertyNames: - type: string - additionalProperties: - type: string - presence_penalty: - anyOf: - - type: number - minimum: -2 - maximum: 2 - - type: 'null' - reasoning: - type: object - properties: - effort: - anyOf: - - type: string - enum: - - xhigh - - high - - medium - - low - - minimal - - none - x-speakeasy-unknown-values: allow - - type: 'null' - summary: - anyOf: - - $ref: '#/components/schemas/ReasoningSummaryVerbosity' - - type: 'null' - response_format: - oneOf: - - type: object - properties: - type: - type: string - const: text - required: - - type - - type: object - properties: - type: - type: string - const: json_object - required: - - type - - $ref: '#/components/schemas/ResponseFormatJSONSchema' - - $ref: '#/components/schemas/ResponseFormatTextGrammar' - - type: object - properties: - type: - type: string - const: python - required: - - type - type: object - seed: - anyOf: - - type: integer - minimum: -9007199254740991 - maximum: 9007199254740991 - - type: 'null' - stop: - anyOf: - - anyOf: - - type: string - - maxItems: 4 - type: array - items: - $ref: '#/components/schemas/ModelName' - - type: 'null' - stream: - default: false - type: boolean - stream_options: - anyOf: - - $ref: '#/components/schemas/ChatStreamOptions' - - type: 'null' - temperature: - default: 1 - anyOf: - - type: number - minimum: 0 - maximum: 2 - - type: 'null' - tool_choice: - $ref: '#/components/schemas/ToolChoiceOption' - tools: - type: array - items: - $ref: '#/components/schemas/ToolDefinitionJson' - top_p: - default: 1 - anyOf: - - type: number - minimum: 0 - maximum: 1 - - type: 'null' - debug: - type: object - properties: - echo_upstream_body: - type: boolean - image_config: - type: object - propertyNames: - type: string - additionalProperties: - anyOf: - - type: string - - type: number - - type: array - items: {} - modalities: - type: array - items: - type: string - enum: - - text - - image - x-speakeasy-unknown-values: allow - required: - - messages - ProviderSortUnion: - anyOf: - - $ref: '#/components/schemas/ProviderSort' - - $ref: '#/components/schemas/ProviderSortConfig' - ChatResponseChoice: - type: object - properties: - finish_reason: - $ref: '#/components/schemas/__schema25' - index: - type: number - message: - $ref: '#/components/schemas/AssistantMessage' - logprobs: - anyOf: - - $ref: '#/components/schemas/ChatMessageTokenLogprobs' - - type: 'null' - required: - - finish_reason - - index - - message - ChatStreamingMessageToolCall: - type: object - properties: - index: - type: number - id: - type: string - type: - type: string - const: function - function: - type: object - properties: - name: - type: string - arguments: - type: string - required: - - index - ChatStreamingMessageChunk: - type: object - properties: - role: - type: string - enum: - - assistant - content: - anyOf: - - type: string - - type: 'null' - reasoning: - anyOf: - - type: string - - type: 'null' - refusal: - anyOf: - - type: string - - type: 'null' - tool_calls: - type: array - items: - $ref: '#/components/schemas/ChatStreamingMessageToolCall' - reasoning_details: - type: array - items: - $ref: '#/components/schemas/__schema19' - ChatStreamingChoice: - type: object - properties: - delta: - $ref: '#/components/schemas/ChatStreamingMessageChunk' - finish_reason: - $ref: '#/components/schemas/__schema25' - index: - type: number - logprobs: - anyOf: - - $ref: '#/components/schemas/ChatMessageTokenLogprobs' - - type: 'null' - required: - - delta - - finish_reason - - index - ChatError: - type: object - properties: - error: - type: object - properties: - code: - anyOf: - - anyOf: - - type: string - - type: number - - type: 'null' - message: - type: string - param: - anyOf: - - type: string - - type: 'null' - type: - anyOf: - - type: string - - type: 'null' - required: - - code - - message - additionalProperties: false - required: - - error - additionalProperties: false - ChatResponse: - type: object - properties: - id: - type: string - choices: - type: array - items: - $ref: '#/components/schemas/ChatResponseChoice' - created: - type: number - model: - type: string - object: - type: string - const: chat.completion - system_fingerprint: - anyOf: - - type: string - - type: 'null' - usage: - $ref: '#/components/schemas/ChatGenerationTokenUsage' - required: - - id - - choices - - created - - model - - object - additionalProperties: false - ChatStreamingResponseChunk: - type: object - properties: - data: - type: object - properties: - id: - type: string - choices: - type: array - items: - $ref: '#/components/schemas/ChatStreamingChoice' - created: - type: number - model: - type: string - object: - type: string - const: chat.completion.chunk - system_fingerprint: - anyOf: - - type: string - - type: 'null' - error: - type: object - properties: - message: - type: string - code: - type: number - required: - - message - - code - additionalProperties: false - usage: - $ref: '#/components/schemas/ChatGenerationTokenUsage' - required: - - id - - choices - - created - - model - - object - additionalProperties: false - required: - - data - additionalProperties: false parameters: {AppIdentifier: {name: HTTP-Referer, in: header, schema: {type: string}, description: "The app identifier should be your app's URL and is used as the primary identifier for rankings.\nThis is used to track API usage per application.\n"}, AppDisplayName: {name: X-Title, in: header, schema: {type: string}, description: "The app display name allows you to customize how your app appears in OpenRouter's dashboard.\n"}} securitySchemes: apiKey: @@ -9901,6 +10291,120 @@ paths: parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" + /chat/completions: + post: + x-speakeasy-group: chat + x-speakeasy-name-override: send + x-speakeasy-stream-request-field: stream + tags: + - Chat + summary: Create a chat completion + operationId: sendChatCompletionRequest + description: >- + Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChatGenerationParams' + required: true + responses: + '200': + description: Successful chat completion response + content: + application/json: + schema: + $ref: '#/components/schemas/ChatResponse' + text/event-stream: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/ChatStreamingResponseChunk' + required: + - data + x-speakeasy-sse-sentinel: '[DONE]' + '400': + description: Bad Request - Invalid request parameters or malformed input + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestResponse' + '401': + description: Unauthorized - Authentication required or invalid credentials + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + '402': + description: Payment Required - Insufficient credits or quota to complete request + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentRequiredResponse' + '404': + description: Not Found - Resource does not exist + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundResponse' + '408': + description: Request Timeout - Operation exceeded time limit + content: + application/json: + schema: + $ref: '#/components/schemas/RequestTimeoutResponse' + '413': + description: Payload Too Large - Request payload exceeds size limits + content: + application/json: + schema: + $ref: '#/components/schemas/PayloadTooLargeResponse' + '422': + description: Unprocessable Entity - Semantic validation failure + content: + application/json: + schema: + $ref: '#/components/schemas/UnprocessableEntityResponse' + '429': + description: Too Many Requests - Rate limit exceeded + content: + application/json: + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + '500': + description: Internal Server Error - Unexpected server error + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerResponse' + '502': + description: Bad Gateway - Provider/upstream API failure + content: + application/json: + schema: + $ref: '#/components/schemas/BadGatewayResponse' + '503': + description: Service Unavailable - Service temporarily unavailable + content: + application/json: + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + '524': + description: Infrastructure Timeout - Request timed out at our edge network + content: + application/json: + schema: + $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + '529': + description: Provider Overloaded - Provider is temporarily overloaded + content: + application/json: + schema: + $ref: '#/components/schemas/ProviderOverloadedResponse' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" /credits: get: x-speakeasy-name-override: getCredits @@ -10586,7 +11090,9 @@ paths: - Inception - Inceptron - InferenceNet + - Ionstream - Infermatic + - Io Net - Inflection - Liquid - Mara @@ -13775,6 +14281,30 @@ paths: nullable: true format: date-time description: Optional expiration time for the API key to be created + key_label: + type: string + maxLength: 100 + description: Optional custom label for the API key. Defaults to the app name if not provided. + example: My Custom Key + usage_limit_type: + type: string + enum: + - daily + - weekly + - monthly + description: Optional credit limit reset interval. When set, the credit limit resets on this interval. + example: monthly + x-speakeasy-unknown-values: allow + spawn_agent: + type: string + description: Agent identifier for spawn telemetry + x-speakeasy-ignore: true + x-fern-ignore: true + spawn_cloud: + type: string + description: Cloud identifier for spawn telemetry + x-speakeasy-ignore: true + x-fern-ignore: true required: - callback_url example: @@ -13839,72 +14369,6 @@ paths: parameters: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - /chat/completions: - post: - summary: Create a chat completion - operationId: sendChatCompletionRequest - x-speakeasy-group: chat - x-speakeasy-name-override: send - x-speakeasy-stream-request-field: stream - description: >- - Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. - tags: - - Chat - requestBody: - required: true - description: Chat completion request parameters - content: - application/json: - schema: - $ref: '#/components/schemas/ChatGenerationParams' - responses: - '200': - description: Successful chat completion response - content: - application/json: - schema: - $ref: '#/components/schemas/ChatResponse' - description: Chat completion response - text/event-stream: - x-speakeasy-sse-sentinel: '[DONE]' - schema: - $ref: '#/components/schemas/ChatStreamingResponseChunk' - '400': - description: Bad request - invalid parameters - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '401': - description: Unauthorized - invalid API key - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '429': - description: Too many requests - rate limit exceeded - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ChatError' - parameters: - - $ref: "#/components/parameters/AppIdentifier" - - $ref: "#/components/parameters/AppDisplayName" -servers: - - url: https://openrouter.ai/api/v1 - description: Production server - x-speakeasy-server-id: production -security: - - apiKey: [] -externalDocs: - description: OpenRouter Documentation - url: https://openrouter.ai/docs tags: - name: API Keys description: API key management endpoints diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index f0f9a9f..5d22d6c 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -8,8 +8,8 @@ sources: - latest OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:2dbe784978f60cb53a0d081e1b5f4cbb42ca86b1ff8f4361869fa78c42e042ee - sourceBlobDigest: sha256:851aadf3180735f9dbfdb2904011de231d3805d187499c24a450a224cacf1ed2 + sourceRevisionDigest: sha256:8a64fb1c1030c87db14bca3af4883e06b9d5853c153a5fd0f2e4c15166e034dd + sourceBlobDigest: sha256:7f6d7d20424f27ec13e6ae45a1599dab23f2573a69d634b1bb1c346f8a328ae9 tags: - latest - main @@ -18,10 +18,10 @@ targets: open-router: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:2dbe784978f60cb53a0d081e1b5f4cbb42ca86b1ff8f4361869fa78c42e042ee - sourceBlobDigest: sha256:851aadf3180735f9dbfdb2904011de231d3805d187499c24a450a224cacf1ed2 + sourceRevisionDigest: sha256:8a64fb1c1030c87db14bca3af4883e06b9d5853c153a5fd0f2e4c15166e034dd + sourceBlobDigest: sha256:7f6d7d20424f27ec13e6ae45a1599dab23f2573a69d634b1bb1c346f8a328ae9 codeSamplesNamespace: open-router-python-code-samples - codeSamplesRevisionDigest: sha256:cf9f3fd9983864e3c5dd5bc3fa9198efc9493f4fbc671130e8f07e87722c43dd + codeSamplesRevisionDigest: sha256:349390cb3f04fb4fdd6292a33ff1ee0659846fe1e3f03bede5bf13f3e70c447f workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.666.0 diff --git a/README-PYPI.md b/README-PYPI.md index a15ae66..8dd9349 100644 --- a/README-PYPI.md +++ b/README-PYPI.md @@ -182,6 +182,8 @@ import os def main(): with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: # Rest of application here... @@ -191,6 +193,8 @@ def main(): async def amain(): async with OpenRouter( + http_referer="", + x_title="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: # Rest of application here... diff --git a/docs/components/assistantmessage.md b/docs/components/assistantmessage.md index 127aee3..49cee5c 100644 --- a/docs/components/assistantmessage.md +++ b/docs/components/assistantmessage.md @@ -1,15 +1,17 @@ # AssistantMessage +Assistant message for requests and responses + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `role` | *Literal["assistant"]* | :heavy_check_mark: | N/A | -| `content` | [OptionalNullable[components.AssistantMessageContent]](../components/assistantmessagecontent.md) | :heavy_minus_sign: | N/A | -| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | N/A | -| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A | -| `images` | List[[components.Image](../components/image.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `role` | [components.AssistantMessageRole](../components/assistantmessagerole.md) | :heavy_check_mark: | N/A | | +| `content` | [OptionalNullable[components.AssistantMessageContent]](../components/assistantmessagecontent.md) | :heavy_minus_sign: | Assistant message content | | +| `name` | *Optional[str]* | :heavy_minus_sign: | Optional name for the assistant | | +| `tool_calls` | List[[components.ChatMessageToolCall](../components/chatmessagetoolcall.md)] | :heavy_minus_sign: | Tool calls made by the assistant | | +| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | Refusal message if content was refused | | +| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | Reasoning output | | +| `reasoning_details` | List[[components.ReasoningDetailUnion](../components/reasoningdetailunion.md)] | :heavy_minus_sign: | Reasoning details for extended thinking models | | +| `images` | List[[components.AssistantMessageImages](../components/assistantmessageimages.md)] | :heavy_minus_sign: | Generated images from image generation models | [
{
"image_url": {
"url": "data:image/png;base64,iVBORw0KGgo..."
}
}
] | \ No newline at end of file diff --git a/docs/components/assistantmessagecontent.md b/docs/components/assistantmessagecontent.md index c264f5e..643e44e 100644 --- a/docs/components/assistantmessagecontent.md +++ b/docs/components/assistantmessagecontent.md @@ -1,5 +1,7 @@ # AssistantMessageContent +Assistant message content + ## Supported Types @@ -15,3 +17,9 @@ value: str = /* values here */ value: List[components.ChatMessageContentItem] = /* values here */ ``` +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/components/assistantmessageimages.md b/docs/components/assistantmessageimages.md new file mode 100644 index 0000000..aae33ff --- /dev/null +++ b/docs/components/assistantmessageimages.md @@ -0,0 +1,8 @@ +# AssistantMessageImages + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `image_url` | [components.AssistantMessageImagesImageURL](../components/assistantmessageimagesimageurl.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/assistantmessageimagesimageurl.md b/docs/components/assistantmessageimagesimageurl.md new file mode 100644 index 0000000..7826122 --- /dev/null +++ b/docs/components/assistantmessageimagesimageurl.md @@ -0,0 +1,8 @@ +# AssistantMessageImagesImageURL + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| `url` | *str* | :heavy_check_mark: | URL or base64-encoded data of the generated image | \ No newline at end of file diff --git a/docs/components/assistantmessageimageurl.md b/docs/components/assistantmessageimageurl.md deleted file mode 100644 index 1067d52..0000000 --- a/docs/components/assistantmessageimageurl.md +++ /dev/null @@ -1,8 +0,0 @@ -# AssistantMessageImageURL - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `url` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/assistantmessagerole.md b/docs/components/assistantmessagerole.md new file mode 100644 index 0000000..658229e --- /dev/null +++ b/docs/components/assistantmessagerole.md @@ -0,0 +1,8 @@ +# AssistantMessageRole + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `ASSISTANT` | assistant | \ No newline at end of file diff --git a/docs/components/by.md b/docs/components/by.md new file mode 100644 index 0000000..87730c5 --- /dev/null +++ b/docs/components/by.md @@ -0,0 +1,12 @@ +# By + +The provider sorting strategy (price, throughput, latency) + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/components/chaterrorerror.md b/docs/components/chaterrorerror.md deleted file mode 100644 index 42b0086..0000000 --- a/docs/components/chaterrorerror.md +++ /dev/null @@ -1,11 +0,0 @@ -# ChatErrorError - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `code` | [Nullable[components.Code]](../components/code.md) | :heavy_check_mark: | N/A | -| `message` | *str* | :heavy_check_mark: | N/A | -| `param` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `type` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparams.md b/docs/components/chatgenerationparams.md index 577c2ab..871f7ac 100644 --- a/docs/components/chatgenerationparams.md +++ b/docs/components/chatgenerationparams.md @@ -1,36 +1,39 @@ # ChatGenerationParams +Chat completion request parameters + ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -| `provider` | [OptionalNullable[components.Schema0]](../components/schema0.md) | :heavy_minus_sign: | N/A | -| `plugins` | List[[components.Schema17](../components/schema17.md)] | :heavy_minus_sign: | N/A | -| `route` | [OptionalNullable[components.Route]](../components/route.md) | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | N/A | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | N/A | -| `response_format` | [Optional[components.ResponseFormat]](../components/responseformat.md) | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.Stop]](../components/stop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `debug` | [Optional[components.Debug]](../components/debug.md) | :heavy_minus_sign: | N/A | -| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | -| `modalities` | List[[components.Modality](../components/modality.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | user-123 | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | +| `trace` | [Optional[components.ChatGenerationParamsTrace]](../components/chatgenerationparamstrace.md) | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | | +| `messages` | List[[components.Message](../components/message.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello!"
}
] | +| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | openai/gpt-4 | +| `models` | List[*str*] | :heavy_minus_sign: | Models to use for completion | [
"openai/gpt-4",
"openai/gpt-4o"
] | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | 0 | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | {
"50256": -100
} | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | false | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | 5 | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | 100 | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | 100 | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | {
"user_id": "user-123",
"session_id": "session-456"
} | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | +| `reasoning` | [Optional[components.Reasoning]](../components/reasoning.md) | :heavy_minus_sign: | Configuration options for reasoning models | {
"effort": "medium",
"summary": "concise"
} | +| `response_format` | [Optional[components.ResponseFormat]](../components/responseformat.md) | :heavy_minus_sign: | Response format configuration | {
"type": "json_object"
} | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | 42 | +| `stop` | [OptionalNullable[components.Stop]](../components/stop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | [
""
] | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | Enable streaming response | false | +| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../components/chatstreamoptions.md) | :heavy_minus_sign: | Streaming configuration options | {
"include_usage": true
} | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | 0.7 | +| `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | +| `tool_choice` | [Optional[components.ToolChoiceOption]](../components/toolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | auto | +| `tools` | List[[components.ToolDefinitionJSON](../components/tooldefinitionjson.md)] | :heavy_minus_sign: | Available tools for function calling | [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather"
}
}
] | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | 1 | +| `debug` | [Optional[components.DebugOptions]](../components/debugoptions.md) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | {
"echo_upstream_body": true
} | +| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | {
"aspect_ratio": "16:9"
} | +| `modalities` | List[[components.Modality](../components/modality.md)] | :heavy_minus_sign: | Output modalities for the response. Supported values are "text" and "image". | [
"text",
"image"
] | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsby.md b/docs/components/chatgenerationparamsby.md new file mode 100644 index 0000000..6952f17 --- /dev/null +++ b/docs/components/chatgenerationparamsby.md @@ -0,0 +1,12 @@ +# ChatGenerationParamsBy + +The provider sorting strategy (price, throughput, latency) + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/components/idautorouter.md b/docs/components/chatgenerationparamsidautorouter.md similarity index 76% rename from docs/components/idautorouter.md rename to docs/components/chatgenerationparamsidautorouter.md index 43f83e5..d5616f3 100644 --- a/docs/components/idautorouter.md +++ b/docs/components/chatgenerationparamsidautorouter.md @@ -1,4 +1,4 @@ -# IDAutoRouter +# ChatGenerationParamsIDAutoRouter ## Values diff --git a/docs/components/idfileparser.md b/docs/components/chatgenerationparamsidfileparser.md similarity index 76% rename from docs/components/idfileparser.md rename to docs/components/chatgenerationparamsidfileparser.md index 1a27fa0..432efba 100644 --- a/docs/components/idfileparser.md +++ b/docs/components/chatgenerationparamsidfileparser.md @@ -1,4 +1,4 @@ -# IDFileParser +# ChatGenerationParamsIDFileParser ## Values diff --git a/docs/components/idmoderation.md b/docs/components/chatgenerationparamsidmoderation.md similarity index 75% rename from docs/components/idmoderation.md rename to docs/components/chatgenerationparamsidmoderation.md index 2284d6c..60e32d9 100644 --- a/docs/components/idmoderation.md +++ b/docs/components/chatgenerationparamsidmoderation.md @@ -1,4 +1,4 @@ -# IDModeration +# ChatGenerationParamsIDModeration ## Values diff --git a/docs/components/idresponsehealing.md b/docs/components/chatgenerationparamsidresponsehealing.md similarity index 78% rename from docs/components/idresponsehealing.md rename to docs/components/chatgenerationparamsidresponsehealing.md index 4a12790..090054c 100644 --- a/docs/components/idresponsehealing.md +++ b/docs/components/chatgenerationparamsidresponsehealing.md @@ -1,4 +1,4 @@ -# IDResponseHealing +# ChatGenerationParamsIDResponseHealing ## Values diff --git a/docs/components/idweb.md b/docs/components/chatgenerationparamsidweb.md similarity index 70% rename from docs/components/idweb.md rename to docs/components/chatgenerationparamsidweb.md index 8c668e6..3781247 100644 --- a/docs/components/idweb.md +++ b/docs/components/chatgenerationparamsidweb.md @@ -1,4 +1,4 @@ -# IDWeb +# ChatGenerationParamsIDWeb ## Values diff --git a/docs/components/chatgenerationparamsignore.md b/docs/components/chatgenerationparamsignore.md new file mode 100644 index 0000000..9bc172c --- /dev/null +++ b/docs/components/chatgenerationparamsignore.md @@ -0,0 +1,17 @@ +# ChatGenerationParamsIgnore + + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamsimageconfig.md b/docs/components/chatgenerationparamsimageconfig.md index d5a692a..2e011da 100644 --- a/docs/components/chatgenerationparamsimageconfig.md +++ b/docs/components/chatgenerationparamsimageconfig.md @@ -15,9 +15,9 @@ value: str = /* values here */ value: float = /* values here */ ``` -### `List[Any]` +### `List[Nullable[Any]]` ```python -value: List[Any] = /* values here */ +value: List[Nullable[Any]] = /* values here */ ``` diff --git a/docs/components/chatgenerationparamsmaxprice.md b/docs/components/chatgenerationparamsmaxprice.md new file mode 100644 index 0000000..ee97c1d --- /dev/null +++ b/docs/components/chatgenerationparamsmaxprice.md @@ -0,0 +1,14 @@ +# ChatGenerationParamsMaxPrice + +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 | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `prompt` | *Optional[str]* | :heavy_minus_sign: | Price per million prompt tokens | 1000 | +| `completion` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `image` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `audio` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | +| `request` | *Optional[str]* | :heavy_minus_sign: | N/A | 1000 | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsonly.md b/docs/components/chatgenerationparamsonly.md new file mode 100644 index 0000000..f83c12d --- /dev/null +++ b/docs/components/chatgenerationparamsonly.md @@ -0,0 +1,17 @@ +# ChatGenerationParamsOnly + + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamsorder.md b/docs/components/chatgenerationparamsorder.md new file mode 100644 index 0000000..c6c1a91 --- /dev/null +++ b/docs/components/chatgenerationparamsorder.md @@ -0,0 +1,17 @@ +# ChatGenerationParamsOrder + + +## Supported Types + +### `components.ProviderName` + +```python +value: components.ProviderName = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamspartition.md b/docs/components/chatgenerationparamspartition.md new file mode 100644 index 0000000..3897f82 --- /dev/null +++ b/docs/components/chatgenerationparamspartition.md @@ -0,0 +1,11 @@ +# ChatGenerationParamsPartition + +Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model. + + +## Values + +| Name | Value | +| ------- | ------- | +| `MODEL` | model | +| `NONE` | none | \ No newline at end of file diff --git a/docs/components/pluginautorouter.md b/docs/components/chatgenerationparamspluginautorouter.md similarity index 96% rename from docs/components/pluginautorouter.md rename to docs/components/chatgenerationparamspluginautorouter.md index 917f1cc..d9f2cf0 100644 --- a/docs/components/pluginautorouter.md +++ b/docs/components/chatgenerationparamspluginautorouter.md @@ -1,10 +1,10 @@ -# PluginAutoRouter +# ChatGenerationParamsPluginAutoRouter ## Fields | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `id` | [components.IDAutoRouter](../components/idautorouter.md) | :heavy_check_mark: | N/A | | +| `id` | [components.ChatGenerationParamsIDAutoRouter](../components/chatgenerationparamsidautorouter.md) | :heavy_check_mark: | N/A | | | `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the auto-router plugin for this request. Defaults to true. | | | `allowed_models` | List[*str*] | :heavy_minus_sign: | List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list. | [
"anthropic/*",
"openai/gpt-4o",
"google/*"
] | \ No newline at end of file diff --git a/docs/components/chatgenerationparamspluginfileparser.md b/docs/components/chatgenerationparamspluginfileparser.md new file mode 100644 index 0000000..41555fc --- /dev/null +++ b/docs/components/chatgenerationparamspluginfileparser.md @@ -0,0 +1,10 @@ +# ChatGenerationParamsPluginFileParser + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `id` | [components.ChatGenerationParamsIDFileParser](../components/chatgenerationparamsidfileparser.md) | :heavy_check_mark: | N/A | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the file-parser plugin for this request. Defaults to true. | +| `pdf` | [Optional[components.PDFParserOptions]](../components/pdfparseroptions.md) | :heavy_minus_sign: | Options for PDF parsing. | \ No newline at end of file diff --git a/docs/components/chatgenerationparamspluginmoderation.md b/docs/components/chatgenerationparamspluginmoderation.md new file mode 100644 index 0000000..0d697d9 --- /dev/null +++ b/docs/components/chatgenerationparamspluginmoderation.md @@ -0,0 +1,8 @@ +# ChatGenerationParamsPluginModeration + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `id` | [components.ChatGenerationParamsIDModeration](../components/chatgenerationparamsidmoderation.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationparamspluginresponsehealing.md b/docs/components/chatgenerationparamspluginresponsehealing.md new file mode 100644 index 0000000..2d3f32c --- /dev/null +++ b/docs/components/chatgenerationparamspluginresponsehealing.md @@ -0,0 +1,9 @@ +# ChatGenerationParamsPluginResponseHealing + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `id` | [components.ChatGenerationParamsIDResponseHealing](../components/chatgenerationparamsidresponsehealing.md) | :heavy_check_mark: | N/A | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the response-healing plugin for this request. Defaults to true. | \ No newline at end of file diff --git a/docs/components/chatgenerationparamspluginunion.md b/docs/components/chatgenerationparamspluginunion.md new file mode 100644 index 0000000..5457d76 --- /dev/null +++ b/docs/components/chatgenerationparamspluginunion.md @@ -0,0 +1,35 @@ +# ChatGenerationParamsPluginUnion + + +## Supported Types + +### `components.ChatGenerationParamsPluginAutoRouter` + +```python +value: components.ChatGenerationParamsPluginAutoRouter = /* values here */ +``` + +### `components.ChatGenerationParamsPluginModeration` + +```python +value: components.ChatGenerationParamsPluginModeration = /* values here */ +``` + +### `components.ChatGenerationParamsPluginWeb` + +```python +value: components.ChatGenerationParamsPluginWeb = /* values here */ +``` + +### `components.ChatGenerationParamsPluginFileParser` + +```python +value: components.ChatGenerationParamsPluginFileParser = /* values here */ +``` + +### `components.ChatGenerationParamsPluginResponseHealing` + +```python +value: components.ChatGenerationParamsPluginResponseHealing = /* values here */ +``` + diff --git a/docs/components/pluginfileparser.md b/docs/components/chatgenerationparamspluginweb.md similarity index 51% rename from docs/components/pluginfileparser.md rename to docs/components/chatgenerationparamspluginweb.md index c36d2a1..e8c97d0 100644 --- a/docs/components/pluginfileparser.md +++ b/docs/components/chatgenerationparamspluginweb.md @@ -1,10 +1,12 @@ -# PluginFileParser +# ChatGenerationParamsPluginWeb ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `id` | [components.IDFileParser](../components/idfileparser.md) | :heavy_check_mark: | N/A | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the file-parser plugin for this request. Defaults to true. | -| `pdf` | [Optional[components.PDFParserOptions]](../components/pdfparseroptions.md) | :heavy_minus_sign: | Options for PDF parsing. | \ No newline at end of file +| `id` | [components.ChatGenerationParamsIDWeb](../components/chatgenerationparamsidweb.md) | :heavy_check_mark: | N/A | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the web-search plugin for this request. Defaults to true. | +| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `engine` | [Optional[components.WebSearchEngine]](../components/websearchengine.md) | :heavy_minus_sign: | The search engine to use for web search. | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsprovider.md b/docs/components/chatgenerationparamsprovider.md new file mode 100644 index 0000000..bbb47db --- /dev/null +++ b/docs/components/chatgenerationparamsprovider.md @@ -0,0 +1,22 @@ +# ChatGenerationParamsProvider + +When multiple model providers are available, optionally indicate your routing preference. + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `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[components.DataCollection]](../components/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. | allow | +| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used. | true | +| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used. | true | +| `order` | List[[components.ChatGenerationParamsOrder](../components/chatgenerationparamsorder.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[[components.ChatGenerationParamsOnly](../components/chatgenerationparamsonly.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[[components.ChatGenerationParamsIgnore](../components/chatgenerationparamsignore.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[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | +| `sort` | [OptionalNullable[components.ChatGenerationParamsSortUnion]](../components/chatgenerationparamssortunion.md) | :heavy_minus_sign: | N/A | price | +| `max_price` | [Optional[components.ChatGenerationParamsMaxPrice]](../components/chatgenerationparamsmaxprice.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. | | +| `preferred_min_throughput` | [OptionalNullable[components.PreferredMinThroughput]](../components/preferredminthroughput.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 100 | +| `preferred_max_latency` | [OptionalNullable[components.PreferredMaxLatency]](../components/preferredmaxlatency.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 5 | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsprovidersort.md b/docs/components/chatgenerationparamsprovidersort.md new file mode 100644 index 0000000..dad38c3 --- /dev/null +++ b/docs/components/chatgenerationparamsprovidersort.md @@ -0,0 +1,12 @@ +# ChatGenerationParamsProviderSort + +The provider sorting strategy (price, throughput, latency) + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsprovidersortconfig.md b/docs/components/chatgenerationparamsprovidersortconfig.md new file mode 100644 index 0000000..e49cfd1 --- /dev/null +++ b/docs/components/chatgenerationparamsprovidersortconfig.md @@ -0,0 +1,9 @@ +# ChatGenerationParamsProviderSortConfig + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `by` | [OptionalNullable[components.ChatGenerationParamsBy]](../components/chatgenerationparamsby.md) | :heavy_minus_sign: | The provider sorting strategy (price, throughput, latency) | price | +| `partition` | [OptionalNullable[components.ChatGenerationParamsPartition]](../components/chatgenerationparamspartition.md) | :heavy_minus_sign: | Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model. | model | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsprovidersortconfigenum.md b/docs/components/chatgenerationparamsprovidersortconfigenum.md new file mode 100644 index 0000000..8117c95 --- /dev/null +++ b/docs/components/chatgenerationparamsprovidersortconfigenum.md @@ -0,0 +1,10 @@ +# ChatGenerationParamsProviderSortConfigEnum + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/components/chatgenerationparamsprovidersortconfigunion.md b/docs/components/chatgenerationparamsprovidersortconfigunion.md new file mode 100644 index 0000000..1fc42c9 --- /dev/null +++ b/docs/components/chatgenerationparamsprovidersortconfigunion.md @@ -0,0 +1,17 @@ +# ChatGenerationParamsProviderSortConfigUnion + + +## Supported Types + +### `components.ChatGenerationParamsProviderSortConfig` + +```python +value: components.ChatGenerationParamsProviderSortConfig = /* values here */ +``` + +### `components.ChatGenerationParamsProviderSortConfigEnum` + +```python +value: components.ChatGenerationParamsProviderSortConfigEnum = /* values here */ +``` + diff --git a/docs/components/sortenum.md b/docs/components/chatgenerationparamssortenum.md similarity index 84% rename from docs/components/sortenum.md rename to docs/components/chatgenerationparamssortenum.md index 728cf4b..eac8dc3 100644 --- a/docs/components/sortenum.md +++ b/docs/components/chatgenerationparamssortenum.md @@ -1,4 +1,4 @@ -# SortEnum +# ChatGenerationParamsSortEnum ## Values diff --git a/docs/components/chatgenerationparamssortunion.md b/docs/components/chatgenerationparamssortunion.md new file mode 100644 index 0000000..7c35fb7 --- /dev/null +++ b/docs/components/chatgenerationparamssortunion.md @@ -0,0 +1,25 @@ +# ChatGenerationParamsSortUnion + +The sorting strategy to use for this request, if "order" is not specified. When set, no load balancing is performed. + + +## Supported Types + +### `components.ChatGenerationParamsProviderSort` + +```python +value: components.ChatGenerationParamsProviderSort = /* values here */ +``` + +### `components.ChatGenerationParamsProviderSortConfigUnion` + +```python +value: components.ChatGenerationParamsProviderSortConfigUnion = /* values here */ +``` + +### `components.ChatGenerationParamsSortEnum` + +```python +value: components.ChatGenerationParamsSortEnum = /* values here */ +``` + diff --git a/docs/components/chatgenerationparamstrace.md b/docs/components/chatgenerationparamstrace.md new file mode 100644 index 0000000..b49a15a --- /dev/null +++ b/docs/components/chatgenerationparamstrace.md @@ -0,0 +1,15 @@ +# ChatGenerationParamsTrace + +Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `trace_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `trace_name` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `span_name` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `generation_name` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `parent_span_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatgenerationtokenusage.md b/docs/components/chatgenerationtokenusage.md index 778e390..6b42d1f 100644 --- a/docs/components/chatgenerationtokenusage.md +++ b/docs/components/chatgenerationtokenusage.md @@ -1,12 +1,14 @@ # ChatGenerationTokenUsage +Token usage statistics + ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -| `completion_tokens` | *float* | :heavy_check_mark: | N/A | -| `prompt_tokens` | *float* | :heavy_check_mark: | N/A | -| `total_tokens` | *float* | :heavy_check_mark: | N/A | -| `completion_tokens_details` | [OptionalNullable[components.CompletionTokensDetails]](../components/completiontokensdetails.md) | :heavy_minus_sign: | N/A | -| `prompt_tokens_details` | [OptionalNullable[components.PromptTokensDetails]](../components/prompttokensdetails.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `completion_tokens` | *float* | :heavy_check_mark: | Number of tokens in the completion | +| `prompt_tokens` | *float* | :heavy_check_mark: | Number of tokens in the prompt | +| `total_tokens` | *float* | :heavy_check_mark: | Total number of tokens | +| `completion_tokens_details` | [OptionalNullable[components.CompletionTokensDetails]](../components/completiontokensdetails.md) | :heavy_minus_sign: | Detailed completion token usage | +| `prompt_tokens_details` | [OptionalNullable[components.PromptTokensDetails]](../components/prompttokensdetails.md) | :heavy_minus_sign: | Detailed prompt token usage | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitem.md b/docs/components/chatmessagecontentitem.md index 7063cdb..197da42 100644 --- a/docs/components/chatmessagecontentitem.md +++ b/docs/components/chatmessagecontentitem.md @@ -1,5 +1,7 @@ # ChatMessageContentItem +Content part for chat completion messages + ## Supported Types @@ -21,15 +23,9 @@ value: components.ChatMessageContentItemImage = /* values here */ value: components.ChatMessageContentItemAudio = /* values here */ ``` -### `components.ChatMessageContentItemVideo` +### `components.ChatMessageContentItem1` ```python -value: components.ChatMessageContentItemVideo = /* values here */ -``` - -### `components.ChatMessageContentItemVideo` - -```python -value: components.ChatMessageContentItemVideo = /* values here */ +value: components.ChatMessageContentItem1 = /* values here */ ``` diff --git a/docs/components/chatmessagecontentitem1.md b/docs/components/chatmessagecontentitem1.md new file mode 100644 index 0000000..782be76 --- /dev/null +++ b/docs/components/chatmessagecontentitem1.md @@ -0,0 +1,17 @@ +# ChatMessageContentItem1 + + +## Supported Types + +### `components.ChatMessageContentItemVideoLegacy` + +```python +value: components.ChatMessageContentItemVideoLegacy = /* values here */ +``` + +### `components.ChatMessageContentItemVideo` + +```python +value: components.ChatMessageContentItemVideo = /* values here */ +``` + diff --git a/docs/components/chatmessagecontentitemaudio.md b/docs/components/chatmessagecontentitemaudio.md index 1555e22..4fcc232 100644 --- a/docs/components/chatmessagecontentitemaudio.md +++ b/docs/components/chatmessagecontentitemaudio.md @@ -1,9 +1,11 @@ # ChatMessageContentItemAudio +Audio input content part. Supported audio formats vary by provider. + ## Fields | Field | Type | Required | Description | | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `type` | *Literal["input_audio"]* | :heavy_check_mark: | N/A | +| `type` | [components.ChatMessageContentItemAudioType](../components/chatmessagecontentitemaudiotype.md) | :heavy_check_mark: | N/A | | `input_audio` | [components.ChatMessageContentItemAudioInputAudio](../components/chatmessagecontentitemaudioinputaudio.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemaudioinputaudio.md b/docs/components/chatmessagecontentitemaudioinputaudio.md index f7a62b5..7658571 100644 --- a/docs/components/chatmessagecontentitemaudioinputaudio.md +++ b/docs/components/chatmessagecontentitemaudioinputaudio.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `data` | *str* | :heavy_check_mark: | N/A | -| `format_` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `data` | *str* | :heavy_check_mark: | Base64 encoded audio data | +| `format_` | *str* | :heavy_check_mark: | Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by provider. | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemaudiotype.md b/docs/components/chatmessagecontentitemaudiotype.md new file mode 100644 index 0000000..29dc6ff --- /dev/null +++ b/docs/components/chatmessagecontentitemaudiotype.md @@ -0,0 +1,8 @@ +# ChatMessageContentItemAudioType + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `INPUT_AUDIO` | input_audio | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemcachecontrol.md b/docs/components/chatmessagecontentitemcachecontrol.md index 2ad30d0..df820de 100644 --- a/docs/components/chatmessagecontentitemcachecontrol.md +++ b/docs/components/chatmessagecontentitemcachecontrol.md @@ -1,9 +1,11 @@ # ChatMessageContentItemCacheControl +Cache control for the content part + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `type` | *Literal["ephemeral"]* | :heavy_check_mark: | N/A | -| `ttl` | [Optional[components.TTL]](../components/ttl.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `type` | [components.ChatMessageContentItemCacheControlType](../components/chatmessagecontentitemcachecontroltype.md) | :heavy_check_mark: | N/A | +| `ttl` | [Optional[components.TTL]](../components/ttl.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemcachecontroltype.md b/docs/components/chatmessagecontentitemcachecontroltype.md new file mode 100644 index 0000000..6e9faa2 --- /dev/null +++ b/docs/components/chatmessagecontentitemcachecontroltype.md @@ -0,0 +1,8 @@ +# ChatMessageContentItemCacheControlType + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `EPHEMERAL` | ephemeral | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemimage.md b/docs/components/chatmessagecontentitemimage.md index bab58c2..023ea52 100644 --- a/docs/components/chatmessagecontentitemimage.md +++ b/docs/components/chatmessagecontentitemimage.md @@ -1,9 +1,11 @@ # ChatMessageContentItemImage +Image content part for vision models + ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | -| `type` | *Literal["image_url"]* | :heavy_check_mark: | N/A | +| `type` | [components.ChatMessageContentItemImageType](../components/chatmessagecontentitemimagetype.md) | :heavy_check_mark: | N/A | | `image_url` | [components.ChatMessageContentItemImageImageURL](../components/chatmessagecontentitemimageimageurl.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemimagedetail.md b/docs/components/chatmessagecontentitemimagedetail.md index 32d58f7..5862abf 100644 --- a/docs/components/chatmessagecontentitemimagedetail.md +++ b/docs/components/chatmessagecontentitemimagedetail.md @@ -1,5 +1,7 @@ # ChatMessageContentItemImageDetail +Image detail level for vision models + ## Values diff --git a/docs/components/chatmessagecontentitemimageimageurl.md b/docs/components/chatmessagecontentitemimageimageurl.md index 7aa3e7f..1d0609e 100644 --- a/docs/components/chatmessagecontentitemimageimageurl.md +++ b/docs/components/chatmessagecontentitemimageimageurl.md @@ -5,5 +5,5 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | -| `url` | *str* | :heavy_check_mark: | N/A | -| `detail` | [Optional[components.ChatMessageContentItemImageDetail]](../components/chatmessagecontentitemimagedetail.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `url` | *str* | :heavy_check_mark: | URL of the image (data: URLs supported) | +| `detail` | [Optional[components.ChatMessageContentItemImageDetail]](../components/chatmessagecontentitemimagedetail.md) | :heavy_minus_sign: | Image detail level for vision models | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemimagetype.md b/docs/components/chatmessagecontentitemimagetype.md new file mode 100644 index 0000000..23b614b --- /dev/null +++ b/docs/components/chatmessagecontentitemimagetype.md @@ -0,0 +1,8 @@ +# ChatMessageContentItemImageType + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `IMAGE_URL` | image_url | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemtext.md b/docs/components/chatmessagecontentitemtext.md index 4f8a874..832ff2a 100644 --- a/docs/components/chatmessagecontentitemtext.md +++ b/docs/components/chatmessagecontentitemtext.md @@ -1,10 +1,12 @@ # ChatMessageContentItemText +Text content part + ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| `type` | *Literal["text"]* | :heavy_check_mark: | N/A | -| `text` | *str* | :heavy_check_mark: | N/A | -| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `type` | [components.ChatMessageContentItemTextType](../components/chatmessagecontentitemtexttype.md) | :heavy_check_mark: | N/A | | +| `text` | *str* | :heavy_check_mark: | N/A | | +| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | Cache control for the content part | {
"type": "ephemeral",
"ttl": "5m"
} | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemtexttype.md b/docs/components/chatmessagecontentitemtexttype.md new file mode 100644 index 0000000..da0a6dd --- /dev/null +++ b/docs/components/chatmessagecontentitemtexttype.md @@ -0,0 +1,8 @@ +# ChatMessageContentItemTextType + + +## Values + +| Name | Value | +| ------ | ------ | +| `TEXT` | text | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideo.md b/docs/components/chatmessagecontentitemvideo.md index c92a0bb..ae376af 100644 --- a/docs/components/chatmessagecontentitemvideo.md +++ b/docs/components/chatmessagecontentitemvideo.md @@ -1,17 +1,11 @@ # ChatMessageContentItemVideo +Video input content part -## Supported Types -### `components.ChatMessageContentItemVideoInputVideo` - -```python -value: components.ChatMessageContentItemVideoInputVideo = /* values here */ -``` - -### `components.ChatMessageContentItemVideoVideoURL` - -```python -value: components.ChatMessageContentItemVideoVideoURL = /* values here */ -``` +## Fields +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `type` | [components.ChatMessageContentItemVideoType](../components/chatmessagecontentitemvideotype.md) | :heavy_check_mark: | N/A | +| `video_url` | [components.VideoInput](../components/videoinput.md) | :heavy_check_mark: | Video input object | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideoinputvideo.md b/docs/components/chatmessagecontentitemvideoinputvideo.md deleted file mode 100644 index 4d7dd0e..0000000 --- a/docs/components/chatmessagecontentitemvideoinputvideo.md +++ /dev/null @@ -1,9 +0,0 @@ -# ChatMessageContentItemVideoInputVideo - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `type` | *Literal["input_video"]* | :heavy_check_mark: | N/A | -| `video_url` | [components.VideoURL1](../components/videourl1.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideolegacy.md b/docs/components/chatmessagecontentitemvideolegacy.md new file mode 100644 index 0000000..07dcec1 --- /dev/null +++ b/docs/components/chatmessagecontentitemvideolegacy.md @@ -0,0 +1,13 @@ +# ~~ChatMessageContentItemVideoLegacy~~ + +Video input content part (legacy format - deprecated) + +> :warning: **DEPRECATED**: This will be removed in a future release, please migrate away from it as soon as possible. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `type` | [components.ChatMessageContentItemVideoLegacyType](../components/chatmessagecontentitemvideolegacytype.md) | :heavy_check_mark: | N/A | +| `video_url` | [components.VideoInput](../components/videoinput.md) | :heavy_check_mark: | Video input object | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideolegacytype.md b/docs/components/chatmessagecontentitemvideolegacytype.md new file mode 100644 index 0000000..1bfffd5 --- /dev/null +++ b/docs/components/chatmessagecontentitemvideolegacytype.md @@ -0,0 +1,8 @@ +# ChatMessageContentItemVideoLegacyType + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `INPUT_VIDEO` | input_video | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideotype.md b/docs/components/chatmessagecontentitemvideotype.md new file mode 100644 index 0000000..c660342 --- /dev/null +++ b/docs/components/chatmessagecontentitemvideotype.md @@ -0,0 +1,8 @@ +# ChatMessageContentItemVideoType + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `VIDEO_URL` | video_url | \ No newline at end of file diff --git a/docs/components/chatmessagecontentitemvideovideourl.md b/docs/components/chatmessagecontentitemvideovideourl.md deleted file mode 100644 index 0585b55..0000000 --- a/docs/components/chatmessagecontentitemvideovideourl.md +++ /dev/null @@ -1,9 +0,0 @@ -# ChatMessageContentItemVideoVideoURL - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `type` | *Literal["video_url"]* | :heavy_check_mark: | N/A | -| `video_url` | [components.VideoURL2](../components/videourl2.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagetokenlogprob.md b/docs/components/chatmessagetokenlogprob.md index c73b22a..f797c6a 100644 --- a/docs/components/chatmessagetokenlogprob.md +++ b/docs/components/chatmessagetokenlogprob.md @@ -1,11 +1,13 @@ # ChatMessageTokenLogprob +Token log probability information + ## Fields | Field | Type | Required | Description | | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `token` | *str* | :heavy_check_mark: | N/A | -| `logprob` | *float* | :heavy_check_mark: | N/A | -| `bytes_` | List[*float*] | :heavy_check_mark: | N/A | -| `top_logprobs` | List[[components.ChatMessageTokenLogprobTopLogprob](../components/chatmessagetokenlogprobtoplogprob.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| `token` | *str* | :heavy_check_mark: | The token | +| `logprob` | *float* | :heavy_check_mark: | Log probability of the token | +| `bytes_` | List[*float*] | :heavy_check_mark: | UTF-8 bytes of the token | +| `top_logprobs` | List[[components.ChatMessageTokenLogprobTopLogprob](../components/chatmessagetokenlogprobtoplogprob.md)] | :heavy_check_mark: | Top alternative tokens with probabilities | \ No newline at end of file diff --git a/docs/components/chatmessagetokenlogprobs.md b/docs/components/chatmessagetokenlogprobs.md index cadf699..0b8961f 100644 --- a/docs/components/chatmessagetokenlogprobs.md +++ b/docs/components/chatmessagetokenlogprobs.md @@ -1,9 +1,11 @@ # ChatMessageTokenLogprobs +Log probabilities for the completion + ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `content` | List[[components.ChatMessageTokenLogprob](../components/chatmessagetokenlogprob.md)] | :heavy_check_mark: | N/A | -| `refusal` | List[[components.ChatMessageTokenLogprob](../components/chatmessagetokenlogprob.md)] | :heavy_check_mark: | N/A | \ No newline at end of file +| `content` | List[[components.ChatMessageTokenLogprob](../components/chatmessagetokenlogprob.md)] | :heavy_check_mark: | Log probabilities for content tokens | +| `refusal` | List[[components.ChatMessageTokenLogprob](../components/chatmessagetokenlogprob.md)] | :heavy_check_mark: | Log probabilities for refusal tokens | \ No newline at end of file diff --git a/docs/components/chatmessagetoolcall.md b/docs/components/chatmessagetoolcall.md index 852ed42..19fcf54 100644 --- a/docs/components/chatmessagetoolcall.md +++ b/docs/components/chatmessagetoolcall.md @@ -1,10 +1,12 @@ # ChatMessageToolCall +Tool call made by the assistant + ## Fields | Field | Type | Required | Description | | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | N/A | -| `type` | *Literal["function"]* | :heavy_check_mark: | N/A | +| `id` | *str* | :heavy_check_mark: | Tool call identifier | +| `type` | [components.ChatMessageToolCallType](../components/chatmessagetoolcalltype.md) | :heavy_check_mark: | N/A | | `function` | [components.ChatMessageToolCallFunction](../components/chatmessagetoolcallfunction.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatmessagetoolcallfunction.md b/docs/components/chatmessagetoolcallfunction.md index 9ebac2d..ef31674 100644 --- a/docs/components/chatmessagetoolcallfunction.md +++ b/docs/components/chatmessagetoolcallfunction.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `name` | *str* | :heavy_check_mark: | N/A | -| `arguments` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| `name` | *str* | :heavy_check_mark: | Function name to call | +| `arguments` | *str* | :heavy_check_mark: | Function arguments as JSON string | \ No newline at end of file diff --git a/docs/components/route.md b/docs/components/chatmessagetoolcalltype.md similarity index 52% rename from docs/components/route.md rename to docs/components/chatmessagetoolcalltype.md index 6ddb804..881125e 100644 --- a/docs/components/route.md +++ b/docs/components/chatmessagetoolcalltype.md @@ -1,9 +1,8 @@ -# Route +# ChatMessageToolCallType ## Values | Name | Value | | ---------- | ---------- | -| `FALLBACK` | fallback | -| `SORT` | sort | \ No newline at end of file +| `FUNCTION` | function | \ No newline at end of file diff --git a/docs/components/chatresponse.md b/docs/components/chatresponse.md index 58fd76f..50e5966 100644 --- a/docs/components/chatresponse.md +++ b/docs/components/chatresponse.md @@ -1,14 +1,16 @@ # ChatResponse +Chat completion response + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `id` | *str* | :heavy_check_mark: | N/A | -| `choices` | List[[components.ChatResponseChoice](../components/chatresponsechoice.md)] | :heavy_check_mark: | N/A | -| `created` | *float* | :heavy_check_mark: | N/A | -| `model` | *str* | :heavy_check_mark: | N/A | -| `object` | *Literal["chat.completion"]* | :heavy_check_mark: | N/A | -| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `usage` | [Optional[components.ChatGenerationTokenUsage]](../components/chatgenerationtokenusage.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique completion identifier | chatcmpl-123 | +| `choices` | List[[components.ChatResponseChoice](../components/chatresponsechoice.md)] | :heavy_check_mark: | List of completion choices | | +| `created` | *float* | :heavy_check_mark: | Unix timestamp of creation | 1677652288 | +| `model` | *str* | :heavy_check_mark: | Model used for completion | openai/gpt-4 | +| `object` | [components.ChatResponseObject](../components/chatresponseobject.md) | :heavy_check_mark: | N/A | | +| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | System fingerprint | fp_44709d6fcb | +| `usage` | [Optional[components.ChatGenerationTokenUsage]](../components/chatgenerationtokenusage.md) | :heavy_minus_sign: | Token usage statistics | {
"completion_tokens": 15,
"prompt_tokens": 10,
"total_tokens": 25,
"completion_tokens_details": {
"reasoning_tokens": 5
},
"prompt_tokens_details": {
"cached_tokens": 2
}
} | \ No newline at end of file diff --git a/docs/components/chatresponsechoice.md b/docs/components/chatresponsechoice.md index 54b4a32..c9801f2 100644 --- a/docs/components/chatresponsechoice.md +++ b/docs/components/chatresponsechoice.md @@ -1,11 +1,13 @@ # ChatResponseChoice +Chat completion choice + ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `finish_reason` | [Nullable[components.ChatCompletionFinishReason]](../components/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A | -| `index` | *float* | :heavy_check_mark: | N/A | -| `message` | [components.AssistantMessage](../components/assistantmessage.md) | :heavy_check_mark: | N/A | -| `logprobs` | [OptionalNullable[components.ChatMessageTokenLogprobs]](../components/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `finish_reason` | *Nullable[Any]* | :heavy_check_mark: | N/A | | +| `index` | *float* | :heavy_check_mark: | Choice index | 0 | +| `message` | [components.AssistantMessage](../components/assistantmessage.md) | :heavy_check_mark: | Assistant message for requests and responses | {
"role": "user",
"content": "What is the capital of France?"
} | +| `logprobs` | [OptionalNullable[components.ChatMessageTokenLogprobs]](../components/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | Log probabilities for the completion | {
"content": [
{
"token": " Hello",
"logprob": -0.612345,
"bytes": null,
"top_logprobs": []
}
],
"refusal": null
} | \ No newline at end of file diff --git a/docs/components/chatresponseobject.md b/docs/components/chatresponseobject.md new file mode 100644 index 0000000..f2d6e96 --- /dev/null +++ b/docs/components/chatresponseobject.md @@ -0,0 +1,8 @@ +# ChatResponseObject + + +## Values + +| Name | Value | +| ----------------- | ----------------- | +| `CHAT_COMPLETION` | chat.completion | \ No newline at end of file diff --git a/docs/components/chatstreamingchoice.md b/docs/components/chatstreamingchoice.md index 74b22e3..eacfbcc 100644 --- a/docs/components/chatstreamingchoice.md +++ b/docs/components/chatstreamingchoice.md @@ -1,11 +1,13 @@ # ChatStreamingChoice +Streaming completion choice chunk + ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `delta` | [components.ChatStreamingMessageChunk](../components/chatstreamingmessagechunk.md) | :heavy_check_mark: | N/A | -| `finish_reason` | [Nullable[components.ChatCompletionFinishReason]](../components/chatcompletionfinishreason.md) | :heavy_check_mark: | N/A | -| `index` | *float* | :heavy_check_mark: | N/A | -| `logprobs` | [OptionalNullable[components.ChatMessageTokenLogprobs]](../components/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `delta` | [components.ChatStreamingMessageChunk](../components/chatstreamingmessagechunk.md) | :heavy_check_mark: | Delta changes in streaming response | {
"role": "assistant",
"content": "Hello"
} | +| `finish_reason` | *Nullable[Any]* | :heavy_check_mark: | N/A | | +| `index` | *float* | :heavy_check_mark: | Choice index | 0 | +| `logprobs` | [OptionalNullable[components.ChatMessageTokenLogprobs]](../components/chatmessagetokenlogprobs.md) | :heavy_minus_sign: | Log probabilities for the completion | {
"content": [
{
"token": " Hello",
"logprob": -0.612345,
"bytes": null,
"top_logprobs": []
}
],
"refusal": null
} | \ No newline at end of file diff --git a/docs/components/chatstreamingmessagechunk.md b/docs/components/chatstreamingmessagechunk.md index 8c62a97..a91123f 100644 --- a/docs/components/chatstreamingmessagechunk.md +++ b/docs/components/chatstreamingmessagechunk.md @@ -1,13 +1,15 @@ # ChatStreamingMessageChunk +Delta changes in streaming response + ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `role` | [Optional[components.ChatStreamingMessageChunkRole]](../components/chatstreamingmessagechunkrole.md) | :heavy_minus_sign: | N/A | -| `content` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | N/A | -| `reasoning_details` | List[[components.Schema19](../components/schema19.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `role` | [Optional[components.ChatStreamingMessageChunkRole]](../components/chatstreamingmessagechunkrole.md) | :heavy_minus_sign: | The role of the message author | assistant | +| `content` | *OptionalNullable[str]* | :heavy_minus_sign: | Message content delta | Hello | +| `reasoning` | *OptionalNullable[str]* | :heavy_minus_sign: | Reasoning content delta | I need to | +| `refusal` | *OptionalNullable[str]* | :heavy_minus_sign: | Refusal message delta | | +| `tool_calls` | List[[components.ChatStreamingMessageToolCall](../components/chatstreamingmessagetoolcall.md)] | :heavy_minus_sign: | Tool calls delta | | +| `reasoning_details` | List[[components.ReasoningDetailUnion](../components/reasoningdetailunion.md)] | :heavy_minus_sign: | Reasoning details for extended thinking models | | \ No newline at end of file diff --git a/docs/components/chatstreamingmessagechunkrole.md b/docs/components/chatstreamingmessagechunkrole.md index 28535a6..20f57d9 100644 --- a/docs/components/chatstreamingmessagechunkrole.md +++ b/docs/components/chatstreamingmessagechunkrole.md @@ -1,5 +1,7 @@ # ChatStreamingMessageChunkRole +The role of the message author + ## Values diff --git a/docs/components/chatstreamingmessagetoolcall.md b/docs/components/chatstreamingmessagetoolcall.md index 4b3b687..4add468 100644 --- a/docs/components/chatstreamingmessagetoolcall.md +++ b/docs/components/chatstreamingmessagetoolcall.md @@ -1,11 +1,13 @@ # ChatStreamingMessageToolCall +Tool call delta for streaming responses + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | -| `index` | *float* | :heavy_check_mark: | N/A | -| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `type` | *Optional[Literal["function"]]* | :heavy_minus_sign: | N/A | -| `function` | [Optional[components.ChatStreamingMessageToolCallFunction]](../components/chatstreamingmessagetoolcallfunction.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `index` | *float* | :heavy_check_mark: | Tool call index in the array | 0 | +| `id` | *Optional[str]* | :heavy_minus_sign: | Tool call identifier | call_abc123 | +| `type` | [Optional[components.ChatStreamingMessageToolCallType]](../components/chatstreamingmessagetoolcalltype.md) | :heavy_minus_sign: | Tool call type | function | +| `function` | [Optional[components.ChatStreamingMessageToolCallFunction]](../components/chatstreamingmessagetoolcallfunction.md) | :heavy_minus_sign: | Function call details | | \ No newline at end of file diff --git a/docs/components/chatstreamingmessagetoolcallfunction.md b/docs/components/chatstreamingmessagetoolcallfunction.md index cd3af48..3b47ecb 100644 --- a/docs/components/chatstreamingmessagetoolcallfunction.md +++ b/docs/components/chatstreamingmessagetoolcallfunction.md @@ -1,9 +1,11 @@ # ChatStreamingMessageToolCallFunction +Function call details + ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `arguments` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| `name` | *Optional[str]* | :heavy_minus_sign: | Function name | get_weather | +| `arguments` | *Optional[str]* | :heavy_minus_sign: | Function arguments as JSON string | {"location": | \ No newline at end of file diff --git a/docs/components/chatstreamingmessagetoolcalltype.md b/docs/components/chatstreamingmessagetoolcalltype.md new file mode 100644 index 0000000..0a33b59 --- /dev/null +++ b/docs/components/chatstreamingmessagetoolcalltype.md @@ -0,0 +1,10 @@ +# ChatStreamingMessageToolCallType + +Tool call type + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `FUNCTION` | function | \ No newline at end of file diff --git a/docs/components/chatstreamingresponsechunk.md b/docs/components/chatstreamingresponsechunk.md index a49a334..1d7647e 100644 --- a/docs/components/chatstreamingresponsechunk.md +++ b/docs/components/chatstreamingresponsechunk.md @@ -1,8 +1,17 @@ # ChatStreamingResponseChunk +Streaming chat completion chunk + ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -| `data` | [components.ChatStreamingResponseChunkData](../components/chatstreamingresponsechunkdata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | Unique chunk identifier | chatcmpl-123 | +| `choices` | List[[components.ChatStreamingChoice](../components/chatstreamingchoice.md)] | :heavy_check_mark: | List of streaming chunk choices | | +| `created` | *float* | :heavy_check_mark: | Unix timestamp of creation | 1677652288 | +| `model` | *str* | :heavy_check_mark: | Model used for completion | openai/gpt-4 | +| `object` | [components.ChatStreamingResponseChunkObject](../components/chatstreamingresponsechunkobject.md) | :heavy_check_mark: | N/A | | +| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | System fingerprint | fp_44709d6fcb | +| `error` | [Optional[components.Error]](../components/error.md) | :heavy_minus_sign: | Error information | {
"message": "Rate limit exceeded",
"code": 429
} | +| `usage` | [Optional[components.ChatGenerationTokenUsage]](../components/chatgenerationtokenusage.md) | :heavy_minus_sign: | Token usage statistics | {
"completion_tokens": 15,
"prompt_tokens": 10,
"total_tokens": 25,
"completion_tokens_details": {
"reasoning_tokens": 5
},
"prompt_tokens_details": {
"cached_tokens": 2
}
} | \ No newline at end of file diff --git a/docs/components/chatstreamingresponsechunkdata.md b/docs/components/chatstreamingresponsechunkdata.md deleted file mode 100644 index 2439bc8..0000000 --- a/docs/components/chatstreamingresponsechunkdata.md +++ /dev/null @@ -1,15 +0,0 @@ -# ChatStreamingResponseChunkData - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | N/A | -| `choices` | List[[components.ChatStreamingChoice](../components/chatstreamingchoice.md)] | :heavy_check_mark: | N/A | -| `created` | *float* | :heavy_check_mark: | N/A | -| `model` | *str* | :heavy_check_mark: | N/A | -| `object` | *Literal["chat.completion.chunk"]* | :heavy_check_mark: | N/A | -| `system_fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `error` | [Optional[components.ChatStreamingResponseChunkError]](../components/chatstreamingresponsechunkerror.md) | :heavy_minus_sign: | N/A | -| `usage` | [Optional[components.ChatGenerationTokenUsage]](../components/chatgenerationtokenusage.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/chatstreamingresponsechunkerror.md b/docs/components/chatstreamingresponsechunkerror.md deleted file mode 100644 index c394258..0000000 --- a/docs/components/chatstreamingresponsechunkerror.md +++ /dev/null @@ -1,9 +0,0 @@ -# ChatStreamingResponseChunkError - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `message` | *str* | :heavy_check_mark: | N/A | -| `code` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/chatstreamingresponsechunkobject.md b/docs/components/chatstreamingresponsechunkobject.md new file mode 100644 index 0000000..b596f86 --- /dev/null +++ b/docs/components/chatstreamingresponsechunkobject.md @@ -0,0 +1,8 @@ +# ChatStreamingResponseChunkObject + + +## Values + +| Name | Value | +| ----------------------- | ----------------------- | +| `CHAT_COMPLETION_CHUNK` | chat.completion.chunk | \ No newline at end of file diff --git a/docs/components/chatstreamoptions.md b/docs/components/chatstreamoptions.md index 39c4b74..ade029e 100644 --- a/docs/components/chatstreamoptions.md +++ b/docs/components/chatstreamoptions.md @@ -1,8 +1,10 @@ # ChatStreamOptions +Streaming configuration options + ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `include_usage` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| ~~`include_usage`~~ | *Optional[bool]* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

Deprecated: This field has no effect. Full usage details are always included. | true | \ No newline at end of file diff --git a/docs/components/code.md b/docs/components/code.md index 9de20c8..86a8554 100644 --- a/docs/components/code.md +++ b/docs/components/code.md @@ -1,17 +1,25 @@ # Code -## Supported Types - -### `str` - -```python -value: str = /* values here */ -``` - -### `float` - -```python -value: float = /* values here */ -``` +## Values +| Name | Value | +| -------------------------------- | -------------------------------- | +| `SERVER_ERROR` | server_error | +| `RATE_LIMIT_EXCEEDED` | rate_limit_exceeded | +| `INVALID_PROMPT` | invalid_prompt | +| `VECTOR_STORE_TIMEOUT` | vector_store_timeout | +| `INVALID_IMAGE` | invalid_image | +| `INVALID_IMAGE_FORMAT` | invalid_image_format | +| `INVALID_BASE64_IMAGE` | invalid_base64_image | +| `INVALID_IMAGE_URL` | invalid_image_url | +| `IMAGE_TOO_LARGE` | image_too_large | +| `IMAGE_TOO_SMALL` | image_too_small | +| `IMAGE_PARSE_ERROR` | image_parse_error | +| `IMAGE_CONTENT_POLICY_VIOLATION` | image_content_policy_violation | +| `INVALID_IMAGE_MODE` | invalid_image_mode | +| `IMAGE_FILE_TOO_LARGE` | image_file_too_large | +| `UNSUPPORTED_IMAGE_MEDIA_TYPE` | unsupported_image_media_type | +| `EMPTY_IMAGE_FILE` | empty_image_file | +| `FAILED_TO_DOWNLOAD_IMAGE` | failed_to_download_image | +| `IMAGE_FILE_NOT_FOUND` | image_file_not_found | \ No newline at end of file diff --git a/docs/components/codeenum.md b/docs/components/codeenum.md deleted file mode 100644 index 7dd41ac..0000000 --- a/docs/components/codeenum.md +++ /dev/null @@ -1,25 +0,0 @@ -# CodeEnum - - -## Values - -| Name | Value | -| -------------------------------- | -------------------------------- | -| `SERVER_ERROR` | server_error | -| `RATE_LIMIT_EXCEEDED` | rate_limit_exceeded | -| `INVALID_PROMPT` | invalid_prompt | -| `VECTOR_STORE_TIMEOUT` | vector_store_timeout | -| `INVALID_IMAGE` | invalid_image | -| `INVALID_IMAGE_FORMAT` | invalid_image_format | -| `INVALID_BASE64_IMAGE` | invalid_base64_image | -| `INVALID_IMAGE_URL` | invalid_image_url | -| `IMAGE_TOO_LARGE` | image_too_large | -| `IMAGE_TOO_SMALL` | image_too_small | -| `IMAGE_PARSE_ERROR` | image_parse_error | -| `IMAGE_CONTENT_POLICY_VIOLATION` | image_content_policy_violation | -| `INVALID_IMAGE_MODE` | invalid_image_mode | -| `IMAGE_FILE_TOO_LARGE` | image_file_too_large | -| `UNSUPPORTED_IMAGE_MEDIA_TYPE` | unsupported_image_media_type | -| `EMPTY_IMAGE_FILE` | empty_image_file | -| `FAILED_TO_DOWNLOAD_IMAGE` | failed_to_download_image | -| `IMAGE_FILE_NOT_FOUND` | image_file_not_found | \ No newline at end of file diff --git a/docs/components/completion.md b/docs/components/completion.md deleted file mode 100644 index ce9609b..0000000 --- a/docs/components/completion.md +++ /dev/null @@ -1,23 +0,0 @@ -# Completion - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - -### `Any` - -```python -value: Any = /* values here */ -``` - diff --git a/docs/components/completiontokensdetails.md b/docs/components/completiontokensdetails.md index dcac003..1fa23d6 100644 --- a/docs/components/completiontokensdetails.md +++ b/docs/components/completiontokensdetails.md @@ -1,11 +1,13 @@ # CompletionTokensDetails +Detailed completion token usage + ## Fields | Field | Type | Required | Description | | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | -| `reasoning_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `audio_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `accepted_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `rejected_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `reasoning_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Tokens used for reasoning | +| `audio_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Tokens used for audio output | +| `accepted_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Accepted prediction tokens | +| `rejected_prediction_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Rejected prediction tokens | \ No newline at end of file diff --git a/docs/components/modelscountresponsedata.md b/docs/components/data.md similarity index 95% rename from docs/components/modelscountresponsedata.md rename to docs/components/data.md index ff995d4..8d840f6 100644 --- a/docs/components/modelscountresponsedata.md +++ b/docs/components/data.md @@ -1,4 +1,4 @@ -# ModelsCountResponseData +# Data Model count data diff --git a/docs/components/debug.md b/docs/components/debug.md deleted file mode 100644 index 459bb4b..0000000 --- a/docs/components/debug.md +++ /dev/null @@ -1,8 +0,0 @@ -# Debug - - -## Fields - -| Field | Type | Required | Description | -| -------------------- | -------------------- | -------------------- | -------------------- | -| `echo_upstream_body` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/debugoptions.md b/docs/components/debugoptions.md new file mode 100644 index 0000000..f3da9a6 --- /dev/null +++ b/docs/components/debugoptions.md @@ -0,0 +1,10 @@ +# DebugOptions + +Debug options for inspecting request transformations (streaming only) + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | +| `echo_upstream_body` | *Optional[bool]* | :heavy_minus_sign: | If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode. | true | \ No newline at end of file diff --git a/docs/components/developermessage.md b/docs/components/developermessage.md index e767787..3a2ca63 100644 --- a/docs/components/developermessage.md +++ b/docs/components/developermessage.md @@ -1,10 +1,12 @@ # DeveloperMessage +Developer message + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `role` | *Literal["developer"]* | :heavy_check_mark: | N/A | -| `content` | [components.DeveloperMessageContent](../components/developermessagecontent.md) | :heavy_check_mark: | N/A | -| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `role` | [components.DeveloperMessageRole](../components/developermessagerole.md) | :heavy_check_mark: | N/A | | +| `content` | [components.DeveloperMessageContent](../components/developermessagecontent.md) | :heavy_check_mark: | Developer message content | This is a message from the developer. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Optional name for the developer message | Developer | \ No newline at end of file diff --git a/docs/components/developermessagecontent.md b/docs/components/developermessagecontent.md index 6a804dd..6cb0103 100644 --- a/docs/components/developermessagecontent.md +++ b/docs/components/developermessagecontent.md @@ -1,5 +1,7 @@ # DeveloperMessageContent +Developer message content + ## Supported Types diff --git a/docs/components/developermessagerole.md b/docs/components/developermessagerole.md new file mode 100644 index 0000000..01bf651 --- /dev/null +++ b/docs/components/developermessagerole.md @@ -0,0 +1,8 @@ +# DeveloperMessageRole + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `DEVELOPER` | developer | \ No newline at end of file diff --git a/docs/components/effort.md b/docs/components/effort.md index acf9c82..b23f0fb 100644 --- a/docs/components/effort.md +++ b/docs/components/effort.md @@ -1,5 +1,7 @@ # Effort +Constrains effort on reasoning for reasoning models + ## Values diff --git a/docs/components/error.md b/docs/components/error.md new file mode 100644 index 0000000..7765bfc --- /dev/null +++ b/docs/components/error.md @@ -0,0 +1,11 @@ +# Error + +Error information + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------- | ------------------- | ------------------- | ------------------- | ------------------- | +| `message` | *str* | :heavy_check_mark: | Error message | Rate limit exceeded | +| `code` | *float* | :heavy_check_mark: | Error code | 429 | \ No newline at end of file diff --git a/docs/components/image.md b/docs/components/image.md deleted file mode 100644 index 1c8c8f5..0000000 --- a/docs/components/image.md +++ /dev/null @@ -1,8 +0,0 @@ -# Image - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `image_url` | [components.AssistantMessageImageURL](../components/assistantmessageimageurl.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/jsonschemaconfig.md b/docs/components/jsonschemaconfig.md index e51339a..4e1a91a 100644 --- a/docs/components/jsonschemaconfig.md +++ b/docs/components/jsonschemaconfig.md @@ -1,11 +1,13 @@ # JSONSchemaConfig +JSON Schema configuration object + ## Fields -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `name` | *str* | :heavy_check_mark: | N/A | -| `description` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `schema_` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | -| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `name` | *str* | :heavy_check_mark: | Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) | math_response | +| `description` | *Optional[str]* | :heavy_minus_sign: | Schema description for the model | A mathematical response | +| `schema_` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | JSON Schema object | {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
]
} | +| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable strict schema adherence | false | \ No newline at end of file diff --git a/docs/components/message.md b/docs/components/message.md index fb33171..a75476e 100644 --- a/docs/components/message.md +++ b/docs/components/message.md @@ -1,5 +1,7 @@ # Message +Chat completion message with role-based discrimination + ## Supported Types diff --git a/docs/components/modelscountresponse.md b/docs/components/modelscountresponse.md index 4ad6e6a..84bbce8 100644 --- a/docs/components/modelscountresponse.md +++ b/docs/components/modelscountresponse.md @@ -5,6 +5,6 @@ Model count data ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `data` | [components.ModelsCountResponseData](../components/modelscountresponsedata.md) | :heavy_check_mark: | Model count data | {
"count": 150
} | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `data` | [components.Data](../components/data.md) | :heavy_check_mark: | Model count data | {
"count": 150
} | \ No newline at end of file diff --git a/docs/components/namedtoolchoice.md b/docs/components/namedtoolchoice.md index f18ddd9..bfd165e 100644 --- a/docs/components/namedtoolchoice.md +++ b/docs/components/namedtoolchoice.md @@ -1,9 +1,11 @@ # NamedToolChoice +Named tool choice for specific function + ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `type` | *Literal["function"]* | :heavy_check_mark: | N/A | +| `type` | [components.NamedToolChoiceType](../components/namedtoolchoicetype.md) | :heavy_check_mark: | N/A | | `function` | [components.NamedToolChoiceFunction](../components/namedtoolchoicefunction.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/namedtoolchoicefunction.md b/docs/components/namedtoolchoicefunction.md index a4f8434..1415454 100644 --- a/docs/components/namedtoolchoicefunction.md +++ b/docs/components/namedtoolchoicefunction.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `name` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------- | --------------------- | --------------------- | --------------------- | --------------------- | +| `name` | *str* | :heavy_check_mark: | Function name to call | get_weather | \ No newline at end of file diff --git a/docs/components/namedtoolchoicetype.md b/docs/components/namedtoolchoicetype.md new file mode 100644 index 0000000..487c9b4 --- /dev/null +++ b/docs/components/namedtoolchoicetype.md @@ -0,0 +1,8 @@ +# NamedToolChoiceType + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `FUNCTION` | function | \ No newline at end of file diff --git a/docs/components/openairesponsesreasoningconfig.md b/docs/components/openairesponsesreasoningconfig.md index 8858cfc..6df062f 100644 --- a/docs/components/openairesponsesreasoningconfig.md +++ b/docs/components/openairesponsesreasoningconfig.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| `effort` | [OptionalNullable[components.OpenAIResponsesReasoningEffort]](../components/openairesponsesreasoningeffort.md) | :heavy_minus_sign: | N/A | -| `summary` | [Optional[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `effort` | [OptionalNullable[components.OpenAIResponsesReasoningEffort]](../components/openairesponsesreasoningeffort.md) | :heavy_minus_sign: | N/A | | +| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.md) | :heavy_minus_sign: | N/A | auto | \ No newline at end of file diff --git a/docs/components/openresponsesnonstreamingresponse.md b/docs/components/openresponsesnonstreamingresponse.md index 0201e39..2d79d72 100644 --- a/docs/components/openresponsesnonstreamingresponse.md +++ b/docs/components/openresponsesnonstreamingresponse.md @@ -8,7 +8,7 @@ Complete non-streaming response from the Responses API | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `id` | *str* | :heavy_check_mark: | N/A | | -| `object` | [components.Object](../components/object.md) | :heavy_check_mark: | N/A | | +| `object` | [components.OpenResponsesNonStreamingResponseObject](../components/openresponsesnonstreamingresponseobject.md) | :heavy_check_mark: | N/A | | | `created_at` | *float* | :heavy_check_mark: | N/A | | | `model` | *str* | :heavy_check_mark: | N/A | | | `status` | [components.OpenAIResponsesResponseStatus](../components/openairesponsesresponsestatus.md) | :heavy_check_mark: | N/A | | diff --git a/docs/components/object.md b/docs/components/openresponsesnonstreamingresponseobject.md similarity index 69% rename from docs/components/object.md rename to docs/components/openresponsesnonstreamingresponseobject.md index 6e2df0c..243bd54 100644 --- a/docs/components/object.md +++ b/docs/components/openresponsesnonstreamingresponseobject.md @@ -1,4 +1,4 @@ -# Object +# OpenResponsesNonStreamingResponseObject ## Values diff --git a/docs/components/openresponsesreasoningconfig.md b/docs/components/openresponsesreasoningconfig.md index a5bdb09..d7a8e8a 100644 --- a/docs/components/openresponsesreasoningconfig.md +++ b/docs/components/openresponsesreasoningconfig.md @@ -5,9 +5,9 @@ Configuration for reasoning mode in the response ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| `effort` | [OptionalNullable[components.OpenAIResponsesReasoningEffort]](../components/openairesponsesreasoningeffort.md) | :heavy_minus_sign: | N/A | -| `summary` | [Optional[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.md) | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `enabled` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `effort` | [OptionalNullable[components.OpenAIResponsesReasoningEffort]](../components/openairesponsesreasoningeffort.md) | :heavy_minus_sign: | N/A | | +| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.md) | :heavy_minus_sign: | N/A | auto | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | | +| `enabled` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/openresponsesrequest.md b/docs/components/openresponsesrequest.md index 5eb4cc6..23cf648 100644 --- a/docs/components/openresponsesrequest.md +++ b/docs/components/openresponsesrequest.md @@ -37,7 +37,8 @@ Request schema for Responses endpoint | `service_tier` | [Optional[components.ServiceTier]](../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `truncation` | [OptionalNullable[components.Truncation]](../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `provider` | [OptionalNullable[components.Provider]](../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | -| `plugins` | List[[components.Plugin](../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | | -| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | \ No newline at end of file +| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | +| `trace` | [Optional[components.OpenResponsesRequestTrace]](../components/openresponsesrequesttrace.md) | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | | \ No newline at end of file diff --git a/docs/components/openresponsesrequestidautorouter.md b/docs/components/openresponsesrequestidautorouter.md new file mode 100644 index 0000000..e4dd743 --- /dev/null +++ b/docs/components/openresponsesrequestidautorouter.md @@ -0,0 +1,8 @@ +# OpenResponsesRequestIDAutoRouter + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `AUTO_ROUTER` | auto-router | \ No newline at end of file diff --git a/docs/components/openresponsesrequestidfileparser.md b/docs/components/openresponsesrequestidfileparser.md new file mode 100644 index 0000000..f08492c --- /dev/null +++ b/docs/components/openresponsesrequestidfileparser.md @@ -0,0 +1,8 @@ +# OpenResponsesRequestIDFileParser + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `FILE_PARSER` | file-parser | \ No newline at end of file diff --git a/docs/components/openresponsesrequestidmoderation.md b/docs/components/openresponsesrequestidmoderation.md new file mode 100644 index 0000000..acaf610 --- /dev/null +++ b/docs/components/openresponsesrequestidmoderation.md @@ -0,0 +1,8 @@ +# OpenResponsesRequestIDModeration + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `MODERATION` | moderation | \ No newline at end of file diff --git a/docs/components/openresponsesrequestidresponsehealing.md b/docs/components/openresponsesrequestidresponsehealing.md new file mode 100644 index 0000000..a0c2ca9 --- /dev/null +++ b/docs/components/openresponsesrequestidresponsehealing.md @@ -0,0 +1,8 @@ +# OpenResponsesRequestIDResponseHealing + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `RESPONSE_HEALING` | response-healing | \ No newline at end of file diff --git a/docs/components/openresponsesrequestidweb.md b/docs/components/openresponsesrequestidweb.md new file mode 100644 index 0000000..121966e --- /dev/null +++ b/docs/components/openresponsesrequestidweb.md @@ -0,0 +1,8 @@ +# OpenResponsesRequestIDWeb + + +## Values + +| Name | Value | +| ----- | ----- | +| `WEB` | web | \ No newline at end of file diff --git a/docs/components/openresponsesrequestpluginautorouter.md b/docs/components/openresponsesrequestpluginautorouter.md new file mode 100644 index 0000000..3a7ad4a --- /dev/null +++ b/docs/components/openresponsesrequestpluginautorouter.md @@ -0,0 +1,10 @@ +# OpenResponsesRequestPluginAutoRouter + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `id` | [components.OpenResponsesRequestIDAutoRouter](../components/openresponsesrequestidautorouter.md) | :heavy_check_mark: | N/A | | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the auto-router plugin for this request. Defaults to true. | | +| `allowed_models` | List[*str*] | :heavy_minus_sign: | List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., "anthropic/*" matches all Anthropic models). When not specified, uses the default supported models list. | [
"anthropic/*",
"openai/gpt-4o",
"google/*"
] | \ No newline at end of file diff --git a/docs/components/openresponsesrequestpluginfileparser.md b/docs/components/openresponsesrequestpluginfileparser.md new file mode 100644 index 0000000..7f978df --- /dev/null +++ b/docs/components/openresponsesrequestpluginfileparser.md @@ -0,0 +1,10 @@ +# OpenResponsesRequestPluginFileParser + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `id` | [components.OpenResponsesRequestIDFileParser](../components/openresponsesrequestidfileparser.md) | :heavy_check_mark: | N/A | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the file-parser plugin for this request. Defaults to true. | +| `pdf` | [Optional[components.PDFParserOptions]](../components/pdfparseroptions.md) | :heavy_minus_sign: | Options for PDF parsing. | \ No newline at end of file diff --git a/docs/components/openresponsesrequestpluginmoderation.md b/docs/components/openresponsesrequestpluginmoderation.md new file mode 100644 index 0000000..d29983c --- /dev/null +++ b/docs/components/openresponsesrequestpluginmoderation.md @@ -0,0 +1,8 @@ +# OpenResponsesRequestPluginModeration + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `id` | [components.OpenResponsesRequestIDModeration](../components/openresponsesrequestidmoderation.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/openresponsesrequestpluginresponsehealing.md b/docs/components/openresponsesrequestpluginresponsehealing.md new file mode 100644 index 0000000..5113dc8 --- /dev/null +++ b/docs/components/openresponsesrequestpluginresponsehealing.md @@ -0,0 +1,9 @@ +# OpenResponsesRequestPluginResponseHealing + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `id` | [components.OpenResponsesRequestIDResponseHealing](../components/openresponsesrequestidresponsehealing.md) | :heavy_check_mark: | N/A | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the response-healing plugin for this request. Defaults to true. | \ No newline at end of file diff --git a/docs/components/openresponsesrequestpluginunion.md b/docs/components/openresponsesrequestpluginunion.md new file mode 100644 index 0000000..e164b2e --- /dev/null +++ b/docs/components/openresponsesrequestpluginunion.md @@ -0,0 +1,35 @@ +# OpenResponsesRequestPluginUnion + + +## Supported Types + +### `components.OpenResponsesRequestPluginAutoRouter` + +```python +value: components.OpenResponsesRequestPluginAutoRouter = /* values here */ +``` + +### `components.OpenResponsesRequestPluginModeration` + +```python +value: components.OpenResponsesRequestPluginModeration = /* values here */ +``` + +### `components.OpenResponsesRequestPluginWeb` + +```python +value: components.OpenResponsesRequestPluginWeb = /* values here */ +``` + +### `components.OpenResponsesRequestPluginFileParser` + +```python +value: components.OpenResponsesRequestPluginFileParser = /* values here */ +``` + +### `components.OpenResponsesRequestPluginResponseHealing` + +```python +value: components.OpenResponsesRequestPluginResponseHealing = /* values here */ +``` + diff --git a/docs/components/openresponsesrequestpluginweb.md b/docs/components/openresponsesrequestpluginweb.md new file mode 100644 index 0000000..d308049 --- /dev/null +++ b/docs/components/openresponsesrequestpluginweb.md @@ -0,0 +1,12 @@ +# OpenResponsesRequestPluginWeb + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `id` | [components.OpenResponsesRequestIDWeb](../components/openresponsesrequestidweb.md) | :heavy_check_mark: | N/A | +| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the web-search plugin for this request. Defaults to true. | +| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `engine` | [Optional[components.WebSearchEngine]](../components/websearchengine.md) | :heavy_minus_sign: | The search engine to use for web search. | \ No newline at end of file diff --git a/docs/components/provider.md b/docs/components/openresponsesrequestprovider.md similarity index 99% rename from docs/components/provider.md rename to docs/components/openresponsesrequestprovider.md index 37b891f..5fde781 100644 --- a/docs/components/provider.md +++ b/docs/components/openresponsesrequestprovider.md @@ -1,4 +1,4 @@ -# Provider +# OpenResponsesRequestProvider When multiple model providers are available, optionally indicate your routing preference. diff --git a/docs/components/openresponsesrequesttrace.md b/docs/components/openresponsesrequesttrace.md new file mode 100644 index 0000000..150b916 --- /dev/null +++ b/docs/components/openresponsesrequesttrace.md @@ -0,0 +1,15 @@ +# OpenResponsesRequestTrace + +Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `trace_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `trace_name` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `span_name` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `generation_name` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `parent_span_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `__pydantic_extra__` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/partition.md b/docs/components/partition.md index 975706f..4f49e41 100644 --- a/docs/components/partition.md +++ b/docs/components/partition.md @@ -1,5 +1,7 @@ # Partition +Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model. + ## Values diff --git a/docs/components/pdf.md b/docs/components/pdf.md deleted file mode 100644 index b039762..0000000 --- a/docs/components/pdf.md +++ /dev/null @@ -1,8 +0,0 @@ -# Pdf - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `engine` | [Optional[components.PdfEngine]](../components/pdfengine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/pdfengine.md b/docs/components/pdfengine.md deleted file mode 100644 index 55bca5e..0000000 --- a/docs/components/pdfengine.md +++ /dev/null @@ -1,10 +0,0 @@ -# PdfEngine - - -## Values - -| Name | Value | -| ------------- | ------------- | -| `MISTRAL_OCR` | mistral-ocr | -| `PDF_TEXT` | pdf-text | -| `NATIVE` | native | \ No newline at end of file diff --git a/docs/components/plugin.md b/docs/components/plugin.md deleted file mode 100644 index 7fd669e..0000000 --- a/docs/components/plugin.md +++ /dev/null @@ -1,35 +0,0 @@ -# Plugin - - -## Supported Types - -### `components.PluginAutoRouter` - -```python -value: components.PluginAutoRouter = /* values here */ -``` - -### `components.PluginModeration` - -```python -value: components.PluginModeration = /* values here */ -``` - -### `components.PluginWeb` - -```python -value: components.PluginWeb = /* values here */ -``` - -### `components.PluginFileParser` - -```python -value: components.PluginFileParser = /* values here */ -``` - -### `components.PluginResponseHealing` - -```python -value: components.PluginResponseHealing = /* values here */ -``` - diff --git a/docs/components/pluginmoderation.md b/docs/components/pluginmoderation.md deleted file mode 100644 index e1b99e8..0000000 --- a/docs/components/pluginmoderation.md +++ /dev/null @@ -1,8 +0,0 @@ -# PluginModeration - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -| `id` | [components.IDModeration](../components/idmoderation.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/pluginresponsehealing.md b/docs/components/pluginresponsehealing.md deleted file mode 100644 index 93aa3d7..0000000 --- a/docs/components/pluginresponsehealing.md +++ /dev/null @@ -1,9 +0,0 @@ -# PluginResponseHealing - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | -| `id` | [components.IDResponseHealing](../components/idresponsehealing.md) | :heavy_check_mark: | N/A | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the response-healing plugin for this request. Defaults to true. | \ No newline at end of file diff --git a/docs/components/pluginweb.md b/docs/components/pluginweb.md deleted file mode 100644 index 8738bd0..0000000 --- a/docs/components/pluginweb.md +++ /dev/null @@ -1,12 +0,0 @@ -# PluginWeb - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | -| `id` | [components.IDWeb](../components/idweb.md) | :heavy_check_mark: | N/A | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | Set to false to disable the web-search plugin for this request. Defaults to true. | -| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `engine` | [Optional[components.WebSearchEngine]](../components/websearchengine.md) | :heavy_minus_sign: | The search engine to use for web search. | \ No newline at end of file diff --git a/docs/components/prompt.md b/docs/components/prompt.md deleted file mode 100644 index f242343..0000000 --- a/docs/components/prompt.md +++ /dev/null @@ -1,23 +0,0 @@ -# Prompt - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - -### `Any` - -```python -value: Any = /* values here */ -``` - diff --git a/docs/components/prompttokensdetails.md b/docs/components/prompttokensdetails.md index 844a92d..a929f87 100644 --- a/docs/components/prompttokensdetails.md +++ b/docs/components/prompttokensdetails.md @@ -1,11 +1,13 @@ # PromptTokensDetails +Detailed prompt token usage + ## Fields -| Field | Type | Required | Description | -| -------------------- | -------------------- | -------------------- | -------------------- | -| `cached_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `cache_write_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `audio_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `video_tokens` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `cached_tokens` | *Optional[float]* | :heavy_minus_sign: | Cached prompt tokens | +| `cache_write_tokens` | *Optional[float]* | :heavy_minus_sign: | Tokens written to cache. Only returned for models with explicit caching and cache write pricing. | +| `audio_tokens` | *Optional[float]* | :heavy_minus_sign: | Audio input tokens | +| `video_tokens` | *Optional[float]* | :heavy_minus_sign: | Video input tokens | \ No newline at end of file diff --git a/docs/components/providername.md b/docs/components/providername.md index acc3a29..66caed6 100644 --- a/docs/components/providername.md +++ b/docs/components/providername.md @@ -39,7 +39,9 @@ | `INCEPTION` | Inception | | `INCEPTRON` | Inceptron | | `INFERENCE_NET` | InferenceNet | +| `IONSTREAM` | Ionstream | | `INFERMATIC` | Infermatic | +| `IO_NET` | Io Net | | `INFLECTION` | Inflection | | `LIQUID` | Liquid | | `MARA` | Mara | diff --git a/docs/components/providerpreferences.md b/docs/components/providerpreferences.md index bb33997..c95276b 100644 --- a/docs/components/providerpreferences.md +++ b/docs/components/providerpreferences.md @@ -16,7 +16,7 @@ Provider routing preferences for the request. | `only` | List[[components.ProviderPreferencesOnly](../components/providerpreferencesonly.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[[components.ProviderPreferencesIgnore](../components/providerpreferencesignore.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[[components.Quantization](../components/quantization.md)] | :heavy_minus_sign: | A list of quantization levels to filter the provider by. | | -| `sort` | [OptionalNullable[components.ProviderPreferencesSortUnion]](../components/providerpreferencessortunion.md) | :heavy_minus_sign: | N/A | | +| `sort` | [OptionalNullable[components.ProviderPreferencesSortUnion]](../components/providerpreferencessortunion.md) | :heavy_minus_sign: | N/A | price | | `max_price` | [Optional[components.ProviderPreferencesMaxPrice]](../components/providerpreferencesmaxprice.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. | | | `preferred_min_throughput` | [OptionalNullable[components.PreferredMinThroughput]](../components/preferredminthroughput.md) | :heavy_minus_sign: | Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 100 | | `preferred_max_latency` | [OptionalNullable[components.PreferredMaxLatency]](../components/preferredmaxlatency.md) | :heavy_minus_sign: | Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold. | 5 | \ No newline at end of file diff --git a/docs/components/providerpreferencesby.md b/docs/components/providerpreferencesby.md new file mode 100644 index 0000000..3202834 --- /dev/null +++ b/docs/components/providerpreferencesby.md @@ -0,0 +1,12 @@ +# ProviderPreferencesBy + +The provider sorting strategy (price, throughput, latency) + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/components/providerpreferencespartition.md b/docs/components/providerpreferencespartition.md index dab9b83..147aefe 100644 --- a/docs/components/providerpreferencespartition.md +++ b/docs/components/providerpreferencespartition.md @@ -1,5 +1,7 @@ # ProviderPreferencesPartition +Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model. + ## Values diff --git a/docs/components/providerpreferencesprovidersort.md b/docs/components/providerpreferencesprovidersort.md index 9d8bac3..396da79 100644 --- a/docs/components/providerpreferencesprovidersort.md +++ b/docs/components/providerpreferencesprovidersort.md @@ -1,5 +1,7 @@ # ProviderPreferencesProviderSort +The provider sorting strategy (price, throughput, latency) + ## Values diff --git a/docs/components/providerpreferencesprovidersortconfig.md b/docs/components/providerpreferencesprovidersortconfig.md index 1b9ed9c..95e5f05 100644 --- a/docs/components/providerpreferencesprovidersortconfig.md +++ b/docs/components/providerpreferencesprovidersortconfig.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -| `by` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | N/A | price | -| `partition` | [OptionalNullable[components.ProviderPreferencesPartition]](../components/providerpreferencespartition.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `by` | [OptionalNullable[components.ProviderPreferencesBy]](../components/providerpreferencesby.md) | :heavy_minus_sign: | The provider sorting strategy (price, throughput, latency) | price | +| `partition` | [OptionalNullable[components.ProviderPreferencesPartition]](../components/providerpreferencespartition.md) | :heavy_minus_sign: | Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model. | model | \ No newline at end of file diff --git a/docs/components/providerpreferencesprovidersortconfigenum.md b/docs/components/providerpreferencesprovidersortconfigenum.md new file mode 100644 index 0000000..12ef73b --- /dev/null +++ b/docs/components/providerpreferencesprovidersortconfigenum.md @@ -0,0 +1,10 @@ +# ProviderPreferencesProviderSortConfigEnum + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `PRICE` | price | +| `THROUGHPUT` | throughput | +| `LATENCY` | latency | \ No newline at end of file diff --git a/docs/components/providersortconfigunion.md b/docs/components/providerpreferencesprovidersortconfigunion.md similarity index 50% rename from docs/components/providersortconfigunion.md rename to docs/components/providerpreferencesprovidersortconfigunion.md index 6a9b42b..3b811f7 100644 --- a/docs/components/providersortconfigunion.md +++ b/docs/components/providerpreferencesprovidersortconfigunion.md @@ -1,4 +1,4 @@ -# ProviderSortConfigUnion +# ProviderPreferencesProviderSortConfigUnion ## Supported Types @@ -9,9 +9,9 @@ value: components.ProviderPreferencesProviderSortConfig = /* values here */ ``` -### `components.ProviderSortConfigEnum` +### `components.ProviderPreferencesProviderSortConfigEnum` ```python -value: components.ProviderSortConfigEnum = /* values here */ +value: components.ProviderPreferencesProviderSortConfigEnum = /* values here */ ``` diff --git a/docs/components/providersortconfigenum.md b/docs/components/providerpreferencessortenum.md similarity index 85% rename from docs/components/providersortconfigenum.md rename to docs/components/providerpreferencessortenum.md index 4aca83d..4b608c9 100644 --- a/docs/components/providersortconfigenum.md +++ b/docs/components/providerpreferencessortenum.md @@ -1,4 +1,4 @@ -# ProviderSortConfigEnum +# ProviderPreferencesSortEnum ## Values diff --git a/docs/components/providerpreferencessortunion.md b/docs/components/providerpreferencessortunion.md index e25b117..172baac 100644 --- a/docs/components/providerpreferencessortunion.md +++ b/docs/components/providerpreferencessortunion.md @@ -11,15 +11,15 @@ The sorting strategy to use for this request, if "order" is not specified. When value: components.ProviderPreferencesProviderSort = /* values here */ ``` -### `components.ProviderSortConfigUnion` +### `components.ProviderPreferencesProviderSortConfigUnion` ```python -value: components.ProviderSortConfigUnion = /* values here */ +value: components.ProviderPreferencesProviderSortConfigUnion = /* values here */ ``` -### `components.SortEnum` +### `components.ProviderPreferencesSortEnum` ```python -value: components.SortEnum = /* values here */ +value: components.ProviderPreferencesSortEnum = /* values here */ ``` diff --git a/docs/components/providersort.md b/docs/components/providersort.md index f6d1c72..ca5b358 100644 --- a/docs/components/providersort.md +++ b/docs/components/providersort.md @@ -1,5 +1,7 @@ # ProviderSort +The provider sorting strategy (price, throughput, latency) + ## Values diff --git a/docs/components/providersortconfig.md b/docs/components/providersortconfig.md index a010a19..70db18a 100644 --- a/docs/components/providersortconfig.md +++ b/docs/components/providersortconfig.md @@ -1,9 +1,11 @@ # ProviderSortConfig +The provider sorting strategy (price, throughput, latency) + ## Fields -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `by` | [OptionalNullable[components.ProviderSort]](../components/providersort.md) | :heavy_minus_sign: | N/A | price | -| `partition` | [OptionalNullable[components.Partition]](../components/partition.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `by` | [OptionalNullable[components.By]](../components/by.md) | :heavy_minus_sign: | The provider sorting strategy (price, throughput, latency) | price | +| `partition` | [OptionalNullable[components.Partition]](../components/partition.md) | :heavy_minus_sign: | Partitioning strategy for sorting: "model" (default) groups endpoints by model before sorting (fallback models remain fallbacks), "none" sorts all endpoints together regardless of model. | model | \ No newline at end of file diff --git a/docs/components/providersortunion.md b/docs/components/providersortunion.md deleted file mode 100644 index 9cd4d04..0000000 --- a/docs/components/providersortunion.md +++ /dev/null @@ -1,17 +0,0 @@ -# ProviderSortUnion - - -## Supported Types - -### `components.ProviderSort` - -```python -value: components.ProviderSort = /* values here */ -``` - -### `components.ProviderSortConfig` - -```python -value: components.ProviderSortConfig = /* values here */ -``` - diff --git a/docs/components/reasoning.md b/docs/components/reasoning.md index b0e14a2..0a8755d 100644 --- a/docs/components/reasoning.md +++ b/docs/components/reasoning.md @@ -1,9 +1,11 @@ # Reasoning +Configuration options for reasoning models + ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| `effort` | [OptionalNullable[components.Effort]](../components/effort.md) | :heavy_minus_sign: | N/A | -| `summary` | [OptionalNullable[components.ReasoningSummaryVerbosity]](../components/reasoningsummaryverbosity.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `effort` | [OptionalNullable[components.Effort]](../components/effort.md) | :heavy_minus_sign: | Constrains effort on reasoning for reasoning models | medium | +| `summary` | *OptionalNullable[Any]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/components/reasoningdetailencrypted.md b/docs/components/reasoningdetailencrypted.md new file mode 100644 index 0000000..685b2f4 --- /dev/null +++ b/docs/components/reasoningdetailencrypted.md @@ -0,0 +1,14 @@ +# ReasoningDetailEncrypted + +Reasoning detail encrypted schema + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `type` | [components.ReasoningDetailEncryptedType](../components/reasoningdetailencryptedtype.md) | :heavy_check_mark: | N/A | +| `data` | *str* | :heavy_check_mark: | N/A | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `format_` | [OptionalNullable[components.ReasoningDetailEncryptedFormat]](../components/reasoningdetailencryptedformat.md) | :heavy_minus_sign: | N/A | +| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/reasoningdetailencryptedformat.md b/docs/components/reasoningdetailencryptedformat.md new file mode 100644 index 0000000..5648e15 --- /dev/null +++ b/docs/components/reasoningdetailencryptedformat.md @@ -0,0 +1,13 @@ +# ReasoningDetailEncryptedFormat + + +## Values + +| Name | Value | +| --------------------------- | --------------------------- | +| `UNKNOWN` | unknown | +| `OPENAI_RESPONSES_V1` | openai-responses-v1 | +| `AZURE_OPENAI_RESPONSES_V1` | azure-openai-responses-v1 | +| `XAI_RESPONSES_V1` | xai-responses-v1 | +| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 | +| `GOOGLE_GEMINI_V1` | google-gemini-v1 | \ No newline at end of file diff --git a/docs/components/reasoningdetailencryptedtype.md b/docs/components/reasoningdetailencryptedtype.md new file mode 100644 index 0000000..c574453 --- /dev/null +++ b/docs/components/reasoningdetailencryptedtype.md @@ -0,0 +1,8 @@ +# ReasoningDetailEncryptedType + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `REASONING_ENCRYPTED` | reasoning.encrypted | \ No newline at end of file diff --git a/docs/components/reasoningdetailsummary.md b/docs/components/reasoningdetailsummary.md new file mode 100644 index 0000000..33fcfdf --- /dev/null +++ b/docs/components/reasoningdetailsummary.md @@ -0,0 +1,14 @@ +# ReasoningDetailSummary + +Reasoning detail summary schema + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `type` | [components.ReasoningDetailSummaryType](../components/reasoningdetailsummarytype.md) | :heavy_check_mark: | N/A | +| `summary` | *str* | :heavy_check_mark: | N/A | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `format_` | [OptionalNullable[components.ReasoningDetailSummaryFormat]](../components/reasoningdetailsummaryformat.md) | :heavy_minus_sign: | N/A | +| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/reasoningdetailsummaryformat.md b/docs/components/reasoningdetailsummaryformat.md new file mode 100644 index 0000000..2eae737 --- /dev/null +++ b/docs/components/reasoningdetailsummaryformat.md @@ -0,0 +1,13 @@ +# ReasoningDetailSummaryFormat + + +## Values + +| Name | Value | +| --------------------------- | --------------------------- | +| `UNKNOWN` | unknown | +| `OPENAI_RESPONSES_V1` | openai-responses-v1 | +| `AZURE_OPENAI_RESPONSES_V1` | azure-openai-responses-v1 | +| `XAI_RESPONSES_V1` | xai-responses-v1 | +| `ANTHROPIC_CLAUDE_V1` | anthropic-claude-v1 | +| `GOOGLE_GEMINI_V1` | google-gemini-v1 | \ No newline at end of file diff --git a/docs/components/reasoningdetailsummarytype.md b/docs/components/reasoningdetailsummarytype.md new file mode 100644 index 0000000..6de96b9 --- /dev/null +++ b/docs/components/reasoningdetailsummarytype.md @@ -0,0 +1,8 @@ +# ReasoningDetailSummaryType + + +## Values + +| Name | Value | +| ------------------- | ------------------- | +| `REASONING_SUMMARY` | reasoning.summary | \ No newline at end of file diff --git a/docs/components/reasoningdetailtext.md b/docs/components/reasoningdetailtext.md new file mode 100644 index 0000000..5e224c0 --- /dev/null +++ b/docs/components/reasoningdetailtext.md @@ -0,0 +1,15 @@ +# ReasoningDetailText + +Reasoning detail text schema + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `type` | [components.ReasoningDetailTextType](../components/reasoningdetailtexttype.md) | :heavy_check_mark: | N/A | +| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `format_` | [OptionalNullable[components.ReasoningDetailTextFormat]](../components/reasoningdetailtextformat.md) | :heavy_minus_sign: | N/A | +| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema21.md b/docs/components/reasoningdetailtextformat.md similarity index 94% rename from docs/components/schema21.md rename to docs/components/reasoningdetailtextformat.md index 91687e4..8a48d10 100644 --- a/docs/components/schema21.md +++ b/docs/components/reasoningdetailtextformat.md @@ -1,4 +1,4 @@ -# Schema21 +# ReasoningDetailTextFormat ## Values diff --git a/docs/components/reasoningdetailtexttype.md b/docs/components/reasoningdetailtexttype.md new file mode 100644 index 0000000..2a56e42 --- /dev/null +++ b/docs/components/reasoningdetailtexttype.md @@ -0,0 +1,8 @@ +# ReasoningDetailTextType + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `REASONING_TEXT` | reasoning.text | \ No newline at end of file diff --git a/docs/components/reasoningdetailunion.md b/docs/components/reasoningdetailunion.md new file mode 100644 index 0000000..af977b3 --- /dev/null +++ b/docs/components/reasoningdetailunion.md @@ -0,0 +1,25 @@ +# ReasoningDetailUnion + +Reasoning detail union schema + + +## Supported Types + +### `components.ReasoningDetailSummary` + +```python +value: components.ReasoningDetailSummary = /* values here */ +``` + +### `components.ReasoningDetailEncrypted` + +```python +value: components.ReasoningDetailEncrypted = /* values here */ +``` + +### `components.ReasoningDetailText` + +```python +value: components.ReasoningDetailText = /* values here */ +``` + diff --git a/docs/components/responseformat.md b/docs/components/responseformat.md index e9e9fda..e1a8d06 100644 --- a/docs/components/responseformat.md +++ b/docs/components/responseformat.md @@ -1,5 +1,7 @@ # ResponseFormat +Response format configuration + ## Supported Types @@ -27,9 +29,9 @@ value: components.ResponseFormatJSONSchema = /* values here */ value: components.ResponseFormatTextGrammar = /* values here */ ``` -### `components.ResponseFormatPython` +### `components.ResponseFormatTextPython` ```python -value: components.ResponseFormatPython = /* values here */ +value: components.ResponseFormatTextPython = /* values here */ ``` diff --git a/docs/components/responseformatjsonobject.md b/docs/components/responseformatjsonobject.md index 88c50c4..38d532d 100644 --- a/docs/components/responseformatjsonobject.md +++ b/docs/components/responseformatjsonobject.md @@ -1,8 +1,10 @@ # ResponseFormatJSONObject +JSON object response format + ## Fields -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `type` | *Literal["json_object"]* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `type` | [components.ResponseFormatJSONObjectType](../components/responseformatjsonobjecttype.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/responsesformatjsonobjecttype.md b/docs/components/responseformatjsonobjecttype.md similarity index 78% rename from docs/components/responsesformatjsonobjecttype.md rename to docs/components/responseformatjsonobjecttype.md index 93a2472..c2c2c01 100644 --- a/docs/components/responsesformatjsonobjecttype.md +++ b/docs/components/responseformatjsonobjecttype.md @@ -1,4 +1,4 @@ -# ResponsesFormatJSONObjectType +# ResponseFormatJSONObjectType ## Values diff --git a/docs/components/responseformatjsonschema.md b/docs/components/responseformatjsonschema.md index 680a7ff..86dfc60 100644 --- a/docs/components/responseformatjsonschema.md +++ b/docs/components/responseformatjsonschema.md @@ -1,9 +1,11 @@ # ResponseFormatJSONSchema +JSON Schema response format for structured outputs + ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | -| `type` | *Literal["json_schema"]* | :heavy_check_mark: | N/A | -| `json_schema` | [components.JSONSchemaConfig](../components/jsonschemaconfig.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `type` | [components.ResponseFormatJSONSchemaType](../components/responseformatjsonschematype.md) | :heavy_check_mark: | N/A | | +| `json_schema` | [components.JSONSchemaConfig](../components/jsonschemaconfig.md) | :heavy_check_mark: | JSON Schema configuration object | {
"name": "math_response",
"description": "A mathematical response",
"schema": {
"type": "object",
"properties": {
"answer": {
"type": "number"
}
},
"required": [
"answer"
]
},
"strict": true
} | \ No newline at end of file diff --git a/docs/components/responseformatjsonschematype.md b/docs/components/responseformatjsonschematype.md new file mode 100644 index 0000000..2dc6447 --- /dev/null +++ b/docs/components/responseformatjsonschematype.md @@ -0,0 +1,8 @@ +# ResponseFormatJSONSchemaType + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `JSON_SCHEMA` | json_schema | \ No newline at end of file diff --git a/docs/components/responseformatpython.md b/docs/components/responseformatpython.md deleted file mode 100644 index ca9fc95..0000000 --- a/docs/components/responseformatpython.md +++ /dev/null @@ -1,8 +0,0 @@ -# ResponseFormatPython - - -## Fields - -| Field | Type | Required | Description | -| ------------------- | ------------------- | ------------------- | ------------------- | -| `type` | *Literal["python"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/responseformattext.md b/docs/components/responseformattext.md index 1b66a78..13f9ffe 100644 --- a/docs/components/responseformattext.md +++ b/docs/components/responseformattext.md @@ -1,8 +1,10 @@ # ResponseFormatText +Default text response format + ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `type` | *Literal["text"]* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `type` | [components.ResponseFormatTextType](../components/responseformattexttype.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/responseformattextconfig.md b/docs/components/responseformattextconfig.md index 1cfcf64..9225e2d 100644 --- a/docs/components/responseformattextconfig.md +++ b/docs/components/responseformattextconfig.md @@ -11,10 +11,10 @@ Text response format configuration value: components.ResponsesFormatText = /* values here */ ``` -### `components.ResponsesFormatJSONObject` +### `components.ResponseFormatJSONObject` ```python -value: components.ResponsesFormatJSONObject = /* values here */ +value: components.ResponseFormatJSONObject = /* values here */ ``` ### `components.ResponsesFormatTextJSONSchemaConfig` diff --git a/docs/components/responseformattextgrammar.md b/docs/components/responseformattextgrammar.md index f0590f3..3f293df 100644 --- a/docs/components/responseformattextgrammar.md +++ b/docs/components/responseformattextgrammar.md @@ -1,9 +1,11 @@ # ResponseFormatTextGrammar +Custom grammar response format + ## Fields -| Field | Type | Required | Description | -| -------------------- | -------------------- | -------------------- | -------------------- | -| `type` | *Literal["grammar"]* | :heavy_check_mark: | N/A | -| `grammar` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `type` | [components.ResponseFormatTextGrammarType](../components/responseformattextgrammartype.md) | :heavy_check_mark: | N/A | | +| `grammar` | *str* | :heavy_check_mark: | Custom grammar for text generation | root ::= "yes" \| "no" | \ No newline at end of file diff --git a/docs/components/responseformattextgrammartype.md b/docs/components/responseformattextgrammartype.md new file mode 100644 index 0000000..241e36f --- /dev/null +++ b/docs/components/responseformattextgrammartype.md @@ -0,0 +1,8 @@ +# ResponseFormatTextGrammarType + + +## Values + +| Name | Value | +| --------- | --------- | +| `GRAMMAR` | grammar | \ No newline at end of file diff --git a/docs/components/responseformattextpython.md b/docs/components/responseformattextpython.md new file mode 100644 index 0000000..bf4fdee --- /dev/null +++ b/docs/components/responseformattextpython.md @@ -0,0 +1,10 @@ +# ResponseFormatTextPython + +Python code response format + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `type` | [components.ResponseFormatTextPythonType](../components/responseformattextpythontype.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/engine.md b/docs/components/responseformattextpythontype.md similarity index 52% rename from docs/components/engine.md rename to docs/components/responseformattextpythontype.md index fcea19c..d353701 100644 --- a/docs/components/engine.md +++ b/docs/components/responseformattextpythontype.md @@ -1,9 +1,8 @@ -# Engine +# ResponseFormatTextPythonType ## Values | Name | Value | | -------- | -------- | -| `NATIVE` | native | -| `EXA` | exa | \ No newline at end of file +| `PYTHON` | python | \ No newline at end of file diff --git a/docs/components/responseformattexttype.md b/docs/components/responseformattexttype.md new file mode 100644 index 0000000..819a36d --- /dev/null +++ b/docs/components/responseformattexttype.md @@ -0,0 +1,8 @@ +# ResponseFormatTextType + + +## Values + +| Name | Value | +| ------ | ------ | +| `TEXT` | text | \ No newline at end of file diff --git a/docs/components/responseserrorfield.md b/docs/components/responseserrorfield.md index 52d3492..e21193b 100644 --- a/docs/components/responseserrorfield.md +++ b/docs/components/responseserrorfield.md @@ -5,7 +5,7 @@ Error information returned from the API ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `code` | [components.CodeEnum](../components/codeenum.md) | :heavy_check_mark: | N/A | -| `message` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `code` | [components.Code](../components/code.md) | :heavy_check_mark: | N/A | +| `message` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/responsesformatjsonobject.md b/docs/components/responsesformatjsonobject.md deleted file mode 100644 index f1b0e7a..0000000 --- a/docs/components/responsesformatjsonobject.md +++ /dev/null @@ -1,10 +0,0 @@ -# ResponsesFormatJSONObject - -JSON object response format - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `type` | [components.ResponsesFormatJSONObjectType](../components/responsesformatjsonobjecttype.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/schema0.md b/docs/components/schema0.md deleted file mode 100644 index 0da3160..0000000 --- a/docs/components/schema0.md +++ /dev/null @@ -1,20 +0,0 @@ -# Schema0 - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `allow_fallbacks` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `require_parameters` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `data_collection` | [OptionalNullable[components.Schema3]](../components/schema3.md) | :heavy_minus_sign: | N/A | -| `zdr` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `enforce_distillable_text` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `order` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A | -| `only` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A | -| `ignore` | List[[components.Schema5](../components/schema5.md)] | :heavy_minus_sign: | N/A | -| `quantizations` | List[[components.Schema8](../components/schema8.md)] | :heavy_minus_sign: | N/A | -| `sort` | [OptionalNullable[components.ProviderSortUnion]](../components/providersortunion.md) | :heavy_minus_sign: | N/A | -| `max_price` | [Optional[components.Schema10]](../components/schema10.md) | :heavy_minus_sign: | N/A | -| `preferred_min_throughput` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A | -| `preferred_max_latency` | [OptionalNullable[components.Schema15Union]](../components/schema15union.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema10.md b/docs/components/schema10.md deleted file mode 100644 index 5a5bcf1..0000000 --- a/docs/components/schema10.md +++ /dev/null @@ -1,12 +0,0 @@ -# Schema10 - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `prompt` | [Optional[components.Prompt]](../components/prompt.md) | :heavy_minus_sign: | N/A | -| `completion` | [Optional[components.Completion]](../components/completion.md) | :heavy_minus_sign: | N/A | -| `image` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A | -| `audio` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A | -| `request` | [Optional[components.Schema14]](../components/schema14.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema14.md b/docs/components/schema14.md deleted file mode 100644 index 7fdac48..0000000 --- a/docs/components/schema14.md +++ /dev/null @@ -1,23 +0,0 @@ -# Schema14 - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - -### `Any` - -```python -value: Any = /* values here */ -``` - diff --git a/docs/components/schema15.md b/docs/components/schema15.md deleted file mode 100644 index dc0a8de..0000000 --- a/docs/components/schema15.md +++ /dev/null @@ -1,11 +0,0 @@ -# Schema15 - - -## Fields - -| Field | Type | Required | Description | -| ------------------------- | ------------------------- | ------------------------- | ------------------------- | -| `p50` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `p75` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `p90` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `p99` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema15union.md b/docs/components/schema15union.md deleted file mode 100644 index 261a8d1..0000000 --- a/docs/components/schema15union.md +++ /dev/null @@ -1,17 +0,0 @@ -# Schema15Union - - -## Supported Types - -### `float` - -```python -value: float = /* values here */ -``` - -### `components.Schema15` - -```python -value: components.Schema15 = /* values here */ -``` - diff --git a/docs/components/schema17.md b/docs/components/schema17.md deleted file mode 100644 index e166914..0000000 --- a/docs/components/schema17.md +++ /dev/null @@ -1,35 +0,0 @@ -# Schema17 - - -## Supported Types - -### `components.Schema17AutoRouter` - -```python -value: components.Schema17AutoRouter = /* values here */ -``` - -### `components.Schema17Moderation` - -```python -value: components.Schema17Moderation = /* values here */ -``` - -### `components.Schema17Web` - -```python -value: components.Schema17Web = /* values here */ -``` - -### `components.Schema17FileParser` - -```python -value: components.Schema17FileParser = /* values here */ -``` - -### `components.Schema17ResponseHealing` - -```python -value: components.Schema17ResponseHealing = /* values here */ -``` - diff --git a/docs/components/schema17autorouter.md b/docs/components/schema17autorouter.md deleted file mode 100644 index 8f53379..0000000 --- a/docs/components/schema17autorouter.md +++ /dev/null @@ -1,10 +0,0 @@ -# Schema17AutoRouter - - -## Fields - -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `id` | *Literal["auto-router"]* | :heavy_check_mark: | N/A | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `allowed_models` | List[*str*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema17fileparser.md b/docs/components/schema17fileparser.md deleted file mode 100644 index b5a71fd..0000000 --- a/docs/components/schema17fileparser.md +++ /dev/null @@ -1,10 +0,0 @@ -# Schema17FileParser - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | -| `id` | *Literal["file-parser"]* | :heavy_check_mark: | N/A | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `pdf` | [Optional[components.Pdf]](../components/pdf.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema17moderation.md b/docs/components/schema17moderation.md deleted file mode 100644 index 6f449d8..0000000 --- a/docs/components/schema17moderation.md +++ /dev/null @@ -1,8 +0,0 @@ -# Schema17Moderation - - -## Fields - -| Field | Type | Required | Description | -| ----------------------- | ----------------------- | ----------------------- | ----------------------- | -| `id` | *Literal["moderation"]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/schema17responsehealing.md b/docs/components/schema17responsehealing.md deleted file mode 100644 index 5ef1030..0000000 --- a/docs/components/schema17responsehealing.md +++ /dev/null @@ -1,9 +0,0 @@ -# Schema17ResponseHealing - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------- | ----------------------------- | ----------------------------- | ----------------------------- | -| `id` | *Literal["response-healing"]* | :heavy_check_mark: | N/A | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema17web.md b/docs/components/schema17web.md deleted file mode 100644 index beccd42..0000000 --- a/docs/components/schema17web.md +++ /dev/null @@ -1,12 +0,0 @@ -# Schema17Web - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `id` | *Literal["web"]* | :heavy_check_mark: | N/A | -| `enabled` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `max_results` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `search_prompt` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `engine` | [Optional[components.Engine]](../components/engine.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema19.md b/docs/components/schema19.md deleted file mode 100644 index 2d61cb8..0000000 --- a/docs/components/schema19.md +++ /dev/null @@ -1,23 +0,0 @@ -# Schema19 - - -## Supported Types - -### `components.Schema19ReasoningSummary` - -```python -value: components.Schema19ReasoningSummary = /* values here */ -``` - -### `components.Schema19ReasoningEncrypted` - -```python -value: components.Schema19ReasoningEncrypted = /* values here */ -``` - -### `components.Schema19ReasoningText` - -```python -value: components.Schema19ReasoningText = /* values here */ -``` - diff --git a/docs/components/schema19reasoningencrypted.md b/docs/components/schema19reasoningencrypted.md deleted file mode 100644 index 269b7a5..0000000 --- a/docs/components/schema19reasoningencrypted.md +++ /dev/null @@ -1,12 +0,0 @@ -# Schema19ReasoningEncrypted - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `type` | *Literal["reasoning.encrypted"]* | :heavy_check_mark: | N/A | -| `data` | *str* | :heavy_check_mark: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A | -| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema19reasoningsummary.md b/docs/components/schema19reasoningsummary.md deleted file mode 100644 index a921b0d..0000000 --- a/docs/components/schema19reasoningsummary.md +++ /dev/null @@ -1,12 +0,0 @@ -# Schema19ReasoningSummary - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `type` | *Literal["reasoning.summary"]* | :heavy_check_mark: | N/A | -| `summary` | *str* | :heavy_check_mark: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A | -| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema19reasoningtext.md b/docs/components/schema19reasoningtext.md deleted file mode 100644 index 0790712..0000000 --- a/docs/components/schema19reasoningtext.md +++ /dev/null @@ -1,13 +0,0 @@ -# Schema19ReasoningText - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | -| `type` | *Literal["reasoning.text"]* | :heavy_check_mark: | N/A | -| `text` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `signature` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `format_` | [OptionalNullable[components.Schema21]](../components/schema21.md) | :heavy_minus_sign: | N/A | -| `index` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/components/schema3.md b/docs/components/schema3.md deleted file mode 100644 index 53d01d6..0000000 --- a/docs/components/schema3.md +++ /dev/null @@ -1,9 +0,0 @@ -# Schema3 - - -## Values - -| Name | Value | -| ------- | ------- | -| `DENY` | deny | -| `ALLOW` | allow | \ No newline at end of file diff --git a/docs/components/schema5.md b/docs/components/schema5.md deleted file mode 100644 index 0c115ca..0000000 --- a/docs/components/schema5.md +++ /dev/null @@ -1,17 +0,0 @@ -# Schema5 - - -## Supported Types - -### `components.Schema5Enum` - -```python -value: components.Schema5Enum = /* values here */ -``` - -### `str` - -```python -value: str = /* values here */ -``` - diff --git a/docs/components/schema5enum.md b/docs/components/schema5enum.md deleted file mode 100644 index d6fa747..0000000 --- a/docs/components/schema5enum.md +++ /dev/null @@ -1,79 +0,0 @@ -# Schema5Enum - - -## Values - -| Name | Value | -| ------------------- | ------------------- | -| `AI21` | AI21 | -| `AION_LABS` | AionLabs | -| `ALIBABA` | Alibaba | -| `AMBIENT` | Ambient | -| `AMAZON_BEDROCK` | Amazon Bedrock | -| `AMAZON_NOVA` | Amazon Nova | -| `ANTHROPIC` | Anthropic | -| `ARCEE_AI` | Arcee AI | -| `ATLAS_CLOUD` | AtlasCloud | -| `AVIAN` | Avian | -| `AZURE` | Azure | -| `BASE_TEN` | BaseTen | -| `BYTE_PLUS` | BytePlus | -| `BLACK_FOREST_LABS` | Black Forest Labs | -| `CEREBRAS` | Cerebras | -| `CHUTES` | Chutes | -| `CIRRASCALE` | Cirrascale | -| `CLARIFAI` | Clarifai | -| `CLOUDFLARE` | Cloudflare | -| `COHERE` | Cohere | -| `CRUSOE` | Crusoe | -| `DEEP_INFRA` | DeepInfra | -| `DEEP_SEEK` | DeepSeek | -| `FEATHERLESS` | Featherless | -| `FIREWORKS` | Fireworks | -| `FRIENDLI` | Friendli | -| `GMI_CLOUD` | GMICloud | -| `GOOGLE` | Google | -| `GOOGLE_AI_STUDIO` | Google AI Studio | -| `GROQ` | Groq | -| `HYPERBOLIC` | Hyperbolic | -| `INCEPTION` | Inception | -| `INCEPTRON` | Inceptron | -| `INFERENCE_NET` | InferenceNet | -| `INFERMATIC` | Infermatic | -| `INFLECTION` | Inflection | -| `LIQUID` | Liquid | -| `MARA` | Mara | -| `MANCER_2` | Mancer 2 | -| `MINIMAX` | Minimax | -| `MODEL_RUN` | ModelRun | -| `MISTRAL` | Mistral | -| `MODULAR` | Modular | -| `MOONSHOT_AI` | Moonshot AI | -| `MORPH` | Morph | -| `N_COMPASS` | NCompass | -| `NEBIUS` | Nebius | -| `NEXT_BIT` | NextBit | -| `NOVITA` | Novita | -| `NVIDIA` | Nvidia | -| `OPEN_AI` | OpenAI | -| `OPEN_INFERENCE` | OpenInference | -| `PARASAIL` | Parasail | -| `PERPLEXITY` | Perplexity | -| `PHALA` | Phala | -| `RELACE` | Relace | -| `SAMBA_NOVA` | SambaNova | -| `SEED` | Seed | -| `SILICON_FLOW` | SiliconFlow | -| `SOURCEFUL` | Sourceful | -| `STEP_FUN` | StepFun | -| `STEALTH` | Stealth | -| `STREAM_LAKE` | StreamLake | -| `SWITCHPOINT` | Switchpoint | -| `TOGETHER` | Together | -| `UPSTAGE` | Upstage | -| `VENICE` | Venice | -| `WAND_B` | WandB | -| `XIAOMI` | Xiaomi | -| `X_AI` | xAI | -| `Z_AI` | Z.AI | -| `FAKE_PROVIDER` | FakeProvider | \ No newline at end of file diff --git a/docs/components/schema8.md b/docs/components/schema8.md deleted file mode 100644 index fbf6c51..0000000 --- a/docs/components/schema8.md +++ /dev/null @@ -1,16 +0,0 @@ -# Schema8 - - -## 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/components/stop.md b/docs/components/stop.md index 9cfdaa0..c36d910 100644 --- a/docs/components/stop.md +++ b/docs/components/stop.md @@ -1,5 +1,7 @@ # Stop +Stop sequences (up to 4) + ## Supported Types @@ -15,3 +17,9 @@ value: str = /* values here */ value: List[str] = /* values here */ ``` +### `Any` + +```python +value: Any = /* values here */ +``` + diff --git a/docs/components/systemmessage.md b/docs/components/systemmessage.md index c9180c7..db3080c 100644 --- a/docs/components/systemmessage.md +++ b/docs/components/systemmessage.md @@ -1,10 +1,12 @@ # SystemMessage +System message for setting behavior + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `role` | *Literal["system"]* | :heavy_check_mark: | N/A | -| `content` | [components.SystemMessageContent](../components/systemmessagecontent.md) | :heavy_check_mark: | N/A | -| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `role` | [components.SystemMessageRole](../components/systemmessagerole.md) | :heavy_check_mark: | N/A | | +| `content` | [components.SystemMessageContent](../components/systemmessagecontent.md) | :heavy_check_mark: | System message content | You are a helpful assistant. | +| `name` | *Optional[str]* | :heavy_minus_sign: | Optional name for the system message | Assistant Config | \ No newline at end of file diff --git a/docs/components/systemmessagecontent.md b/docs/components/systemmessagecontent.md index e39433d..17b52f1 100644 --- a/docs/components/systemmessagecontent.md +++ b/docs/components/systemmessagecontent.md @@ -1,5 +1,7 @@ # SystemMessageContent +System message content + ## Supported Types diff --git a/docs/components/systemmessagerole.md b/docs/components/systemmessagerole.md new file mode 100644 index 0000000..232f12a --- /dev/null +++ b/docs/components/systemmessagerole.md @@ -0,0 +1,8 @@ +# SystemMessageRole + + +## Values + +| Name | Value | +| -------- | -------- | +| `SYSTEM` | system | \ No newline at end of file diff --git a/docs/components/toolchoiceoption.md b/docs/components/toolchoiceoption.md new file mode 100644 index 0000000..1637d27 --- /dev/null +++ b/docs/components/toolchoiceoption.md @@ -0,0 +1,31 @@ +# ToolChoiceOption + +Tool choice configuration + + +## Supported Types + +### `components.ToolChoiceOptionNone` + +```python +value: components.ToolChoiceOptionNone = /* values here */ +``` + +### `components.ToolChoiceOptionAuto` + +```python +value: components.ToolChoiceOptionAuto = /* values here */ +``` + +### `components.ToolChoiceOptionRequired` + +```python +value: components.ToolChoiceOptionRequired = /* values here */ +``` + +### `components.NamedToolChoice` + +```python +value: components.NamedToolChoice = /* values here */ +``` + diff --git a/docs/components/toolchoiceoptionauto.md b/docs/components/toolchoiceoptionauto.md new file mode 100644 index 0000000..01373bb --- /dev/null +++ b/docs/components/toolchoiceoptionauto.md @@ -0,0 +1,8 @@ +# ToolChoiceOptionAuto + + +## Values + +| Name | Value | +| ------ | ------ | +| `AUTO` | auto | \ No newline at end of file diff --git a/docs/components/toolchoiceoptionnone.md b/docs/components/toolchoiceoptionnone.md new file mode 100644 index 0000000..719ec28 --- /dev/null +++ b/docs/components/toolchoiceoptionnone.md @@ -0,0 +1,8 @@ +# ToolChoiceOptionNone + + +## Values + +| Name | Value | +| ------ | ------ | +| `NONE` | none | \ No newline at end of file diff --git a/docs/components/toolchoiceoptionrequired.md b/docs/components/toolchoiceoptionrequired.md new file mode 100644 index 0000000..af43202 --- /dev/null +++ b/docs/components/toolchoiceoptionrequired.md @@ -0,0 +1,8 @@ +# ToolChoiceOptionRequired + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `REQUIRED` | required | \ No newline at end of file diff --git a/docs/components/tooldefinitionjson.md b/docs/components/tooldefinitionjson.md index ec7db42..2a327b7 100644 --- a/docs/components/tooldefinitionjson.md +++ b/docs/components/tooldefinitionjson.md @@ -1,9 +1,12 @@ # ToolDefinitionJSON +Tool definition for function calling + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `type` | *Literal["function"]* | :heavy_check_mark: | N/A | -| `function` | [components.ToolDefinitionJSONFunction](../components/tooldefinitionjsonfunction.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `type` | [components.ToolDefinitionJSONType](../components/tooldefinitionjsontype.md) | :heavy_check_mark: | N/A | | +| `function` | [components.ToolDefinitionJSONFunction](../components/tooldefinitionjsonfunction.md) | :heavy_check_mark: | Function definition for tool calling | {
"name": "get_weather",
"description": "Get the current weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name"
}
},
"required": [
"location"
]
}
} | +| `cache_control` | [Optional[components.ChatMessageContentItemCacheControl]](../components/chatmessagecontentitemcachecontrol.md) | :heavy_minus_sign: | Cache control for the content part | {
"type": "ephemeral",
"ttl": "5m"
} | \ No newline at end of file diff --git a/docs/components/tooldefinitionjsonfunction.md b/docs/components/tooldefinitionjsonfunction.md index 4ae1dcc..d2863a1 100644 --- a/docs/components/tooldefinitionjsonfunction.md +++ b/docs/components/tooldefinitionjsonfunction.md @@ -1,11 +1,13 @@ # ToolDefinitionJSONFunction +Function definition for tool calling + ## Fields -| Field | Type | Required | Description | -| ------------------------ | ------------------------ | ------------------------ | ------------------------ | -| `name` | *str* | :heavy_check_mark: | N/A | -| `description` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `parameters` | Dict[str, *Any*] | :heavy_minus_sign: | N/A | -| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *str* | :heavy_check_mark: | Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars) | get_weather | +| `description` | *Optional[str]* | :heavy_minus_sign: | Function description for the model | Get the current weather for a location | +| `parameters` | Dict[str, *Nullable[Any]*] | :heavy_minus_sign: | Function parameters as JSON Schema object | {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City name"
}
},
"required": [
"location"
]
} | +| `strict` | *OptionalNullable[bool]* | :heavy_minus_sign: | Enable strict schema adherence | false | \ No newline at end of file diff --git a/docs/components/tooldefinitionjsontype.md b/docs/components/tooldefinitionjsontype.md new file mode 100644 index 0000000..ffa142d --- /dev/null +++ b/docs/components/tooldefinitionjsontype.md @@ -0,0 +1,8 @@ +# ToolDefinitionJSONType + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `FUNCTION` | function | \ No newline at end of file diff --git a/docs/components/toolresponsemessage.md b/docs/components/toolresponsemessage.md index d91b507..dcfa91b 100644 --- a/docs/components/toolresponsemessage.md +++ b/docs/components/toolresponsemessage.md @@ -1,10 +1,12 @@ # ToolResponseMessage +Tool response message + ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `role` | *Literal["tool"]* | :heavy_check_mark: | N/A | -| `content` | [components.ToolResponseMessageContent](../components/toolresponsemessagecontent.md) | :heavy_check_mark: | N/A | -| `tool_call_id` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `role` | [components.ToolResponseMessageRole](../components/toolresponsemessagerole.md) | :heavy_check_mark: | N/A | | +| `content` | [components.ToolResponseMessageContent](../components/toolresponsemessagecontent.md) | :heavy_check_mark: | Tool response content | The weather in San Francisco is 72°F and sunny. | +| `tool_call_id` | *str* | :heavy_check_mark: | ID of the assistant message tool call this message responds to | call_abc123 | \ No newline at end of file diff --git a/docs/components/toolresponsemessagecontent.md b/docs/components/toolresponsemessagecontent.md index 522f856..98f6770 100644 --- a/docs/components/toolresponsemessagecontent.md +++ b/docs/components/toolresponsemessagecontent.md @@ -1,5 +1,7 @@ # ToolResponseMessageContent +Tool response content + ## Supported Types diff --git a/docs/components/toolresponsemessagerole.md b/docs/components/toolresponsemessagerole.md new file mode 100644 index 0000000..f919504 --- /dev/null +++ b/docs/components/toolresponsemessagerole.md @@ -0,0 +1,8 @@ +# ToolResponseMessageRole + + +## Values + +| Name | Value | +| ------ | ------ | +| `TOOL` | tool | \ No newline at end of file diff --git a/docs/components/usermessage.md b/docs/components/usermessage.md index b0da4b0..40e7787 100644 --- a/docs/components/usermessage.md +++ b/docs/components/usermessage.md @@ -1,10 +1,12 @@ # UserMessage +User message + ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `role` | *Literal["user"]* | :heavy_check_mark: | N/A | -| `content` | [components.UserMessageContent](../components/usermessagecontent.md) | :heavy_check_mark: | N/A | -| `name` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `role` | [components.UserMessageRole](../components/usermessagerole.md) | :heavy_check_mark: | N/A | | +| `content` | [components.UserMessageContent](../components/usermessagecontent.md) | :heavy_check_mark: | User message content | What is the capital of France? | +| `name` | *Optional[str]* | :heavy_minus_sign: | Optional name for the user | User | \ No newline at end of file diff --git a/docs/components/usermessagecontent.md b/docs/components/usermessagecontent.md index bed6ace..e3483ff 100644 --- a/docs/components/usermessagecontent.md +++ b/docs/components/usermessagecontent.md @@ -1,5 +1,7 @@ # UserMessageContent +User message content + ## Supported Types diff --git a/docs/components/usermessagerole.md b/docs/components/usermessagerole.md new file mode 100644 index 0000000..171124e --- /dev/null +++ b/docs/components/usermessagerole.md @@ -0,0 +1,8 @@ +# UserMessageRole + + +## Values + +| Name | Value | +| ------ | ------ | +| `USER` | user | \ No newline at end of file diff --git a/docs/components/videoinput.md b/docs/components/videoinput.md new file mode 100644 index 0000000..aefea98 --- /dev/null +++ b/docs/components/videoinput.md @@ -0,0 +1,10 @@ +# VideoInput + +Video input object + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | +| `url` | *str* | :heavy_check_mark: | URL of the video (data: URLs supported) | \ No newline at end of file diff --git a/docs/components/videourl1.md b/docs/components/videourl1.md deleted file mode 100644 index 505c186..0000000 --- a/docs/components/videourl1.md +++ /dev/null @@ -1,8 +0,0 @@ -# VideoURL1 - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `url` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/components/videourl2.md b/docs/components/videourl2.md deleted file mode 100644 index b7f2463..0000000 --- a/docs/components/videourl2.md +++ /dev/null @@ -1,8 +0,0 @@ -# VideoURL2 - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `url` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/errors/chaterror.md b/docs/errors/chaterror.md deleted file mode 100644 index b0b2ac3..0000000 --- a/docs/errors/chaterror.md +++ /dev/null @@ -1,8 +0,0 @@ -# ChatError - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| `error` | [components.ChatErrorError](../components/chaterrorerror.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/operations/createauthkeyscoderequestbody.md b/docs/operations/createauthkeyscoderequestbody.md index 30f40d0..76ceb7b 100644 --- a/docs/operations/createauthkeyscoderequestbody.md +++ b/docs/operations/createauthkeyscoderequestbody.md @@ -9,4 +9,6 @@ | `code_challenge` | *Optional[str]* | :heavy_minus_sign: | PKCE code challenge for enhanced security | E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM | | `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | | `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | -| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | | \ No newline at end of file +| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | | +| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key | +| `usage_limit_type` | [Optional[operations.UsageLimitType]](../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly | \ No newline at end of file diff --git a/docs/operations/providername.md b/docs/operations/providername.md index d9111d6..86b88ca 100644 --- a/docs/operations/providername.md +++ b/docs/operations/providername.md @@ -67,7 +67,9 @@ | `INCEPTION` | Inception | | `INCEPTRON` | Inceptron | | `INFERENCE_NET` | InferenceNet | +| `IONSTREAM` | Ionstream | | `INFERMATIC` | Infermatic | +| `IO_NET` | Io Net | | `INFLECTION` | Inflection | | `LIQUID` | Liquid | | `MARA` | Mara | diff --git a/docs/operations/sendchatcompletionrequestrequest.md b/docs/operations/sendchatcompletionrequestrequest.md index f3f4abc..9eefdae 100644 --- a/docs/operations/sendchatcompletionrequestrequest.md +++ b/docs/operations/sendchatcompletionrequestrequest.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| -| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| -| `chat_generation_params` | [components.ChatGenerationParams](../components/chatgenerationparams.md) | :heavy_check_mark: | Chat completion request parameters | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `chat_generation_params` | [components.ChatGenerationParams](../components/chatgenerationparams.md) | :heavy_check_mark: | N/A | {
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "What is the capital of France?"
}
],
"model": "openai/gpt-4",
"temperature": 0.7,
"max_tokens": 150
} | \ No newline at end of file diff --git a/docs/operations/sendchatcompletionrequestresponse.md b/docs/operations/sendchatcompletionrequestresponse.md index 8e41883..4bdd885 100644 --- a/docs/operations/sendchatcompletionrequestresponse.md +++ b/docs/operations/sendchatcompletionrequestresponse.md @@ -9,9 +9,9 @@ value: components.ChatResponse = /* values here */ ``` -### `Union[eventstreaming.EventStream[components.ChatStreamingResponseChunkData], eventstreaming.EventStreamAsync[components.ChatStreamingResponseChunkData]]` +### `Union[eventstreaming.EventStream[components.ChatStreamingResponseChunk], eventstreaming.EventStreamAsync[components.ChatStreamingResponseChunk]]` ```python -value: Union[eventstreaming.EventStream[components.ChatStreamingResponseChunkData], eventstreaming.EventStreamAsync[components.ChatStreamingResponseChunkData]] = /* values here */ +value: Union[eventstreaming.EventStream[components.ChatStreamingResponseChunk], eventstreaming.EventStreamAsync[components.ChatStreamingResponseChunk]] = /* values here */ ``` diff --git a/docs/operations/sendchatcompletionrequestresponsebody.md b/docs/operations/sendchatcompletionrequestresponsebody.md new file mode 100644 index 0000000..82acd8b --- /dev/null +++ b/docs/operations/sendchatcompletionrequestresponsebody.md @@ -0,0 +1,10 @@ +# SendChatCompletionRequestResponseBody + +Successful chat completion response + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `data` | [components.ChatStreamingResponseChunk](../components/chatstreamingresponsechunk.md) | :heavy_check_mark: | Streaming chat completion chunk | {
"id": "chatcmpl-123",
"object": "chat.completion.chunk",
"created": 1677652288,
"model": "openai/gpt-4",
"choices": [
{
"index": 0,
"delta": {
"role": "assistant",
"content": "Hello"
},
"finish_reason": null
}
]
} | \ No newline at end of file diff --git a/docs/operations/usagelimittype.md b/docs/operations/usagelimittype.md new file mode 100644 index 0000000..0d9e7c8 --- /dev/null +++ b/docs/operations/usagelimittype.md @@ -0,0 +1,12 @@ +# UsageLimitType + +Optional credit limit reset interval. When set, the credit limit resets on this interval. + + +## Values + +| Name | Value | +| --------- | --------- | +| `DAILY` | daily | +| `WEEKLY` | weekly | +| `MONTHLY` | monthly | \ No newline at end of file diff --git a/docs/sdks/chat/README.md b/docs/sdks/chat/README.md index 9e30497..a64005c 100644 --- a/docs/sdks/chat/README.md +++ b/docs/sdks/chat/README.md @@ -25,7 +25,16 @@ with OpenRouter( api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: - res = open_router.chat.send(messages=[], stream=False) + res = open_router.chat.send(messages=[ + { + "role": "system", + "content": "You are a helpful assistant.", + }, + { + "role": "user", + "content": "What is the capital of France?", + }, + ], stream=False, temperature=0.7, top_p=1) with res as event_stream: for event in event_stream: @@ -36,40 +45,41 @@ with OpenRouter( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | N/A | -| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| -| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| -| `provider` | [OptionalNullable[components.Schema0]](../../components/schema0.md) | :heavy_minus_sign: | N/A | -| `plugins` | List[[components.Schema17](../../components/schema17.md)] | :heavy_minus_sign: | N/A | -| `route` | [OptionalNullable[components.Route]](../../components/route.md) | :heavy_minus_sign: | N/A | -| `user` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `session_id` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `model` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `models` | List[*str*] | :heavy_minus_sign: | N/A | -| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | N/A | -| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | -| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | N/A | -| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | N/A | -| `response_format` | [Optional[components.ResponseFormat]](../../components/responseformat.md) | :heavy_minus_sign: | N/A | -| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | N/A | -| `stop` | [OptionalNullable[components.Stop]](../../components/stop.md) | :heavy_minus_sign: | N/A | -| `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | -| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | N/A | -| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `tool_choice` | *Optional[Any]* | :heavy_minus_sign: | N/A | -| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | N/A | -| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | N/A | -| `debug` | [Optional[components.Debug]](../../components/debug.md) | :heavy_minus_sign: | N/A | -| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | N/A | -| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `messages` | List[[components.Message](../../components/message.md)] | :heavy_check_mark: | List of messages for the conversation | [
{
"role": "user",
"content": "Hello!"
}
] | +| `http_referer` | *Optional[str]* | :heavy_minus_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | +| `x_title` | *Optional[str]* | :heavy_minus_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | +| `provider` | [OptionalNullable[components.ChatGenerationParamsProvider]](../../components/chatgenerationparamsprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[components.ChatGenerationParamsPluginUnion](../../components/chatgenerationparamspluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `user` | *Optional[str]* | :heavy_minus_sign: | Unique user identifier | user-123 | +| `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | +| `trace` | [Optional[components.ChatGenerationParamsTrace]](../../components/chatgenerationparamstrace.md) | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | | +| `model` | *Optional[str]* | :heavy_minus_sign: | Model to use for completion | openai/gpt-4 | +| `models` | List[*str*] | :heavy_minus_sign: | Models to use for completion | [
"openai/gpt-4",
"openai/gpt-4o"
] | +| `frequency_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Frequency penalty (-2.0 to 2.0) | 0 | +| `logit_bias` | Dict[str, *float*] | :heavy_minus_sign: | Token logit bias adjustments | {
"50256": -100
} | +| `logprobs` | *OptionalNullable[bool]* | :heavy_minus_sign: | Return log probabilities | false | +| `top_logprobs` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of top log probabilities to return (0-20) | 5 | +| `max_completion_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens in completion | 100 | +| `max_tokens` | *OptionalNullable[float]* | :heavy_minus_sign: | Maximum tokens (deprecated, use max_completion_tokens) | 100 | +| `metadata` | Dict[str, *str*] | :heavy_minus_sign: | Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values) | {
"user_id": "user-123",
"session_id": "session-456"
} | +| `presence_penalty` | *OptionalNullable[float]* | :heavy_minus_sign: | Presence penalty (-2.0 to 2.0) | 0 | +| `reasoning` | [Optional[components.Reasoning]](../../components/reasoning.md) | :heavy_minus_sign: | Configuration options for reasoning models | {
"effort": "medium",
"summary": "concise"
} | +| `response_format` | [Optional[components.ResponseFormat]](../../components/responseformat.md) | :heavy_minus_sign: | Response format configuration | {
"type": "json_object"
} | +| `seed` | *OptionalNullable[int]* | :heavy_minus_sign: | Random seed for deterministic outputs | 42 | +| `stop` | [OptionalNullable[components.Stop]](../../components/stop.md) | :heavy_minus_sign: | Stop sequences (up to 4) | [
""
] | +| `stream` | *Optional[bool]* | :heavy_minus_sign: | Enable streaming response | false | +| `stream_options` | [OptionalNullable[components.ChatStreamOptions]](../../components/chatstreamoptions.md) | :heavy_minus_sign: | Streaming configuration options | {
"include_usage": true
} | +| `temperature` | *OptionalNullable[float]* | :heavy_minus_sign: | Sampling temperature (0-2) | 0.7 | +| `parallel_tool_calls` | *OptionalNullable[bool]* | :heavy_minus_sign: | N/A | | +| `tool_choice` | [Optional[components.ToolChoiceOption]](../../components/toolchoiceoption.md) | :heavy_minus_sign: | Tool choice configuration | auto | +| `tools` | List[[components.ToolDefinitionJSON](../../components/tooldefinitionjson.md)] | :heavy_minus_sign: | Available tools for function calling | [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather"
}
}
] | +| `top_p` | *OptionalNullable[float]* | :heavy_minus_sign: | Nucleus sampling parameter (0-1) | 1 | +| `debug` | [Optional[components.DebugOptions]](../../components/debugoptions.md) | :heavy_minus_sign: | Debug options for inspecting request transformations (streaming only) | {
"echo_upstream_body": true
} | +| `image_config` | Dict[str, [components.ChatGenerationParamsImageConfig](../../components/chatgenerationparamsimageconfig.md)] | :heavy_minus_sign: | Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. | {
"aspect_ratio": "16:9"
} | +| `modalities` | List[[components.Modality](../../components/modality.md)] | :heavy_minus_sign: | Output modalities for the response. Supported values are "text" and "image". | [
"text",
"image"
] | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response @@ -77,8 +87,19 @@ with OpenRouter( ### Errors -| Error Type | Status Code | Content Type | -| ----------------------------- | ----------------------------- | ----------------------------- | -| errors.ChatError | 400, 401, 429 | application/json | -| errors.ChatError | 500 | application/json | -| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file +| Error Type | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.PaymentRequiredResponseError | 402 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.RequestTimeoutResponseError | 408 | application/json | +| errors.PayloadTooLargeResponseError | 413 | application/json | +| errors.UnprocessableEntityResponseError | 422 | application/json | +| errors.TooManyRequestsResponseError | 429 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.BadGatewayResponseError | 502 | application/json | +| errors.ServiceUnavailableResponseError | 503 | application/json | +| errors.EdgeNetworkTimeoutResponseError | 524 | application/json | +| errors.ProviderOverloadedResponseError | 529 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/oauth/README.md b/docs/sdks/oauth/README.md index 39af951..198b2d6 100644 --- a/docs/sdks/oauth/README.md +++ b/docs/sdks/oauth/README.md @@ -95,6 +95,8 @@ with OpenRouter( | `code_challenge_method` | [Optional[operations.CreateAuthKeysCodeCodeChallengeMethod]](../../operations/createauthkeyscodecodechallengemethod.md) | :heavy_minus_sign: | The method used to generate the code challenge | S256 | | `limit` | *Optional[float]* | :heavy_minus_sign: | Credit limit for the API key to be created | 100 | | `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Optional expiration time for the API key to be created | | +| `key_label` | *Optional[str]* | :heavy_minus_sign: | Optional custom label for the API key. Defaults to the app name if not provided. | My Custom Key | +| `usage_limit_type` | [Optional[operations.UsageLimitType]](../../operations/usagelimittype.md) | :heavy_minus_sign: | Optional credit limit reset interval. When set, the credit limit resets on this interval. | monthly | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/docs/sdks/responses/README.md b/docs/sdks/responses/README.md index e8199a7..0a725df 100644 --- a/docs/sdks/responses/README.md +++ b/docs/sdks/responses/README.md @@ -71,10 +71,11 @@ with OpenRouter( | `service_tier` | [Optional[components.ServiceTier]](../../components/servicetier.md) | :heavy_minus_sign: | N/A | | | `truncation` | [OptionalNullable[components.Truncation]](../../components/truncation.md) | :heavy_minus_sign: | N/A | auto | | `stream` | *Optional[bool]* | :heavy_minus_sign: | N/A | | -| `provider` | [OptionalNullable[components.Provider]](../../components/provider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | -| `plugins` | List[[components.Plugin](../../components/plugin.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | +| `provider` | [OptionalNullable[components.OpenResponsesRequestProvider]](../../components/openresponsesrequestprovider.md) | :heavy_minus_sign: | When multiple model providers are available, optionally indicate your routing preference. | | +| `plugins` | List[[components.OpenResponsesRequestPluginUnion](../../components/openresponsesrequestpluginunion.md)] | :heavy_minus_sign: | Plugins you want to enable for this request, including their settings. | | | `user` | *Optional[str]* | :heavy_minus_sign: | A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. | | | `session_id` | *Optional[str]* | :heavy_minus_sign: | A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. | | +| `trace` | [Optional[components.OpenResponsesRequestTrace]](../../components/openresponsesrequesttrace.md) | :heavy_minus_sign: | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | | | `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | ### Response diff --git a/pyproject.toml b/pyproject.toml index c8cdf36..0d48888 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrouter" -version = "0.6.0" +version = "0.7.11" description = "Official Python Client SDK for OpenRouter." authors = [{ name = "OpenRouter" },] readme = "README-PYPI.md" diff --git a/src/openrouter/_version.py b/src/openrouter/_version.py index 8023550..8cf17ae 100644 --- a/src/openrouter/_version.py +++ b/src/openrouter/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "openrouter" -__version__: str = "0.6.0" +__version__: str = "0.7.11" __openapi_doc_version__: str = "1.0.0" __gen_version__: str = "2.768.0" -__user_agent__: str = "speakeasy-sdk/python 0.6.0 2.768.0 1.0.0 openrouter" +__user_agent__: str = "speakeasy-sdk/python 0.7.11 2.768.0 1.0.0 openrouter" try: if __package__ is not None: diff --git a/src/openrouter/chat.py b/src/openrouter/chat.py index 027d898..0830ebe 100644 --- a/src/openrouter/chat.py +++ b/src/openrouter/chat.py @@ -24,14 +24,25 @@ class Chat(BaseSDK): http_referer: Optional[str] = None, x_title: Optional[str] = None, provider: OptionalNullable[ - Union[components.Schema0, components.Schema0TypedDict] + Union[ + components.ChatGenerationParamsProvider, + components.ChatGenerationParamsProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Schema17], List[components.Schema17TypedDict]] + Union[ + List[components.ChatGenerationParamsPluginUnion], + List[components.ChatGenerationParamsPluginUnionTypedDict], + ] ] = None, - route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.ChatGenerationParamsTrace, + components.ChatGenerationParamsTraceTypedDict, + ] + ] = None, model: Optional[str] = None, models: Optional[List[str]] = None, frequency_penalty: OptionalNullable[float] = UNSET, @@ -56,16 +67,21 @@ class Chat(BaseSDK): stream_options: OptionalNullable[ Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict] ] = UNSET, - temperature: OptionalNullable[float] = UNSET, - tool_choice: Optional[Any] = None, + temperature: OptionalNullable[float] = 1, + parallel_tool_calls: OptionalNullable[bool] = UNSET, + tool_choice: Optional[ + Union[components.ToolChoiceOption, components.ToolChoiceOptionTypedDict] + ] = None, tools: Optional[ Union[ List[components.ToolDefinitionJSON], List[components.ToolDefinitionJSONTypedDict], ] ] = None, - top_p: OptionalNullable[float] = UNSET, - debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, + top_p: OptionalNullable[float] = 1, + debug: Optional[ + Union[components.DebugOptions, components.DebugOptionsTypedDict] + ] = None, image_config: Optional[ Union[ Dict[str, components.ChatGenerationParamsImageConfig], @@ -82,40 +98,41 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. - :param messages: + :param messages: List of messages for the conversation :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. - :param provider: - :param plugins: - :param route: - :param user: - :param session_id: - :param model: - :param models: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param top_logprobs: - :param max_completion_tokens: - :param max_tokens: - :param metadata: - :param presence_penalty: - :param reasoning: - :param response_format: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param temperature: - :param tool_choice: - :param tools: - :param top_p: - :param debug: - :param image_config: - :param modalities: + :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 user: Unique user identifier + :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + :param model: Model to use for completion + :param models: Models 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: Configuration options for reasoning models + :param response_format: Response format configuration + :param seed: Random seed for deterministic outputs + :param stop: Stop sequences (up to 4) + :param stream: Enable streaming response + :param stream_options: Streaming configuration options + :param temperature: Sampling temperature (0-2) + :param parallel_tool_calls: + :param tool_choice: Tool choice configuration + :param tools: Available tools for function calling + :param top_p: Nucleus sampling parameter (0-1) + :param debug: Debug options for inspecting request transformations (streaming only) + :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. + :param modalities: Output modalities for the response. Supported values are \"text\" and \"image\". :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 @@ -131,14 +148,25 @@ class Chat(BaseSDK): http_referer: Optional[str] = None, x_title: Optional[str] = None, provider: OptionalNullable[ - Union[components.Schema0, components.Schema0TypedDict] + Union[ + components.ChatGenerationParamsProvider, + components.ChatGenerationParamsProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Schema17], List[components.Schema17TypedDict]] + Union[ + List[components.ChatGenerationParamsPluginUnion], + List[components.ChatGenerationParamsPluginUnionTypedDict], + ] ] = None, - route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.ChatGenerationParamsTrace, + components.ChatGenerationParamsTraceTypedDict, + ] + ] = None, model: Optional[str] = None, models: Optional[List[str]] = None, frequency_penalty: OptionalNullable[float] = UNSET, @@ -163,16 +191,21 @@ class Chat(BaseSDK): stream_options: OptionalNullable[ Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict] ] = UNSET, - temperature: OptionalNullable[float] = UNSET, - tool_choice: Optional[Any] = None, + temperature: OptionalNullable[float] = 1, + parallel_tool_calls: OptionalNullable[bool] = UNSET, + tool_choice: Optional[ + Union[components.ToolChoiceOption, components.ToolChoiceOptionTypedDict] + ] = None, tools: Optional[ Union[ List[components.ToolDefinitionJSON], List[components.ToolDefinitionJSONTypedDict], ] ] = None, - top_p: OptionalNullable[float] = UNSET, - debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, + top_p: OptionalNullable[float] = 1, + debug: Optional[ + Union[components.DebugOptions, components.DebugOptionsTypedDict] + ] = None, image_config: Optional[ Union[ Dict[str, components.ChatGenerationParamsImageConfig], @@ -184,45 +217,46 @@ class Chat(BaseSDK): server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> eventstreaming.EventStream[components.ChatStreamingResponseChunkData]: + ) -> eventstreaming.EventStream[components.ChatStreamingResponseChunk]: r"""Create a chat completion Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. - :param messages: + :param messages: List of messages for the conversation :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. - :param provider: - :param plugins: - :param route: - :param user: - :param session_id: - :param model: - :param models: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param top_logprobs: - :param max_completion_tokens: - :param max_tokens: - :param metadata: - :param presence_penalty: - :param reasoning: - :param response_format: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param temperature: - :param tool_choice: - :param tools: - :param top_p: - :param debug: - :param image_config: - :param modalities: + :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 user: Unique user identifier + :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + :param model: Model to use for completion + :param models: Models 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: Configuration options for reasoning models + :param response_format: Response format configuration + :param seed: Random seed for deterministic outputs + :param stop: Stop sequences (up to 4) + :param stream: Enable streaming response + :param stream_options: Streaming configuration options + :param temperature: Sampling temperature (0-2) + :param parallel_tool_calls: + :param tool_choice: Tool choice configuration + :param tools: Available tools for function calling + :param top_p: Nucleus sampling parameter (0-1) + :param debug: Debug options for inspecting request transformations (streaming only) + :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. + :param modalities: Output modalities for the response. Supported values are \"text\" and \"image\". :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 @@ -237,14 +271,25 @@ class Chat(BaseSDK): http_referer: Optional[str] = None, x_title: Optional[str] = None, provider: OptionalNullable[ - Union[components.Schema0, components.Schema0TypedDict] + Union[ + components.ChatGenerationParamsProvider, + components.ChatGenerationParamsProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Schema17], List[components.Schema17TypedDict]] + Union[ + List[components.ChatGenerationParamsPluginUnion], + List[components.ChatGenerationParamsPluginUnionTypedDict], + ] ] = None, - route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.ChatGenerationParamsTrace, + components.ChatGenerationParamsTraceTypedDict, + ] + ] = None, model: Optional[str] = None, models: Optional[List[str]] = None, frequency_penalty: OptionalNullable[float] = UNSET, @@ -269,16 +314,21 @@ class Chat(BaseSDK): stream_options: OptionalNullable[ Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict] ] = UNSET, - temperature: OptionalNullable[float] = UNSET, - tool_choice: Optional[Any] = None, + temperature: OptionalNullable[float] = 1, + parallel_tool_calls: OptionalNullable[bool] = UNSET, + tool_choice: Optional[ + Union[components.ToolChoiceOption, components.ToolChoiceOptionTypedDict] + ] = None, tools: Optional[ Union[ List[components.ToolDefinitionJSON], List[components.ToolDefinitionJSONTypedDict], ] ] = None, - top_p: OptionalNullable[float] = UNSET, - debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, + top_p: OptionalNullable[float] = 1, + debug: Optional[ + Union[components.DebugOptions, components.DebugOptionsTypedDict] + ] = None, image_config: Optional[ Union[ Dict[str, components.ChatGenerationParamsImageConfig], @@ -295,40 +345,41 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. - :param messages: + :param messages: List of messages for the conversation :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. - :param provider: - :param plugins: - :param route: - :param user: - :param session_id: - :param model: - :param models: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param top_logprobs: - :param max_completion_tokens: - :param max_tokens: - :param metadata: - :param presence_penalty: - :param reasoning: - :param response_format: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param temperature: - :param tool_choice: - :param tools: - :param top_p: - :param debug: - :param image_config: - :param modalities: + :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 user: Unique user identifier + :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + :param model: Model to use for completion + :param models: Models 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: Configuration options for reasoning models + :param response_format: Response format configuration + :param seed: Random seed for deterministic outputs + :param stop: Stop sequences (up to 4) + :param stream: Enable streaming response + :param stream_options: Streaming configuration options + :param temperature: Sampling temperature (0-2) + :param parallel_tool_calls: + :param tool_choice: Tool choice configuration + :param tools: Available tools for function calling + :param top_p: Nucleus sampling parameter (0-1) + :param debug: Debug options for inspecting request transformations (streaming only) + :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. + :param modalities: Output modalities for the response. Supported values are \"text\" and \"image\". :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 @@ -350,14 +401,16 @@ class Chat(BaseSDK): x_title=x_title, chat_generation_params=components.ChatGenerationParams( provider=utils.get_pydantic_model( - provider, OptionalNullable[components.Schema0] + provider, OptionalNullable[components.ChatGenerationParamsProvider] ), plugins=utils.get_pydantic_model( - plugins, Optional[List[components.Schema17]] + plugins, Optional[List[components.ChatGenerationParamsPluginUnion]] ), - route=route, user=user, session_id=session_id, + trace=utils.get_pydantic_model( + trace, Optional[components.ChatGenerationParamsTrace] + ), messages=utils.get_pydantic_model(messages, List[components.Message]), model=model, models=models, @@ -382,12 +435,17 @@ class Chat(BaseSDK): stream_options, OptionalNullable[components.ChatStreamOptions] ), temperature=temperature, - tool_choice=tool_choice, + parallel_tool_calls=parallel_tool_calls, + tool_choice=utils.get_pydantic_model( + tool_choice, Optional[components.ToolChoiceOption] + ), tools=utils.get_pydantic_model( tools, Optional[List[components.ToolDefinitionJSON]] ), top_p=top_p, - debug=utils.get_pydantic_model(debug, Optional[components.Debug]), + debug=utils.get_pydantic_model( + debug, Optional[components.DebugOptions] + ), image_config=image_config, modalities=modalities, ), @@ -440,7 +498,23 @@ class Chat(BaseSDK): ), ), request=req, - error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], + error_status_codes=[ + "400", + "401", + "402", + "404", + "408", + "413", + "422", + "429", + "4XX", + "500", + "502", + "503", + "524", + "529", + "5XX", + ], stream=True, retry_config=retry_config, ) @@ -455,23 +529,109 @@ class Chat(BaseSDK): return eventstreaming.EventStream( http_res, lambda raw: utils.unmarshal_json( - raw, components.ChatStreamingResponseChunk + raw, operations.SendChatCompletionRequestResponseBody ).data, sentinel="[DONE]", client_ref=self, ) - if utils.match_response(http_res, ["400", "401", "429"], "application/json"): + if utils.match_response(http_res, "400", "application/json"): http_res_text = utils.stream_to_text(http_res) response_data = unmarshal_json_response( - errors.ChatErrorData, http_res, http_res_text + errors.BadRequestResponseErrorData, http_res, http_res_text + ) + raise errors.BadRequestResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "401", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res, http_res_text + ) + raise errors.UnauthorizedResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "402", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.PaymentRequiredResponseErrorData, http_res, http_res_text + ) + raise errors.PaymentRequiredResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "404", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res, http_res_text + ) + raise errors.NotFoundResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "408", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.RequestTimeoutResponseErrorData, http_res, http_res_text + ) + raise errors.RequestTimeoutResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "413", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.PayloadTooLargeResponseErrorData, http_res, http_res_text + ) + raise errors.PayloadTooLargeResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "422", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.UnprocessableEntityResponseErrorData, http_res, http_res_text + ) + raise errors.UnprocessableEntityResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "429", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res, http_res_text + ) + raise errors.TooManyRequestsResponseError( + response_data, http_res, http_res_text ) - raise errors.ChatError(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.ChatErrorData, http_res, http_res_text + errors.InternalServerResponseErrorData, http_res, http_res_text + ) + raise errors.InternalServerResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "502", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res, http_res_text + ) + raise errors.BadGatewayResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "503", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res, http_res_text + ) + raise errors.ServiceUnavailableResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "524", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res, http_res_text + ) + raise errors.EdgeNetworkTimeoutResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "529", "application/json"): + http_res_text = utils.stream_to_text(http_res) + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res, http_res_text + ) + raise errors.ProviderOverloadedResponseError( + response_data, http_res, http_res_text ) - raise errors.ChatError(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( @@ -496,14 +656,25 @@ class Chat(BaseSDK): http_referer: Optional[str] = None, x_title: Optional[str] = None, provider: OptionalNullable[ - Union[components.Schema0, components.Schema0TypedDict] + Union[ + components.ChatGenerationParamsProvider, + components.ChatGenerationParamsProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Schema17], List[components.Schema17TypedDict]] + Union[ + List[components.ChatGenerationParamsPluginUnion], + List[components.ChatGenerationParamsPluginUnionTypedDict], + ] ] = None, - route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.ChatGenerationParamsTrace, + components.ChatGenerationParamsTraceTypedDict, + ] + ] = None, model: Optional[str] = None, models: Optional[List[str]] = None, frequency_penalty: OptionalNullable[float] = UNSET, @@ -528,16 +699,21 @@ class Chat(BaseSDK): stream_options: OptionalNullable[ Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict] ] = UNSET, - temperature: OptionalNullable[float] = UNSET, - tool_choice: Optional[Any] = None, + temperature: OptionalNullable[float] = 1, + parallel_tool_calls: OptionalNullable[bool] = UNSET, + tool_choice: Optional[ + Union[components.ToolChoiceOption, components.ToolChoiceOptionTypedDict] + ] = None, tools: Optional[ Union[ List[components.ToolDefinitionJSON], List[components.ToolDefinitionJSONTypedDict], ] ] = None, - top_p: OptionalNullable[float] = UNSET, - debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, + top_p: OptionalNullable[float] = 1, + debug: Optional[ + Union[components.DebugOptions, components.DebugOptionsTypedDict] + ] = None, image_config: Optional[ Union[ Dict[str, components.ChatGenerationParamsImageConfig], @@ -554,40 +730,41 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. - :param messages: + :param messages: List of messages for the conversation :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. - :param provider: - :param plugins: - :param route: - :param user: - :param session_id: - :param model: - :param models: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param top_logprobs: - :param max_completion_tokens: - :param max_tokens: - :param metadata: - :param presence_penalty: - :param reasoning: - :param response_format: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param temperature: - :param tool_choice: - :param tools: - :param top_p: - :param debug: - :param image_config: - :param modalities: + :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 user: Unique user identifier + :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + :param model: Model to use for completion + :param models: Models 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: Configuration options for reasoning models + :param response_format: Response format configuration + :param seed: Random seed for deterministic outputs + :param stop: Stop sequences (up to 4) + :param stream: Enable streaming response + :param stream_options: Streaming configuration options + :param temperature: Sampling temperature (0-2) + :param parallel_tool_calls: + :param tool_choice: Tool choice configuration + :param tools: Available tools for function calling + :param top_p: Nucleus sampling parameter (0-1) + :param debug: Debug options for inspecting request transformations (streaming only) + :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. + :param modalities: Output modalities for the response. Supported values are \"text\" and \"image\". :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 @@ -603,14 +780,25 @@ class Chat(BaseSDK): http_referer: Optional[str] = None, x_title: Optional[str] = None, provider: OptionalNullable[ - Union[components.Schema0, components.Schema0TypedDict] + Union[ + components.ChatGenerationParamsProvider, + components.ChatGenerationParamsProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Schema17], List[components.Schema17TypedDict]] + Union[ + List[components.ChatGenerationParamsPluginUnion], + List[components.ChatGenerationParamsPluginUnionTypedDict], + ] ] = None, - route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.ChatGenerationParamsTrace, + components.ChatGenerationParamsTraceTypedDict, + ] + ] = None, model: Optional[str] = None, models: Optional[List[str]] = None, frequency_penalty: OptionalNullable[float] = UNSET, @@ -635,16 +823,21 @@ class Chat(BaseSDK): stream_options: OptionalNullable[ Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict] ] = UNSET, - temperature: OptionalNullable[float] = UNSET, - tool_choice: Optional[Any] = None, + temperature: OptionalNullable[float] = 1, + parallel_tool_calls: OptionalNullable[bool] = UNSET, + tool_choice: Optional[ + Union[components.ToolChoiceOption, components.ToolChoiceOptionTypedDict] + ] = None, tools: Optional[ Union[ List[components.ToolDefinitionJSON], List[components.ToolDefinitionJSONTypedDict], ] ] = None, - top_p: OptionalNullable[float] = UNSET, - debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, + top_p: OptionalNullable[float] = 1, + debug: Optional[ + Union[components.DebugOptions, components.DebugOptionsTypedDict] + ] = None, image_config: Optional[ Union[ Dict[str, components.ChatGenerationParamsImageConfig], @@ -656,45 +849,46 @@ class Chat(BaseSDK): server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> eventstreaming.EventStreamAsync[components.ChatStreamingResponseChunkData]: + ) -> eventstreaming.EventStreamAsync[components.ChatStreamingResponseChunk]: r"""Create a chat completion Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. - :param messages: + :param messages: List of messages for the conversation :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. - :param provider: - :param plugins: - :param route: - :param user: - :param session_id: - :param model: - :param models: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param top_logprobs: - :param max_completion_tokens: - :param max_tokens: - :param metadata: - :param presence_penalty: - :param reasoning: - :param response_format: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param temperature: - :param tool_choice: - :param tools: - :param top_p: - :param debug: - :param image_config: - :param modalities: + :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 user: Unique user identifier + :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + :param model: Model to use for completion + :param models: Models 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: Configuration options for reasoning models + :param response_format: Response format configuration + :param seed: Random seed for deterministic outputs + :param stop: Stop sequences (up to 4) + :param stream: Enable streaming response + :param stream_options: Streaming configuration options + :param temperature: Sampling temperature (0-2) + :param parallel_tool_calls: + :param tool_choice: Tool choice configuration + :param tools: Available tools for function calling + :param top_p: Nucleus sampling parameter (0-1) + :param debug: Debug options for inspecting request transformations (streaming only) + :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. + :param modalities: Output modalities for the response. Supported values are \"text\" and \"image\". :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 @@ -709,14 +903,25 @@ class Chat(BaseSDK): http_referer: Optional[str] = None, x_title: Optional[str] = None, provider: OptionalNullable[ - Union[components.Schema0, components.Schema0TypedDict] + Union[ + components.ChatGenerationParamsProvider, + components.ChatGenerationParamsProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Schema17], List[components.Schema17TypedDict]] + Union[ + List[components.ChatGenerationParamsPluginUnion], + List[components.ChatGenerationParamsPluginUnionTypedDict], + ] ] = None, - route: OptionalNullable[components.Route] = UNSET, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.ChatGenerationParamsTrace, + components.ChatGenerationParamsTraceTypedDict, + ] + ] = None, model: Optional[str] = None, models: Optional[List[str]] = None, frequency_penalty: OptionalNullable[float] = UNSET, @@ -741,16 +946,21 @@ class Chat(BaseSDK): stream_options: OptionalNullable[ Union[components.ChatStreamOptions, components.ChatStreamOptionsTypedDict] ] = UNSET, - temperature: OptionalNullable[float] = UNSET, - tool_choice: Optional[Any] = None, + temperature: OptionalNullable[float] = 1, + parallel_tool_calls: OptionalNullable[bool] = UNSET, + tool_choice: Optional[ + Union[components.ToolChoiceOption, components.ToolChoiceOptionTypedDict] + ] = None, tools: Optional[ Union[ List[components.ToolDefinitionJSON], List[components.ToolDefinitionJSONTypedDict], ] ] = None, - top_p: OptionalNullable[float] = UNSET, - debug: Optional[Union[components.Debug, components.DebugTypedDict]] = None, + top_p: OptionalNullable[float] = 1, + debug: Optional[ + Union[components.DebugOptions, components.DebugOptionsTypedDict] + ] = None, image_config: Optional[ Union[ Dict[str, components.ChatGenerationParamsImageConfig], @@ -767,40 +977,41 @@ class Chat(BaseSDK): Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. - :param messages: + :param messages: List of messages for the conversation :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. :param x_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard. - :param provider: - :param plugins: - :param route: - :param user: - :param session_id: - :param model: - :param models: - :param frequency_penalty: - :param logit_bias: - :param logprobs: - :param top_logprobs: - :param max_completion_tokens: - :param max_tokens: - :param metadata: - :param presence_penalty: - :param reasoning: - :param response_format: - :param seed: - :param stop: - :param stream: - :param stream_options: - :param temperature: - :param tool_choice: - :param tools: - :param top_p: - :param debug: - :param image_config: - :param modalities: + :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 user: Unique user identifier + :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + :param model: Model to use for completion + :param models: Models 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: Configuration options for reasoning models + :param response_format: Response format configuration + :param seed: Random seed for deterministic outputs + :param stop: Stop sequences (up to 4) + :param stream: Enable streaming response + :param stream_options: Streaming configuration options + :param temperature: Sampling temperature (0-2) + :param parallel_tool_calls: + :param tool_choice: Tool choice configuration + :param tools: Available tools for function calling + :param top_p: Nucleus sampling parameter (0-1) + :param debug: Debug options for inspecting request transformations (streaming only) + :param image_config: Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details. + :param modalities: Output modalities for the response. Supported values are \"text\" and \"image\". :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 @@ -822,14 +1033,16 @@ class Chat(BaseSDK): x_title=x_title, chat_generation_params=components.ChatGenerationParams( provider=utils.get_pydantic_model( - provider, OptionalNullable[components.Schema0] + provider, OptionalNullable[components.ChatGenerationParamsProvider] ), plugins=utils.get_pydantic_model( - plugins, Optional[List[components.Schema17]] + plugins, Optional[List[components.ChatGenerationParamsPluginUnion]] ), - route=route, user=user, session_id=session_id, + trace=utils.get_pydantic_model( + trace, Optional[components.ChatGenerationParamsTrace] + ), messages=utils.get_pydantic_model(messages, List[components.Message]), model=model, models=models, @@ -854,12 +1067,17 @@ class Chat(BaseSDK): stream_options, OptionalNullable[components.ChatStreamOptions] ), temperature=temperature, - tool_choice=tool_choice, + parallel_tool_calls=parallel_tool_calls, + tool_choice=utils.get_pydantic_model( + tool_choice, Optional[components.ToolChoiceOption] + ), tools=utils.get_pydantic_model( tools, Optional[List[components.ToolDefinitionJSON]] ), top_p=top_p, - debug=utils.get_pydantic_model(debug, Optional[components.Debug]), + debug=utils.get_pydantic_model( + debug, Optional[components.DebugOptions] + ), image_config=image_config, modalities=modalities, ), @@ -912,7 +1130,23 @@ class Chat(BaseSDK): ), ), request=req, - error_status_codes=["400", "401", "429", "4XX", "500", "5XX"], + error_status_codes=[ + "400", + "401", + "402", + "404", + "408", + "413", + "422", + "429", + "4XX", + "500", + "502", + "503", + "524", + "529", + "5XX", + ], stream=True, retry_config=retry_config, ) @@ -927,23 +1161,109 @@ class Chat(BaseSDK): return eventstreaming.EventStreamAsync( http_res, lambda raw: utils.unmarshal_json( - raw, components.ChatStreamingResponseChunk + raw, operations.SendChatCompletionRequestResponseBody ).data, sentinel="[DONE]", client_ref=self, ) - if utils.match_response(http_res, ["400", "401", "429"], "application/json"): + if utils.match_response(http_res, "400", "application/json"): http_res_text = await utils.stream_to_text_async(http_res) response_data = unmarshal_json_response( - errors.ChatErrorData, http_res, http_res_text + errors.BadRequestResponseErrorData, http_res, http_res_text + ) + raise errors.BadRequestResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "401", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.UnauthorizedResponseErrorData, http_res, http_res_text + ) + raise errors.UnauthorizedResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "402", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.PaymentRequiredResponseErrorData, http_res, http_res_text + ) + raise errors.PaymentRequiredResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "404", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.NotFoundResponseErrorData, http_res, http_res_text + ) + raise errors.NotFoundResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "408", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.RequestTimeoutResponseErrorData, http_res, http_res_text + ) + raise errors.RequestTimeoutResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "413", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.PayloadTooLargeResponseErrorData, http_res, http_res_text + ) + raise errors.PayloadTooLargeResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "422", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.UnprocessableEntityResponseErrorData, http_res, http_res_text + ) + raise errors.UnprocessableEntityResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "429", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.TooManyRequestsResponseErrorData, http_res, http_res_text + ) + raise errors.TooManyRequestsResponseError( + response_data, http_res, http_res_text ) - raise errors.ChatError(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.ChatErrorData, http_res, http_res_text + errors.InternalServerResponseErrorData, http_res, http_res_text + ) + raise errors.InternalServerResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "502", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.BadGatewayResponseErrorData, http_res, http_res_text + ) + raise errors.BadGatewayResponseError(response_data, http_res, http_res_text) + if utils.match_response(http_res, "503", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.ServiceUnavailableResponseErrorData, http_res, http_res_text + ) + raise errors.ServiceUnavailableResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "524", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.EdgeNetworkTimeoutResponseErrorData, http_res, http_res_text + ) + raise errors.EdgeNetworkTimeoutResponseError( + response_data, http_res, http_res_text + ) + if utils.match_response(http_res, "529", "application/json"): + http_res_text = await utils.stream_to_text_async(http_res) + response_data = unmarshal_json_response( + errors.ProviderOverloadedResponseErrorData, http_res, http_res_text + ) + raise errors.ProviderOverloadedResponseError( + response_data, http_res, http_res_text ) - raise errors.ChatError(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( diff --git a/src/openrouter/components/__init__.py b/src/openrouter/components/__init__.py index 4dba5f4..051bc59 100644 --- a/src/openrouter/components/__init__.py +++ b/src/openrouter/components/__init__.py @@ -6,55 +6,19 @@ import builtins import sys if TYPE_CHECKING: - from ._schema10 import ( - Completion, - CompletionTypedDict, - Prompt, - PromptTypedDict, - Schema10, - Schema10TypedDict, - ) - from ._schema14 import Schema14, Schema14TypedDict - from ._schema17 import ( - Engine, - Pdf, - PdfEngine, - PdfTypedDict, - Schema17, - Schema17AutoRouter, - Schema17AutoRouterTypedDict, - Schema17FileParser, - Schema17FileParserTypedDict, - Schema17Moderation, - Schema17ModerationTypedDict, - Schema17ResponseHealing, - Schema17ResponseHealingTypedDict, - Schema17TypedDict, - Schema17Web, - Schema17WebTypedDict, - ) - from ._schema19 import ( - Schema19, - Schema19ReasoningEncrypted, - Schema19ReasoningEncryptedTypedDict, - Schema19ReasoningSummary, - Schema19ReasoningSummaryTypedDict, - Schema19ReasoningText, - Schema19ReasoningTextTypedDict, - Schema19TypedDict, - Schema21, - ) - from ._schema5 import Schema5, Schema5Enum, Schema5TypedDict from .activityitem import ActivityItem, ActivityItemTypedDict from .assistantmessage import ( AssistantMessage, AssistantMessageContent, AssistantMessageContentTypedDict, - AssistantMessageImageURL, - AssistantMessageImageURLTypedDict, + AssistantMessageRole, AssistantMessageTypedDict, - Image, - ImageTypedDict, + ) + from .assistantmessageimages import ( + AssistantMessageImages, + AssistantMessageImagesImageURL, + AssistantMessageImagesImageURLTypedDict, + AssistantMessageImagesTypedDict, ) from .badgatewayresponseerrordata import ( BadGatewayResponseErrorData, @@ -65,35 +29,57 @@ if TYPE_CHECKING: BadRequestResponseErrorDataTypedDict, ) from .chatcompletionfinishreason import ChatCompletionFinishReason - from .chaterror import ChatErrorError, ChatErrorErrorTypedDict, Code, CodeTypedDict from .chatgenerationparams import ( ChatGenerationParams, + ChatGenerationParamsBy, + ChatGenerationParamsIDAutoRouter, + ChatGenerationParamsIDFileParser, + ChatGenerationParamsIDModeration, + ChatGenerationParamsIDResponseHealing, + ChatGenerationParamsIDWeb, + ChatGenerationParamsIgnore, + ChatGenerationParamsIgnoreTypedDict, ChatGenerationParamsImageConfig, ChatGenerationParamsImageConfigTypedDict, + ChatGenerationParamsMaxPrice, + ChatGenerationParamsMaxPriceTypedDict, + ChatGenerationParamsOnly, + ChatGenerationParamsOnlyTypedDict, + ChatGenerationParamsOrder, + ChatGenerationParamsOrderTypedDict, + ChatGenerationParamsPartition, + ChatGenerationParamsPluginAutoRouter, + ChatGenerationParamsPluginAutoRouterTypedDict, + ChatGenerationParamsPluginFileParser, + ChatGenerationParamsPluginFileParserTypedDict, + ChatGenerationParamsPluginModeration, + ChatGenerationParamsPluginModerationTypedDict, + ChatGenerationParamsPluginResponseHealing, + ChatGenerationParamsPluginResponseHealingTypedDict, + ChatGenerationParamsPluginUnion, + ChatGenerationParamsPluginUnionTypedDict, + ChatGenerationParamsPluginWeb, + ChatGenerationParamsPluginWebTypedDict, + ChatGenerationParamsProvider, + ChatGenerationParamsProviderSort, + ChatGenerationParamsProviderSortConfig, + ChatGenerationParamsProviderSortConfigEnum, + ChatGenerationParamsProviderSortConfigTypedDict, + ChatGenerationParamsProviderSortConfigUnion, + ChatGenerationParamsProviderSortConfigUnionTypedDict, + ChatGenerationParamsProviderTypedDict, + ChatGenerationParamsSortEnum, + ChatGenerationParamsSortUnion, + ChatGenerationParamsSortUnionTypedDict, + ChatGenerationParamsTrace, + ChatGenerationParamsTraceTypedDict, ChatGenerationParamsTypedDict, - Debug, - DebugTypedDict, Effort, Modality, Reasoning, ReasoningTypedDict, ResponseFormat, - ResponseFormatJSONObject, - ResponseFormatJSONObjectTypedDict, - ResponseFormatPython, - ResponseFormatPythonTypedDict, - ResponseFormatText, - ResponseFormatTextTypedDict, ResponseFormatTypedDict, - Route, - Schema0, - Schema0TypedDict, - Schema15, - Schema15TypedDict, - Schema15Union, - Schema15UnionTypedDict, - Schema3, - Schema8, Stop, StopTypedDict, ) @@ -107,16 +93,20 @@ if TYPE_CHECKING: ) from .chatmessagecontentitem import ( ChatMessageContentItem, + ChatMessageContentItem1, + ChatMessageContentItem1TypedDict, ChatMessageContentItemTypedDict, ) from .chatmessagecontentitemaudio import ( ChatMessageContentItemAudio, ChatMessageContentItemAudioInputAudio, ChatMessageContentItemAudioInputAudioTypedDict, + ChatMessageContentItemAudioType, ChatMessageContentItemAudioTypedDict, ) from .chatmessagecontentitemcachecontrol import ( ChatMessageContentItemCacheControl, + ChatMessageContentItemCacheControlType, ChatMessageContentItemCacheControlTypedDict, TTL, ) @@ -125,23 +115,23 @@ if TYPE_CHECKING: ChatMessageContentItemImageDetail, ChatMessageContentItemImageImageURL, ChatMessageContentItemImageImageURLTypedDict, + ChatMessageContentItemImageType, ChatMessageContentItemImageTypedDict, ) from .chatmessagecontentitemtext import ( ChatMessageContentItemText, + ChatMessageContentItemTextType, ChatMessageContentItemTextTypedDict, ) from .chatmessagecontentitemvideo import ( ChatMessageContentItemVideo, - ChatMessageContentItemVideoInputVideo, - ChatMessageContentItemVideoInputVideoTypedDict, + ChatMessageContentItemVideoType, ChatMessageContentItemVideoTypedDict, - ChatMessageContentItemVideoVideoURL, - ChatMessageContentItemVideoVideoURLTypedDict, - VideoURL1, - VideoURL1TypedDict, - VideoURL2, - VideoURL2TypedDict, + ) + from .chatmessagecontentitemvideolegacy import ( + ChatMessageContentItemVideoLegacy, + ChatMessageContentItemVideoLegacyType, + ChatMessageContentItemVideoLegacyTypedDict, ) from .chatmessagetokenlogprob import ( ChatMessageTokenLogprob, @@ -157,9 +147,10 @@ if TYPE_CHECKING: ChatMessageToolCall, ChatMessageToolCallFunction, ChatMessageToolCallFunctionTypedDict, + ChatMessageToolCallType, ChatMessageToolCallTypedDict, ) - from .chatresponse import ChatResponse, ChatResponseTypedDict + from .chatresponse import ChatResponse, ChatResponseObject, ChatResponseTypedDict from .chatresponsechoice import ChatResponseChoice, ChatResponseChoiceTypedDict from .chatstreamingchoice import ChatStreamingChoice, ChatStreamingChoiceTypedDict from .chatstreamingmessagechunk import ( @@ -171,15 +162,15 @@ if TYPE_CHECKING: ChatStreamingMessageToolCall, ChatStreamingMessageToolCallFunction, ChatStreamingMessageToolCallFunctionTypedDict, + ChatStreamingMessageToolCallType, ChatStreamingMessageToolCallTypedDict, ) from .chatstreamingresponsechunk import ( ChatStreamingResponseChunk, - ChatStreamingResponseChunkData, - ChatStreamingResponseChunkDataTypedDict, - ChatStreamingResponseChunkError, - ChatStreamingResponseChunkErrorTypedDict, + ChatStreamingResponseChunkObject, ChatStreamingResponseChunkTypedDict, + Error, + ErrorTypedDict, ) from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict from .createchargerequest import ( @@ -188,11 +179,13 @@ if TYPE_CHECKING: CreateChargeRequestTypedDict, ) from .datacollection import DataCollection + from .debugoptions import DebugOptions, DebugOptionsTypedDict from .defaultparameters import DefaultParameters, DefaultParametersTypedDict from .developermessage import ( DeveloperMessage, DeveloperMessageContent, DeveloperMessageContentTypedDict, + DeveloperMessageRole, DeveloperMessageTypedDict, ) from .edgenetworktimeoutresponseerrordata import ( @@ -230,9 +223,9 @@ if TYPE_CHECKING: ) from .modelgroup import ModelGroup from .modelscountresponse import ( + Data, + DataTypedDict, ModelsCountResponse, - ModelsCountResponseData, - ModelsCountResponseDataTypedDict, ModelsCountResponseTypedDict, ) from .modelslistresponse import ModelsListResponse, ModelsListResponseTypedDict @@ -240,6 +233,7 @@ if TYPE_CHECKING: NamedToolChoice, NamedToolChoiceFunction, NamedToolChoiceFunctionTypedDict, + NamedToolChoiceType, NamedToolChoiceTypedDict, ) from .notfoundresponseerrordata import ( @@ -407,8 +401,8 @@ if TYPE_CHECKING: OpenResponsesLogProbsTypedDict, ) from .openresponsesnonstreamingresponse import ( - Object, OpenResponsesNonStreamingResponse, + OpenResponsesNonStreamingResponseObject, OpenResponsesNonStreamingResponseToolFunction, OpenResponsesNonStreamingResponseToolFunctionTypedDict, OpenResponsesNonStreamingResponseToolUnion, @@ -457,12 +451,12 @@ if TYPE_CHECKING: OpenResponsesReasoningSummaryTextDoneEventTypedDict, ) from .openresponsesrequest import ( - IDAutoRouter, - IDFileParser, - IDModeration, - IDResponseHealing, - IDWeb, OpenResponsesRequest, + OpenResponsesRequestIDAutoRouter, + OpenResponsesRequestIDFileParser, + OpenResponsesRequestIDModeration, + OpenResponsesRequestIDResponseHealing, + OpenResponsesRequestIDWeb, OpenResponsesRequestIgnore, OpenResponsesRequestIgnoreTypedDict, OpenResponsesRequestImageConfig, @@ -473,28 +467,30 @@ if TYPE_CHECKING: OpenResponsesRequestOnlyTypedDict, OpenResponsesRequestOrder, OpenResponsesRequestOrderTypedDict, + OpenResponsesRequestPluginAutoRouter, + OpenResponsesRequestPluginAutoRouterTypedDict, + OpenResponsesRequestPluginFileParser, + OpenResponsesRequestPluginFileParserTypedDict, + OpenResponsesRequestPluginModeration, + OpenResponsesRequestPluginModerationTypedDict, + OpenResponsesRequestPluginResponseHealing, + OpenResponsesRequestPluginResponseHealingTypedDict, + OpenResponsesRequestPluginUnion, + OpenResponsesRequestPluginUnionTypedDict, + OpenResponsesRequestPluginWeb, + OpenResponsesRequestPluginWebTypedDict, + OpenResponsesRequestProvider, + OpenResponsesRequestProviderTypedDict, OpenResponsesRequestSort, OpenResponsesRequestSortTypedDict, OpenResponsesRequestToolFunction, OpenResponsesRequestToolFunctionTypedDict, OpenResponsesRequestToolUnion, OpenResponsesRequestToolUnionTypedDict, + OpenResponsesRequestTrace, + OpenResponsesRequestTraceTypedDict, OpenResponsesRequestType, OpenResponsesRequestTypedDict, - Plugin, - PluginAutoRouter, - PluginAutoRouterTypedDict, - PluginFileParser, - PluginFileParserTypedDict, - PluginModeration, - PluginModerationTypedDict, - PluginResponseHealing, - PluginResponseHealingTypedDict, - PluginTypedDict, - PluginWeb, - PluginWebTypedDict, - Provider, - ProviderTypedDict, ServiceTier, Truncation, ) @@ -652,6 +648,7 @@ if TYPE_CHECKING: ) from .providerpreferences import ( ProviderPreferences, + ProviderPreferencesBy, ProviderPreferencesIgnore, ProviderPreferencesIgnoreTypedDict, ProviderPreferencesMaxPrice, @@ -663,22 +660,22 @@ if TYPE_CHECKING: ProviderPreferencesPartition, ProviderPreferencesProviderSort, ProviderPreferencesProviderSortConfig, + ProviderPreferencesProviderSortConfigEnum, ProviderPreferencesProviderSortConfigTypedDict, + ProviderPreferencesProviderSortConfigUnion, + ProviderPreferencesProviderSortConfigUnionTypedDict, + ProviderPreferencesSortEnum, ProviderPreferencesSortUnion, ProviderPreferencesSortUnionTypedDict, ProviderPreferencesTypedDict, - ProviderSortConfigEnum, - ProviderSortConfigUnion, - ProviderSortConfigUnionTypedDict, - SortEnum, ) from .providersort import ProviderSort from .providersortconfig import ( + By, Partition, ProviderSortConfig, ProviderSortConfigTypedDict, ) - from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict from .publicendpoint import ( Pricing, PricingTypedDict, @@ -688,6 +685,28 @@ if TYPE_CHECKING: ) from .publicpricing import PublicPricing, PublicPricingTypedDict from .quantization import Quantization + from .reasoningdetailencrypted import ( + ReasoningDetailEncrypted, + ReasoningDetailEncryptedFormat, + ReasoningDetailEncryptedType, + ReasoningDetailEncryptedTypedDict, + ) + from .reasoningdetailsummary import ( + ReasoningDetailSummary, + ReasoningDetailSummaryFormat, + ReasoningDetailSummaryType, + ReasoningDetailSummaryTypedDict, + ) + from .reasoningdetailtext import ( + ReasoningDetailText, + ReasoningDetailTextFormat, + ReasoningDetailTextType, + ReasoningDetailTextTypedDict, + ) + from .reasoningdetailunion import ( + ReasoningDetailUnion, + ReasoningDetailUnionTypedDict, + ) from .reasoningsummarytext import ( ReasoningSummaryText, ReasoningSummaryTextType, @@ -703,18 +722,35 @@ if TYPE_CHECKING: RequestTimeoutResponseErrorData, RequestTimeoutResponseErrorDataTypedDict, ) + from .responseformatjsonobject import ( + ResponseFormatJSONObject, + ResponseFormatJSONObjectType, + ResponseFormatJSONObjectTypedDict, + ) from .responseformatjsonschema import ( ResponseFormatJSONSchema, + ResponseFormatJSONSchemaType, ResponseFormatJSONSchemaTypedDict, ) + from .responseformattext import ( + ResponseFormatText, + ResponseFormatTextType, + ResponseFormatTextTypedDict, + ) from .responseformattextconfig import ( ResponseFormatTextConfig, ResponseFormatTextConfigTypedDict, ) from .responseformattextgrammar import ( ResponseFormatTextGrammar, + ResponseFormatTextGrammarType, ResponseFormatTextGrammarTypedDict, ) + from .responseformattextpython import ( + ResponseFormatTextPython, + ResponseFormatTextPythonType, + ResponseFormatTextPythonTypedDict, + ) from .responseinputaudio import ( ResponseInputAudio, ResponseInputAudioFormat, @@ -754,15 +790,10 @@ if TYPE_CHECKING: ResponseOutputTextTypedDict, ) from .responseserrorfield import ( - CodeEnum, + Code, ResponsesErrorField, ResponsesErrorFieldTypedDict, ) - from .responsesformatjsonobject import ( - ResponsesFormatJSONObject, - ResponsesFormatJSONObjectType, - ResponsesFormatJSONObjectTypedDict, - ) from .responsesformattext import ( ResponsesFormatText, ResponsesFormatTextType, @@ -844,19 +875,29 @@ if TYPE_CHECKING: SystemMessage, SystemMessageContent, SystemMessageContentTypedDict, + SystemMessageRole, SystemMessageTypedDict, ) from .toolcallstatus import ToolCallStatus + from .toolchoiceoption import ( + ToolChoiceOption, + ToolChoiceOptionAuto, + ToolChoiceOptionNone, + ToolChoiceOptionRequired, + ToolChoiceOptionTypedDict, + ) from .tooldefinitionjson import ( ToolDefinitionJSON, ToolDefinitionJSONFunction, ToolDefinitionJSONFunctionTypedDict, + ToolDefinitionJSONType, ToolDefinitionJSONTypedDict, ) from .toolresponsemessage import ( ToolResponseMessage, ToolResponseMessageContent, ToolResponseMessageContentTypedDict, + ToolResponseMessageRole, ToolResponseMessageTypedDict, ) from .toomanyrequestsresponseerrordata import ( @@ -877,8 +918,10 @@ if TYPE_CHECKING: UserMessage, UserMessageContent, UserMessageContentTypedDict, + UserMessageRole, UserMessageTypedDict, ) + from .videoinput import VideoInput, VideoInputTypedDict from .websearchengine import WebSearchEngine from .websearchpreviewtooluserlocation import ( WebSearchPreviewToolUserLocation, @@ -895,44 +938,92 @@ __all__ = [ "AssistantMessage", "AssistantMessageContent", "AssistantMessageContentTypedDict", - "AssistantMessageImageURL", - "AssistantMessageImageURLTypedDict", + "AssistantMessageImages", + "AssistantMessageImagesImageURL", + "AssistantMessageImagesImageURLTypedDict", + "AssistantMessageImagesTypedDict", + "AssistantMessageRole", "AssistantMessageTypedDict", "BadGatewayResponseErrorData", "BadGatewayResponseErrorDataTypedDict", "BadRequestResponseErrorData", "BadRequestResponseErrorDataTypedDict", + "By", "ChainID", "ChatCompletionFinishReason", - "ChatErrorError", - "ChatErrorErrorTypedDict", "ChatGenerationParams", + "ChatGenerationParamsBy", + "ChatGenerationParamsIDAutoRouter", + "ChatGenerationParamsIDFileParser", + "ChatGenerationParamsIDModeration", + "ChatGenerationParamsIDResponseHealing", + "ChatGenerationParamsIDWeb", + "ChatGenerationParamsIgnore", + "ChatGenerationParamsIgnoreTypedDict", "ChatGenerationParamsImageConfig", "ChatGenerationParamsImageConfigTypedDict", + "ChatGenerationParamsMaxPrice", + "ChatGenerationParamsMaxPriceTypedDict", + "ChatGenerationParamsOnly", + "ChatGenerationParamsOnlyTypedDict", + "ChatGenerationParamsOrder", + "ChatGenerationParamsOrderTypedDict", + "ChatGenerationParamsPartition", + "ChatGenerationParamsPluginAutoRouter", + "ChatGenerationParamsPluginAutoRouterTypedDict", + "ChatGenerationParamsPluginFileParser", + "ChatGenerationParamsPluginFileParserTypedDict", + "ChatGenerationParamsPluginModeration", + "ChatGenerationParamsPluginModerationTypedDict", + "ChatGenerationParamsPluginResponseHealing", + "ChatGenerationParamsPluginResponseHealingTypedDict", + "ChatGenerationParamsPluginUnion", + "ChatGenerationParamsPluginUnionTypedDict", + "ChatGenerationParamsPluginWeb", + "ChatGenerationParamsPluginWebTypedDict", + "ChatGenerationParamsProvider", + "ChatGenerationParamsProviderSort", + "ChatGenerationParamsProviderSortConfig", + "ChatGenerationParamsProviderSortConfigEnum", + "ChatGenerationParamsProviderSortConfigTypedDict", + "ChatGenerationParamsProviderSortConfigUnion", + "ChatGenerationParamsProviderSortConfigUnionTypedDict", + "ChatGenerationParamsProviderTypedDict", + "ChatGenerationParamsSortEnum", + "ChatGenerationParamsSortUnion", + "ChatGenerationParamsSortUnionTypedDict", + "ChatGenerationParamsTrace", + "ChatGenerationParamsTraceTypedDict", "ChatGenerationParamsTypedDict", "ChatGenerationTokenUsage", "ChatGenerationTokenUsageTypedDict", "ChatMessageContentItem", + "ChatMessageContentItem1", + "ChatMessageContentItem1TypedDict", "ChatMessageContentItemAudio", "ChatMessageContentItemAudioInputAudio", "ChatMessageContentItemAudioInputAudioTypedDict", + "ChatMessageContentItemAudioType", "ChatMessageContentItemAudioTypedDict", "ChatMessageContentItemCacheControl", + "ChatMessageContentItemCacheControlType", "ChatMessageContentItemCacheControlTypedDict", "ChatMessageContentItemImage", "ChatMessageContentItemImageDetail", "ChatMessageContentItemImageImageURL", "ChatMessageContentItemImageImageURLTypedDict", + "ChatMessageContentItemImageType", "ChatMessageContentItemImageTypedDict", "ChatMessageContentItemText", + "ChatMessageContentItemTextType", "ChatMessageContentItemTextTypedDict", "ChatMessageContentItemTypedDict", "ChatMessageContentItemVideo", - "ChatMessageContentItemVideoInputVideo", - "ChatMessageContentItemVideoInputVideoTypedDict", + "ChatMessageContentItemVideoLegacy", + "ChatMessageContentItemVideoLegacyType", + "ChatMessageContentItemVideoLegacyTypedDict", + "ChatMessageContentItemVideoType", "ChatMessageContentItemVideoTypedDict", - "ChatMessageContentItemVideoVideoURL", - "ChatMessageContentItemVideoVideoURLTypedDict", "ChatMessageTokenLogprob", "ChatMessageTokenLogprobTopLogprob", "ChatMessageTokenLogprobTopLogprobTypedDict", @@ -942,10 +1033,12 @@ __all__ = [ "ChatMessageToolCall", "ChatMessageToolCallFunction", "ChatMessageToolCallFunctionTypedDict", + "ChatMessageToolCallType", "ChatMessageToolCallTypedDict", "ChatResponse", "ChatResponseChoice", "ChatResponseChoiceTypedDict", + "ChatResponseObject", "ChatResponseTypedDict", "ChatStreamOptions", "ChatStreamOptionsTypedDict", @@ -957,38 +1050,36 @@ __all__ = [ "ChatStreamingMessageToolCall", "ChatStreamingMessageToolCallFunction", "ChatStreamingMessageToolCallFunctionTypedDict", + "ChatStreamingMessageToolCallType", "ChatStreamingMessageToolCallTypedDict", "ChatStreamingResponseChunk", - "ChatStreamingResponseChunkData", - "ChatStreamingResponseChunkDataTypedDict", - "ChatStreamingResponseChunkError", - "ChatStreamingResponseChunkErrorTypedDict", + "ChatStreamingResponseChunkObject", "ChatStreamingResponseChunkTypedDict", "Code", - "CodeEnum", - "CodeTypedDict", - "Completion", "CompletionTokensDetails", "CompletionTokensDetailsTypedDict", - "CompletionTypedDict", "CostDetails", "CostDetailsTypedDict", "CreateChargeRequest", "CreateChargeRequestTypedDict", + "Data", "DataCollection", - "Debug", - "DebugTypedDict", + "DataTypedDict", + "DebugOptions", + "DebugOptionsTypedDict", "DefaultParameters", "DefaultParametersTypedDict", "DeveloperMessage", "DeveloperMessageContent", "DeveloperMessageContentTypedDict", + "DeveloperMessageRole", "DeveloperMessageTypedDict", "EdgeNetworkTimeoutResponseErrorData", "EdgeNetworkTimeoutResponseErrorDataTypedDict", "Effort", "EndpointStatus", - "Engine", + "Error", + "ErrorTypedDict", "FileCitation", "FileCitationType", "FileCitationTypedDict", @@ -997,14 +1088,7 @@ __all__ = [ "FilePathTypedDict", "ForbiddenResponseErrorData", "ForbiddenResponseErrorDataTypedDict", - "IDAutoRouter", - "IDFileParser", - "IDModeration", - "IDResponseHealing", - "IDWeb", - "Image", "ImageGenerationStatus", - "ImageTypedDict", "InputModality", "InputTokensDetails", "InputTokensDetailsTypedDict", @@ -1027,18 +1111,16 @@ __all__ = [ "ModelGroup", "ModelTypedDict", "ModelsCountResponse", - "ModelsCountResponseData", - "ModelsCountResponseDataTypedDict", "ModelsCountResponseTypedDict", "ModelsListResponse", "ModelsListResponseTypedDict", "NamedToolChoice", "NamedToolChoiceFunction", "NamedToolChoiceFunctionTypedDict", + "NamedToolChoiceType", "NamedToolChoiceTypedDict", "NotFoundResponseErrorData", "NotFoundResponseErrorDataTypedDict", - "Object", "OpenAIResponsesAnnotation", "OpenAIResponsesAnnotationTypedDict", "OpenAIResponsesIncludable", @@ -1159,6 +1241,7 @@ __all__ = [ "OpenResponsesLogProbs", "OpenResponsesLogProbsTypedDict", "OpenResponsesNonStreamingResponse", + "OpenResponsesNonStreamingResponseObject", "OpenResponsesNonStreamingResponseToolFunction", "OpenResponsesNonStreamingResponseToolFunctionTypedDict", "OpenResponsesNonStreamingResponseToolUnion", @@ -1192,6 +1275,11 @@ __all__ = [ "OpenResponsesReasoningType", "OpenResponsesReasoningTypedDict", "OpenResponsesRequest", + "OpenResponsesRequestIDAutoRouter", + "OpenResponsesRequestIDFileParser", + "OpenResponsesRequestIDModeration", + "OpenResponsesRequestIDResponseHealing", + "OpenResponsesRequestIDWeb", "OpenResponsesRequestIgnore", "OpenResponsesRequestIgnoreTypedDict", "OpenResponsesRequestImageConfig", @@ -1202,12 +1290,28 @@ __all__ = [ "OpenResponsesRequestOnlyTypedDict", "OpenResponsesRequestOrder", "OpenResponsesRequestOrderTypedDict", + "OpenResponsesRequestPluginAutoRouter", + "OpenResponsesRequestPluginAutoRouterTypedDict", + "OpenResponsesRequestPluginFileParser", + "OpenResponsesRequestPluginFileParserTypedDict", + "OpenResponsesRequestPluginModeration", + "OpenResponsesRequestPluginModerationTypedDict", + "OpenResponsesRequestPluginResponseHealing", + "OpenResponsesRequestPluginResponseHealingTypedDict", + "OpenResponsesRequestPluginUnion", + "OpenResponsesRequestPluginUnionTypedDict", + "OpenResponsesRequestPluginWeb", + "OpenResponsesRequestPluginWebTypedDict", + "OpenResponsesRequestProvider", + "OpenResponsesRequestProviderTypedDict", "OpenResponsesRequestSort", "OpenResponsesRequestSortTypedDict", "OpenResponsesRequestToolFunction", "OpenResponsesRequestToolFunctionTypedDict", "OpenResponsesRequestToolUnion", "OpenResponsesRequestToolUnionTypedDict", + "OpenResponsesRequestTrace", + "OpenResponsesRequestTraceTypedDict", "OpenResponsesRequestType", "OpenResponsesRequestTypedDict", "OpenResponsesResponseText", @@ -1299,9 +1403,6 @@ __all__ = [ "PayloadTooLargeResponseErrorDataTypedDict", "PaymentRequiredResponseErrorData", "PaymentRequiredResponseErrorDataTypedDict", - "Pdf", - "PdfEngine", - "PdfTypedDict", "PerRequestLimits", "PerRequestLimitsTypedDict", "PercentileLatencyCutoffs", @@ -1310,33 +1411,19 @@ __all__ = [ "PercentileStatsTypedDict", "PercentileThroughputCutoffs", "PercentileThroughputCutoffsTypedDict", - "Plugin", - "PluginAutoRouter", - "PluginAutoRouterTypedDict", - "PluginFileParser", - "PluginFileParserTypedDict", - "PluginModeration", - "PluginModerationTypedDict", - "PluginResponseHealing", - "PluginResponseHealingTypedDict", - "PluginTypedDict", - "PluginWeb", - "PluginWebTypedDict", "PreferredMaxLatency", "PreferredMaxLatencyTypedDict", "PreferredMinThroughput", "PreferredMinThroughputTypedDict", "Pricing", "PricingTypedDict", - "Prompt", "PromptTokensDetails", "PromptTokensDetailsTypedDict", - "PromptTypedDict", - "Provider", "ProviderName", "ProviderOverloadedResponseErrorData", "ProviderOverloadedResponseErrorDataTypedDict", "ProviderPreferences", + "ProviderPreferencesBy", "ProviderPreferencesIgnore", "ProviderPreferencesIgnoreTypedDict", "ProviderPreferencesMaxPrice", @@ -1348,19 +1435,17 @@ __all__ = [ "ProviderPreferencesPartition", "ProviderPreferencesProviderSort", "ProviderPreferencesProviderSortConfig", + "ProviderPreferencesProviderSortConfigEnum", "ProviderPreferencesProviderSortConfigTypedDict", + "ProviderPreferencesProviderSortConfigUnion", + "ProviderPreferencesProviderSortConfigUnionTypedDict", + "ProviderPreferencesSortEnum", "ProviderPreferencesSortUnion", "ProviderPreferencesSortUnionTypedDict", "ProviderPreferencesTypedDict", "ProviderSort", "ProviderSortConfig", - "ProviderSortConfigEnum", "ProviderSortConfigTypedDict", - "ProviderSortConfigUnion", - "ProviderSortConfigUnionTypedDict", - "ProviderSortUnion", - "ProviderSortUnionTypedDict", - "ProviderTypedDict", "PublicEndpoint", "PublicEndpointQuantization", "PublicEndpointTypedDict", @@ -1369,6 +1454,20 @@ __all__ = [ "Quantization", "Reason", "Reasoning", + "ReasoningDetailEncrypted", + "ReasoningDetailEncryptedFormat", + "ReasoningDetailEncryptedType", + "ReasoningDetailEncryptedTypedDict", + "ReasoningDetailSummary", + "ReasoningDetailSummaryFormat", + "ReasoningDetailSummaryType", + "ReasoningDetailSummaryTypedDict", + "ReasoningDetailText", + "ReasoningDetailTextFormat", + "ReasoningDetailTextType", + "ReasoningDetailTextTypedDict", + "ReasoningDetailUnion", + "ReasoningDetailUnionTypedDict", "ReasoningSummaryText", "ReasoningSummaryTextType", "ReasoningSummaryTextTypedDict", @@ -1381,16 +1480,21 @@ __all__ = [ "RequestTimeoutResponseErrorDataTypedDict", "ResponseFormat", "ResponseFormatJSONObject", + "ResponseFormatJSONObjectType", "ResponseFormatJSONObjectTypedDict", "ResponseFormatJSONSchema", + "ResponseFormatJSONSchemaType", "ResponseFormatJSONSchemaTypedDict", - "ResponseFormatPython", - "ResponseFormatPythonTypedDict", "ResponseFormatText", "ResponseFormatTextConfig", "ResponseFormatTextConfigTypedDict", "ResponseFormatTextGrammar", + "ResponseFormatTextGrammarType", "ResponseFormatTextGrammarTypedDict", + "ResponseFormatTextPython", + "ResponseFormatTextPythonType", + "ResponseFormatTextPythonTypedDict", + "ResponseFormatTextType", "ResponseFormatTextTypedDict", "ResponseFormatTypedDict", "ResponseInputAudio", @@ -1422,9 +1526,6 @@ __all__ = [ "ResponseTextConfigVerbosity", "ResponsesErrorField", "ResponsesErrorFieldTypedDict", - "ResponsesFormatJSONObject", - "ResponsesFormatJSONObjectType", - "ResponsesFormatJSONObjectTypedDict", "ResponsesFormatText", "ResponsesFormatTextJSONSchemaConfig", "ResponsesFormatTextJSONSchemaConfigType", @@ -1475,67 +1576,37 @@ __all__ = [ "ResponsesWebSearchUserLocation", "ResponsesWebSearchUserLocationType", "ResponsesWebSearchUserLocationTypedDict", - "Route", - "Schema0", - "Schema0TypedDict", - "Schema10", - "Schema10TypedDict", - "Schema14", - "Schema14TypedDict", - "Schema15", - "Schema15TypedDict", - "Schema15Union", - "Schema15UnionTypedDict", - "Schema17", - "Schema17AutoRouter", - "Schema17AutoRouterTypedDict", - "Schema17FileParser", - "Schema17FileParserTypedDict", - "Schema17Moderation", - "Schema17ModerationTypedDict", - "Schema17ResponseHealing", - "Schema17ResponseHealingTypedDict", - "Schema17TypedDict", - "Schema17Web", - "Schema17WebTypedDict", - "Schema19", - "Schema19ReasoningEncrypted", - "Schema19ReasoningEncryptedTypedDict", - "Schema19ReasoningSummary", - "Schema19ReasoningSummaryTypedDict", - "Schema19ReasoningText", - "Schema19ReasoningTextTypedDict", - "Schema19TypedDict", - "Schema21", - "Schema3", - "Schema5", - "Schema5Enum", - "Schema5TypedDict", - "Schema8", "Security", "SecurityTypedDict", "ServiceTier", "ServiceUnavailableResponseErrorData", "ServiceUnavailableResponseErrorDataTypedDict", - "SortEnum", "Stop", "StopTypedDict", "SystemMessage", "SystemMessageContent", "SystemMessageContentTypedDict", + "SystemMessageRole", "SystemMessageTypedDict", "TTL", "Tokenizer", "TooManyRequestsResponseErrorData", "TooManyRequestsResponseErrorDataTypedDict", "ToolCallStatus", + "ToolChoiceOption", + "ToolChoiceOptionAuto", + "ToolChoiceOptionNone", + "ToolChoiceOptionRequired", + "ToolChoiceOptionTypedDict", "ToolDefinitionJSON", "ToolDefinitionJSONFunction", "ToolDefinitionJSONFunctionTypedDict", + "ToolDefinitionJSONType", "ToolDefinitionJSONTypedDict", "ToolResponseMessage", "ToolResponseMessageContent", "ToolResponseMessageContentTypedDict", + "ToolResponseMessageRole", "ToolResponseMessageTypedDict", "TopProviderInfo", "TopProviderInfoTypedDict", @@ -1569,13 +1640,12 @@ __all__ = [ "UserMessage", "UserMessageContent", "UserMessageContentTypedDict", + "UserMessageRole", "UserMessageTypedDict", "Variables", "VariablesTypedDict", - "VideoURL1", - "VideoURL1TypedDict", - "VideoURL2", - "VideoURL2TypedDict", + "VideoInput", + "VideoInputTypedDict", "WebSearchEngine", "WebSearchPreviewToolUserLocation", "WebSearchPreviewToolUserLocationType", @@ -1584,88 +1654,72 @@ __all__ = [ ] _dynamic_imports: dict[str, str] = { - "Completion": "._schema10", - "CompletionTypedDict": "._schema10", - "Prompt": "._schema10", - "PromptTypedDict": "._schema10", - "Schema10": "._schema10", - "Schema10TypedDict": "._schema10", - "Schema14": "._schema14", - "Schema14TypedDict": "._schema14", - "Engine": "._schema17", - "Pdf": "._schema17", - "PdfEngine": "._schema17", - "PdfTypedDict": "._schema17", - "Schema17": "._schema17", - "Schema17AutoRouter": "._schema17", - "Schema17AutoRouterTypedDict": "._schema17", - "Schema17FileParser": "._schema17", - "Schema17FileParserTypedDict": "._schema17", - "Schema17Moderation": "._schema17", - "Schema17ModerationTypedDict": "._schema17", - "Schema17ResponseHealing": "._schema17", - "Schema17ResponseHealingTypedDict": "._schema17", - "Schema17TypedDict": "._schema17", - "Schema17Web": "._schema17", - "Schema17WebTypedDict": "._schema17", - "Schema19": "._schema19", - "Schema19ReasoningEncrypted": "._schema19", - "Schema19ReasoningEncryptedTypedDict": "._schema19", - "Schema19ReasoningSummary": "._schema19", - "Schema19ReasoningSummaryTypedDict": "._schema19", - "Schema19ReasoningText": "._schema19", - "Schema19ReasoningTextTypedDict": "._schema19", - "Schema19TypedDict": "._schema19", - "Schema21": "._schema19", - "Schema5": "._schema5", - "Schema5Enum": "._schema5", - "Schema5TypedDict": "._schema5", "ActivityItem": ".activityitem", "ActivityItemTypedDict": ".activityitem", "AssistantMessage": ".assistantmessage", "AssistantMessageContent": ".assistantmessage", "AssistantMessageContentTypedDict": ".assistantmessage", - "AssistantMessageImageURL": ".assistantmessage", - "AssistantMessageImageURLTypedDict": ".assistantmessage", + "AssistantMessageRole": ".assistantmessage", "AssistantMessageTypedDict": ".assistantmessage", - "Image": ".assistantmessage", - "ImageTypedDict": ".assistantmessage", + "AssistantMessageImages": ".assistantmessageimages", + "AssistantMessageImagesImageURL": ".assistantmessageimages", + "AssistantMessageImagesImageURLTypedDict": ".assistantmessageimages", + "AssistantMessageImagesTypedDict": ".assistantmessageimages", "BadGatewayResponseErrorData": ".badgatewayresponseerrordata", "BadGatewayResponseErrorDataTypedDict": ".badgatewayresponseerrordata", "BadRequestResponseErrorData": ".badrequestresponseerrordata", "BadRequestResponseErrorDataTypedDict": ".badrequestresponseerrordata", "ChatCompletionFinishReason": ".chatcompletionfinishreason", - "ChatErrorError": ".chaterror", - "ChatErrorErrorTypedDict": ".chaterror", - "Code": ".chaterror", - "CodeTypedDict": ".chaterror", "ChatGenerationParams": ".chatgenerationparams", + "ChatGenerationParamsBy": ".chatgenerationparams", + "ChatGenerationParamsIDAutoRouter": ".chatgenerationparams", + "ChatGenerationParamsIDFileParser": ".chatgenerationparams", + "ChatGenerationParamsIDModeration": ".chatgenerationparams", + "ChatGenerationParamsIDResponseHealing": ".chatgenerationparams", + "ChatGenerationParamsIDWeb": ".chatgenerationparams", + "ChatGenerationParamsIgnore": ".chatgenerationparams", + "ChatGenerationParamsIgnoreTypedDict": ".chatgenerationparams", "ChatGenerationParamsImageConfig": ".chatgenerationparams", "ChatGenerationParamsImageConfigTypedDict": ".chatgenerationparams", + "ChatGenerationParamsMaxPrice": ".chatgenerationparams", + "ChatGenerationParamsMaxPriceTypedDict": ".chatgenerationparams", + "ChatGenerationParamsOnly": ".chatgenerationparams", + "ChatGenerationParamsOnlyTypedDict": ".chatgenerationparams", + "ChatGenerationParamsOrder": ".chatgenerationparams", + "ChatGenerationParamsOrderTypedDict": ".chatgenerationparams", + "ChatGenerationParamsPartition": ".chatgenerationparams", + "ChatGenerationParamsPluginAutoRouter": ".chatgenerationparams", + "ChatGenerationParamsPluginAutoRouterTypedDict": ".chatgenerationparams", + "ChatGenerationParamsPluginFileParser": ".chatgenerationparams", + "ChatGenerationParamsPluginFileParserTypedDict": ".chatgenerationparams", + "ChatGenerationParamsPluginModeration": ".chatgenerationparams", + "ChatGenerationParamsPluginModerationTypedDict": ".chatgenerationparams", + "ChatGenerationParamsPluginResponseHealing": ".chatgenerationparams", + "ChatGenerationParamsPluginResponseHealingTypedDict": ".chatgenerationparams", + "ChatGenerationParamsPluginUnion": ".chatgenerationparams", + "ChatGenerationParamsPluginUnionTypedDict": ".chatgenerationparams", + "ChatGenerationParamsPluginWeb": ".chatgenerationparams", + "ChatGenerationParamsPluginWebTypedDict": ".chatgenerationparams", + "ChatGenerationParamsProvider": ".chatgenerationparams", + "ChatGenerationParamsProviderSort": ".chatgenerationparams", + "ChatGenerationParamsProviderSortConfig": ".chatgenerationparams", + "ChatGenerationParamsProviderSortConfigEnum": ".chatgenerationparams", + "ChatGenerationParamsProviderSortConfigTypedDict": ".chatgenerationparams", + "ChatGenerationParamsProviderSortConfigUnion": ".chatgenerationparams", + "ChatGenerationParamsProviderSortConfigUnionTypedDict": ".chatgenerationparams", + "ChatGenerationParamsProviderTypedDict": ".chatgenerationparams", + "ChatGenerationParamsSortEnum": ".chatgenerationparams", + "ChatGenerationParamsSortUnion": ".chatgenerationparams", + "ChatGenerationParamsSortUnionTypedDict": ".chatgenerationparams", + "ChatGenerationParamsTrace": ".chatgenerationparams", + "ChatGenerationParamsTraceTypedDict": ".chatgenerationparams", "ChatGenerationParamsTypedDict": ".chatgenerationparams", - "Debug": ".chatgenerationparams", - "DebugTypedDict": ".chatgenerationparams", "Effort": ".chatgenerationparams", "Modality": ".chatgenerationparams", "Reasoning": ".chatgenerationparams", "ReasoningTypedDict": ".chatgenerationparams", "ResponseFormat": ".chatgenerationparams", - "ResponseFormatJSONObject": ".chatgenerationparams", - "ResponseFormatJSONObjectTypedDict": ".chatgenerationparams", - "ResponseFormatPython": ".chatgenerationparams", - "ResponseFormatPythonTypedDict": ".chatgenerationparams", - "ResponseFormatText": ".chatgenerationparams", - "ResponseFormatTextTypedDict": ".chatgenerationparams", "ResponseFormatTypedDict": ".chatgenerationparams", - "Route": ".chatgenerationparams", - "Schema0": ".chatgenerationparams", - "Schema0TypedDict": ".chatgenerationparams", - "Schema15": ".chatgenerationparams", - "Schema15TypedDict": ".chatgenerationparams", - "Schema15Union": ".chatgenerationparams", - "Schema15UnionTypedDict": ".chatgenerationparams", - "Schema3": ".chatgenerationparams", - "Schema8": ".chatgenerationparams", "Stop": ".chatgenerationparams", "StopTypedDict": ".chatgenerationparams", "ChatGenerationTokenUsage": ".chatgenerationtokenusage", @@ -1675,31 +1729,33 @@ _dynamic_imports: dict[str, str] = { "PromptTokensDetails": ".chatgenerationtokenusage", "PromptTokensDetailsTypedDict": ".chatgenerationtokenusage", "ChatMessageContentItem": ".chatmessagecontentitem", + "ChatMessageContentItem1": ".chatmessagecontentitem", + "ChatMessageContentItem1TypedDict": ".chatmessagecontentitem", "ChatMessageContentItemTypedDict": ".chatmessagecontentitem", "ChatMessageContentItemAudio": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudioInputAudio": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudioInputAudioTypedDict": ".chatmessagecontentitemaudio", + "ChatMessageContentItemAudioType": ".chatmessagecontentitemaudio", "ChatMessageContentItemAudioTypedDict": ".chatmessagecontentitemaudio", "ChatMessageContentItemCacheControl": ".chatmessagecontentitemcachecontrol", + "ChatMessageContentItemCacheControlType": ".chatmessagecontentitemcachecontrol", "ChatMessageContentItemCacheControlTypedDict": ".chatmessagecontentitemcachecontrol", "TTL": ".chatmessagecontentitemcachecontrol", "ChatMessageContentItemImage": ".chatmessagecontentitemimage", "ChatMessageContentItemImageDetail": ".chatmessagecontentitemimage", "ChatMessageContentItemImageImageURL": ".chatmessagecontentitemimage", "ChatMessageContentItemImageImageURLTypedDict": ".chatmessagecontentitemimage", + "ChatMessageContentItemImageType": ".chatmessagecontentitemimage", "ChatMessageContentItemImageTypedDict": ".chatmessagecontentitemimage", "ChatMessageContentItemText": ".chatmessagecontentitemtext", + "ChatMessageContentItemTextType": ".chatmessagecontentitemtext", "ChatMessageContentItemTextTypedDict": ".chatmessagecontentitemtext", "ChatMessageContentItemVideo": ".chatmessagecontentitemvideo", - "ChatMessageContentItemVideoInputVideo": ".chatmessagecontentitemvideo", - "ChatMessageContentItemVideoInputVideoTypedDict": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoType": ".chatmessagecontentitemvideo", "ChatMessageContentItemVideoTypedDict": ".chatmessagecontentitemvideo", - "ChatMessageContentItemVideoVideoURL": ".chatmessagecontentitemvideo", - "ChatMessageContentItemVideoVideoURLTypedDict": ".chatmessagecontentitemvideo", - "VideoURL1": ".chatmessagecontentitemvideo", - "VideoURL1TypedDict": ".chatmessagecontentitemvideo", - "VideoURL2": ".chatmessagecontentitemvideo", - "VideoURL2TypedDict": ".chatmessagecontentitemvideo", + "ChatMessageContentItemVideoLegacy": ".chatmessagecontentitemvideolegacy", + "ChatMessageContentItemVideoLegacyType": ".chatmessagecontentitemvideolegacy", + "ChatMessageContentItemVideoLegacyTypedDict": ".chatmessagecontentitemvideolegacy", "ChatMessageTokenLogprob": ".chatmessagetokenlogprob", "ChatMessageTokenLogprobTopLogprob": ".chatmessagetokenlogprob", "ChatMessageTokenLogprobTopLogprobTypedDict": ".chatmessagetokenlogprob", @@ -1709,8 +1765,10 @@ _dynamic_imports: dict[str, str] = { "ChatMessageToolCall": ".chatmessagetoolcall", "ChatMessageToolCallFunction": ".chatmessagetoolcall", "ChatMessageToolCallFunctionTypedDict": ".chatmessagetoolcall", + "ChatMessageToolCallType": ".chatmessagetoolcall", "ChatMessageToolCallTypedDict": ".chatmessagetoolcall", "ChatResponse": ".chatresponse", + "ChatResponseObject": ".chatresponse", "ChatResponseTypedDict": ".chatresponse", "ChatResponseChoice": ".chatresponsechoice", "ChatResponseChoiceTypedDict": ".chatresponsechoice", @@ -1722,24 +1780,27 @@ _dynamic_imports: dict[str, str] = { "ChatStreamingMessageToolCall": ".chatstreamingmessagetoolcall", "ChatStreamingMessageToolCallFunction": ".chatstreamingmessagetoolcall", "ChatStreamingMessageToolCallFunctionTypedDict": ".chatstreamingmessagetoolcall", + "ChatStreamingMessageToolCallType": ".chatstreamingmessagetoolcall", "ChatStreamingMessageToolCallTypedDict": ".chatstreamingmessagetoolcall", "ChatStreamingResponseChunk": ".chatstreamingresponsechunk", - "ChatStreamingResponseChunkData": ".chatstreamingresponsechunk", - "ChatStreamingResponseChunkDataTypedDict": ".chatstreamingresponsechunk", - "ChatStreamingResponseChunkError": ".chatstreamingresponsechunk", - "ChatStreamingResponseChunkErrorTypedDict": ".chatstreamingresponsechunk", + "ChatStreamingResponseChunkObject": ".chatstreamingresponsechunk", "ChatStreamingResponseChunkTypedDict": ".chatstreamingresponsechunk", + "Error": ".chatstreamingresponsechunk", + "ErrorTypedDict": ".chatstreamingresponsechunk", "ChatStreamOptions": ".chatstreamoptions", "ChatStreamOptionsTypedDict": ".chatstreamoptions", "ChainID": ".createchargerequest", "CreateChargeRequest": ".createchargerequest", "CreateChargeRequestTypedDict": ".createchargerequest", "DataCollection": ".datacollection", + "DebugOptions": ".debugoptions", + "DebugOptionsTypedDict": ".debugoptions", "DefaultParameters": ".defaultparameters", "DefaultParametersTypedDict": ".defaultparameters", "DeveloperMessage": ".developermessage", "DeveloperMessageContent": ".developermessage", "DeveloperMessageContentTypedDict": ".developermessage", + "DeveloperMessageRole": ".developermessage", "DeveloperMessageTypedDict": ".developermessage", "EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponseerrordata", "EdgeNetworkTimeoutResponseErrorDataTypedDict": ".edgenetworktimeoutresponseerrordata", @@ -1772,15 +1833,16 @@ _dynamic_imports: dict[str, str] = { "ModelArchitectureInstructType": ".modelarchitecture", "ModelArchitectureTypedDict": ".modelarchitecture", "ModelGroup": ".modelgroup", + "Data": ".modelscountresponse", + "DataTypedDict": ".modelscountresponse", "ModelsCountResponse": ".modelscountresponse", - "ModelsCountResponseData": ".modelscountresponse", - "ModelsCountResponseDataTypedDict": ".modelscountresponse", "ModelsCountResponseTypedDict": ".modelscountresponse", "ModelsListResponse": ".modelslistresponse", "ModelsListResponseTypedDict": ".modelslistresponse", "NamedToolChoice": ".namedtoolchoice", "NamedToolChoiceFunction": ".namedtoolchoice", "NamedToolChoiceFunctionTypedDict": ".namedtoolchoice", + "NamedToolChoiceType": ".namedtoolchoice", "NamedToolChoiceTypedDict": ".namedtoolchoice", "NotFoundResponseErrorData": ".notfoundresponseerrordata", "NotFoundResponseErrorDataTypedDict": ".notfoundresponseerrordata", @@ -1908,8 +1970,8 @@ _dynamic_imports: dict[str, str] = { "OpenResponsesInputMessageItemTypedDict": ".openresponsesinputmessageitem", "OpenResponsesLogProbs": ".openresponseslogprobs", "OpenResponsesLogProbsTypedDict": ".openresponseslogprobs", - "Object": ".openresponsesnonstreamingresponse", "OpenResponsesNonStreamingResponse": ".openresponsesnonstreamingresponse", + "OpenResponsesNonStreamingResponseObject": ".openresponsesnonstreamingresponse", "OpenResponsesNonStreamingResponseToolFunction": ".openresponsesnonstreamingresponse", "OpenResponsesNonStreamingResponseToolFunctionTypedDict": ".openresponsesnonstreamingresponse", "OpenResponsesNonStreamingResponseToolUnion": ".openresponsesnonstreamingresponse", @@ -1942,12 +2004,12 @@ _dynamic_imports: dict[str, str] = { "OpenResponsesReasoningSummaryTextDoneEvent": ".openresponsesreasoningsummarytextdoneevent", "OpenResponsesReasoningSummaryTextDoneEventType": ".openresponsesreasoningsummarytextdoneevent", "OpenResponsesReasoningSummaryTextDoneEventTypedDict": ".openresponsesreasoningsummarytextdoneevent", - "IDAutoRouter": ".openresponsesrequest", - "IDFileParser": ".openresponsesrequest", - "IDModeration": ".openresponsesrequest", - "IDResponseHealing": ".openresponsesrequest", - "IDWeb": ".openresponsesrequest", "OpenResponsesRequest": ".openresponsesrequest", + "OpenResponsesRequestIDAutoRouter": ".openresponsesrequest", + "OpenResponsesRequestIDFileParser": ".openresponsesrequest", + "OpenResponsesRequestIDModeration": ".openresponsesrequest", + "OpenResponsesRequestIDResponseHealing": ".openresponsesrequest", + "OpenResponsesRequestIDWeb": ".openresponsesrequest", "OpenResponsesRequestIgnore": ".openresponsesrequest", "OpenResponsesRequestIgnoreTypedDict": ".openresponsesrequest", "OpenResponsesRequestImageConfig": ".openresponsesrequest", @@ -1958,28 +2020,30 @@ _dynamic_imports: dict[str, str] = { "OpenResponsesRequestOnlyTypedDict": ".openresponsesrequest", "OpenResponsesRequestOrder": ".openresponsesrequest", "OpenResponsesRequestOrderTypedDict": ".openresponsesrequest", + "OpenResponsesRequestPluginAutoRouter": ".openresponsesrequest", + "OpenResponsesRequestPluginAutoRouterTypedDict": ".openresponsesrequest", + "OpenResponsesRequestPluginFileParser": ".openresponsesrequest", + "OpenResponsesRequestPluginFileParserTypedDict": ".openresponsesrequest", + "OpenResponsesRequestPluginModeration": ".openresponsesrequest", + "OpenResponsesRequestPluginModerationTypedDict": ".openresponsesrequest", + "OpenResponsesRequestPluginResponseHealing": ".openresponsesrequest", + "OpenResponsesRequestPluginResponseHealingTypedDict": ".openresponsesrequest", + "OpenResponsesRequestPluginUnion": ".openresponsesrequest", + "OpenResponsesRequestPluginUnionTypedDict": ".openresponsesrequest", + "OpenResponsesRequestPluginWeb": ".openresponsesrequest", + "OpenResponsesRequestPluginWebTypedDict": ".openresponsesrequest", + "OpenResponsesRequestProvider": ".openresponsesrequest", + "OpenResponsesRequestProviderTypedDict": ".openresponsesrequest", "OpenResponsesRequestSort": ".openresponsesrequest", "OpenResponsesRequestSortTypedDict": ".openresponsesrequest", "OpenResponsesRequestToolFunction": ".openresponsesrequest", "OpenResponsesRequestToolFunctionTypedDict": ".openresponsesrequest", "OpenResponsesRequestToolUnion": ".openresponsesrequest", "OpenResponsesRequestToolUnionTypedDict": ".openresponsesrequest", + "OpenResponsesRequestTrace": ".openresponsesrequest", + "OpenResponsesRequestTraceTypedDict": ".openresponsesrequest", "OpenResponsesRequestType": ".openresponsesrequest", "OpenResponsesRequestTypedDict": ".openresponsesrequest", - "Plugin": ".openresponsesrequest", - "PluginAutoRouter": ".openresponsesrequest", - "PluginAutoRouterTypedDict": ".openresponsesrequest", - "PluginFileParser": ".openresponsesrequest", - "PluginFileParserTypedDict": ".openresponsesrequest", - "PluginModeration": ".openresponsesrequest", - "PluginModerationTypedDict": ".openresponsesrequest", - "PluginResponseHealing": ".openresponsesrequest", - "PluginResponseHealingTypedDict": ".openresponsesrequest", - "PluginTypedDict": ".openresponsesrequest", - "PluginWeb": ".openresponsesrequest", - "PluginWebTypedDict": ".openresponsesrequest", - "Provider": ".openresponsesrequest", - "ProviderTypedDict": ".openresponsesrequest", "ServiceTier": ".openresponsesrequest", "Truncation": ".openresponsesrequest", "OpenResponsesResponseText": ".openresponsesresponsetext", @@ -2107,6 +2171,7 @@ _dynamic_imports: dict[str, str] = { "ProviderOverloadedResponseErrorData": ".provideroverloadedresponseerrordata", "ProviderOverloadedResponseErrorDataTypedDict": ".provideroverloadedresponseerrordata", "ProviderPreferences": ".providerpreferences", + "ProviderPreferencesBy": ".providerpreferences", "ProviderPreferencesIgnore": ".providerpreferences", "ProviderPreferencesIgnoreTypedDict": ".providerpreferences", "ProviderPreferencesMaxPrice": ".providerpreferences", @@ -2118,20 +2183,19 @@ _dynamic_imports: dict[str, str] = { "ProviderPreferencesPartition": ".providerpreferences", "ProviderPreferencesProviderSort": ".providerpreferences", "ProviderPreferencesProviderSortConfig": ".providerpreferences", + "ProviderPreferencesProviderSortConfigEnum": ".providerpreferences", "ProviderPreferencesProviderSortConfigTypedDict": ".providerpreferences", + "ProviderPreferencesProviderSortConfigUnion": ".providerpreferences", + "ProviderPreferencesProviderSortConfigUnionTypedDict": ".providerpreferences", + "ProviderPreferencesSortEnum": ".providerpreferences", "ProviderPreferencesSortUnion": ".providerpreferences", "ProviderPreferencesSortUnionTypedDict": ".providerpreferences", "ProviderPreferencesTypedDict": ".providerpreferences", - "ProviderSortConfigEnum": ".providerpreferences", - "ProviderSortConfigUnion": ".providerpreferences", - "ProviderSortConfigUnionTypedDict": ".providerpreferences", - "SortEnum": ".providerpreferences", "ProviderSort": ".providersort", + "By": ".providersortconfig", "Partition": ".providersortconfig", "ProviderSortConfig": ".providersortconfig", "ProviderSortConfigTypedDict": ".providersortconfig", - "ProviderSortUnion": ".providersortunion", - "ProviderSortUnionTypedDict": ".providersortunion", "Pricing": ".publicendpoint", "PricingTypedDict": ".publicendpoint", "PublicEndpoint": ".publicendpoint", @@ -2140,6 +2204,20 @@ _dynamic_imports: dict[str, str] = { "PublicPricing": ".publicpricing", "PublicPricingTypedDict": ".publicpricing", "Quantization": ".quantization", + "ReasoningDetailEncrypted": ".reasoningdetailencrypted", + "ReasoningDetailEncryptedFormat": ".reasoningdetailencrypted", + "ReasoningDetailEncryptedType": ".reasoningdetailencrypted", + "ReasoningDetailEncryptedTypedDict": ".reasoningdetailencrypted", + "ReasoningDetailSummary": ".reasoningdetailsummary", + "ReasoningDetailSummaryFormat": ".reasoningdetailsummary", + "ReasoningDetailSummaryType": ".reasoningdetailsummary", + "ReasoningDetailSummaryTypedDict": ".reasoningdetailsummary", + "ReasoningDetailText": ".reasoningdetailtext", + "ReasoningDetailTextFormat": ".reasoningdetailtext", + "ReasoningDetailTextType": ".reasoningdetailtext", + "ReasoningDetailTextTypedDict": ".reasoningdetailtext", + "ReasoningDetailUnion": ".reasoningdetailunion", + "ReasoningDetailUnionTypedDict": ".reasoningdetailunion", "ReasoningSummaryText": ".reasoningsummarytext", "ReasoningSummaryTextType": ".reasoningsummarytext", "ReasoningSummaryTextTypedDict": ".reasoningsummarytext", @@ -2149,12 +2227,23 @@ _dynamic_imports: dict[str, str] = { "ReasoningTextContentTypedDict": ".reasoningtextcontent", "RequestTimeoutResponseErrorData": ".requesttimeoutresponseerrordata", "RequestTimeoutResponseErrorDataTypedDict": ".requesttimeoutresponseerrordata", + "ResponseFormatJSONObject": ".responseformatjsonobject", + "ResponseFormatJSONObjectType": ".responseformatjsonobject", + "ResponseFormatJSONObjectTypedDict": ".responseformatjsonobject", "ResponseFormatJSONSchema": ".responseformatjsonschema", + "ResponseFormatJSONSchemaType": ".responseformatjsonschema", "ResponseFormatJSONSchemaTypedDict": ".responseformatjsonschema", + "ResponseFormatText": ".responseformattext", + "ResponseFormatTextType": ".responseformattext", + "ResponseFormatTextTypedDict": ".responseformattext", "ResponseFormatTextConfig": ".responseformattextconfig", "ResponseFormatTextConfigTypedDict": ".responseformattextconfig", "ResponseFormatTextGrammar": ".responseformattextgrammar", + "ResponseFormatTextGrammarType": ".responseformattextgrammar", "ResponseFormatTextGrammarTypedDict": ".responseformattextgrammar", + "ResponseFormatTextPython": ".responseformattextpython", + "ResponseFormatTextPythonType": ".responseformattextpython", + "ResponseFormatTextPythonTypedDict": ".responseformattextpython", "ResponseInputAudio": ".responseinputaudio", "ResponseInputAudioFormat": ".responseinputaudio", "ResponseInputAudioInputAudio": ".responseinputaudio", @@ -2181,12 +2270,9 @@ _dynamic_imports: dict[str, str] = { "ResponseOutputTextTopLogprobTypedDict": ".responseoutputtext", "ResponseOutputTextType": ".responseoutputtext", "ResponseOutputTextTypedDict": ".responseoutputtext", - "CodeEnum": ".responseserrorfield", + "Code": ".responseserrorfield", "ResponsesErrorField": ".responseserrorfield", "ResponsesErrorFieldTypedDict": ".responseserrorfield", - "ResponsesFormatJSONObject": ".responsesformatjsonobject", - "ResponsesFormatJSONObjectType": ".responsesformatjsonobject", - "ResponsesFormatJSONObjectTypedDict": ".responsesformatjsonobject", "ResponsesFormatText": ".responsesformattext", "ResponsesFormatTextType": ".responsesformattext", "ResponsesFormatTextTypedDict": ".responsesformattext", @@ -2247,15 +2333,23 @@ _dynamic_imports: dict[str, str] = { "SystemMessage": ".systemmessage", "SystemMessageContent": ".systemmessage", "SystemMessageContentTypedDict": ".systemmessage", + "SystemMessageRole": ".systemmessage", "SystemMessageTypedDict": ".systemmessage", "ToolCallStatus": ".toolcallstatus", + "ToolChoiceOption": ".toolchoiceoption", + "ToolChoiceOptionAuto": ".toolchoiceoption", + "ToolChoiceOptionNone": ".toolchoiceoption", + "ToolChoiceOptionRequired": ".toolchoiceoption", + "ToolChoiceOptionTypedDict": ".toolchoiceoption", "ToolDefinitionJSON": ".tooldefinitionjson", "ToolDefinitionJSONFunction": ".tooldefinitionjson", "ToolDefinitionJSONFunctionTypedDict": ".tooldefinitionjson", + "ToolDefinitionJSONType": ".tooldefinitionjson", "ToolDefinitionJSONTypedDict": ".tooldefinitionjson", "ToolResponseMessage": ".toolresponsemessage", "ToolResponseMessageContent": ".toolresponsemessage", "ToolResponseMessageContentTypedDict": ".toolresponsemessage", + "ToolResponseMessageRole": ".toolresponsemessage", "ToolResponseMessageTypedDict": ".toolresponsemessage", "TooManyRequestsResponseErrorData": ".toomanyrequestsresponseerrordata", "TooManyRequestsResponseErrorDataTypedDict": ".toomanyrequestsresponseerrordata", @@ -2271,7 +2365,10 @@ _dynamic_imports: dict[str, str] = { "UserMessage": ".usermessage", "UserMessageContent": ".usermessage", "UserMessageContentTypedDict": ".usermessage", + "UserMessageRole": ".usermessage", "UserMessageTypedDict": ".usermessage", + "VideoInput": ".videoinput", + "VideoInputTypedDict": ".videoinput", "WebSearchEngine": ".websearchengine", "WebSearchPreviewToolUserLocation": ".websearchpreviewtooluserlocation", "WebSearchPreviewToolUserLocationType": ".websearchpreviewtooluserlocation", diff --git a/src/openrouter/components/_schema10.py b/src/openrouter/components/_schema10.py deleted file mode 100644 index ec61549..0000000 --- a/src/openrouter/components/_schema10.py +++ /dev/null @@ -1,39 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from ._schema14 import Schema14, Schema14TypedDict -from openrouter.types import BaseModel -from typing import Any, Optional, Union -from typing_extensions import NotRequired, TypeAliasType, TypedDict - - -PromptTypedDict = TypeAliasType("PromptTypedDict", Union[float, str, Any]) - - -Prompt = TypeAliasType("Prompt", Union[float, str, Any]) - - -CompletionTypedDict = TypeAliasType("CompletionTypedDict", Union[float, str, Any]) - - -Completion = TypeAliasType("Completion", Union[float, str, Any]) - - -class Schema10TypedDict(TypedDict): - prompt: NotRequired[PromptTypedDict] - completion: NotRequired[CompletionTypedDict] - image: NotRequired[Schema14TypedDict] - audio: NotRequired[Schema14TypedDict] - request: NotRequired[Schema14TypedDict] - - -class Schema10(BaseModel): - prompt: Optional[Prompt] = None - - completion: Optional[Completion] = None - - image: Optional[Schema14] = None - - audio: Optional[Schema14] = None - - request: Optional[Schema14] = None diff --git a/src/openrouter/components/_schema14.py b/src/openrouter/components/_schema14.py deleted file mode 100644 index 2f9446a..0000000 --- a/src/openrouter/components/_schema14.py +++ /dev/null @@ -1,11 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from typing import Any, Union -from typing_extensions import TypeAliasType - - -Schema14TypedDict = TypeAliasType("Schema14TypedDict", Union[float, str, Any]) - - -Schema14 = TypeAliasType("Schema14", Union[float, str, Any]) diff --git a/src/openrouter/components/_schema17.py b/src/openrouter/components/_schema17.py deleted file mode 100644 index 4122820..0000000 --- a/src/openrouter/components/_schema17.py +++ /dev/null @@ -1,154 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import BaseModel, UnrecognizedStr -from openrouter.utils import get_discriminator, validate_const, validate_open_enum -import pydantic -from pydantic import Discriminator, Tag -from pydantic.functional_validators import AfterValidator, PlainValidator -from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -class Schema17ResponseHealingTypedDict(TypedDict): - id: Literal["response-healing"] - enabled: NotRequired[bool] - - -class Schema17ResponseHealing(BaseModel): - ID: Annotated[ - Annotated[ - Literal["response-healing"], - AfterValidator(validate_const("response-healing")), - ], - pydantic.Field(alias="id"), - ] = "response-healing" - - enabled: Optional[bool] = None - - -PdfEngine = Union[ - Literal[ - "mistral-ocr", - "pdf-text", - "native", - ], - UnrecognizedStr, -] - - -class PdfTypedDict(TypedDict): - engine: NotRequired[PdfEngine] - - -class Pdf(BaseModel): - engine: Annotated[ - Optional[PdfEngine], PlainValidator(validate_open_enum(False)) - ] = None - - -class Schema17FileParserTypedDict(TypedDict): - id: Literal["file-parser"] - enabled: NotRequired[bool] - pdf: NotRequired[PdfTypedDict] - - -class Schema17FileParser(BaseModel): - ID: Annotated[ - Annotated[ - Literal["file-parser"], AfterValidator(validate_const("file-parser")) - ], - pydantic.Field(alias="id"), - ] = "file-parser" - - enabled: Optional[bool] = None - - pdf: Optional[Pdf] = None - - -Engine = Union[ - Literal[ - "native", - "exa", - ], - UnrecognizedStr, -] - - -class Schema17WebTypedDict(TypedDict): - id: Literal["web"] - enabled: NotRequired[bool] - max_results: NotRequired[float] - search_prompt: NotRequired[str] - engine: NotRequired[Engine] - - -class Schema17Web(BaseModel): - ID: Annotated[ - Annotated[Literal["web"], AfterValidator(validate_const("web"))], - pydantic.Field(alias="id"), - ] = "web" - - enabled: Optional[bool] = None - - max_results: Optional[float] = None - - search_prompt: Optional[str] = None - - engine: Annotated[Optional[Engine], PlainValidator(validate_open_enum(False))] = ( - None - ) - - -class Schema17ModerationTypedDict(TypedDict): - id: Literal["moderation"] - - -class Schema17Moderation(BaseModel): - ID: Annotated[ - Annotated[Literal["moderation"], AfterValidator(validate_const("moderation"))], - pydantic.Field(alias="id"), - ] = "moderation" - - -class Schema17AutoRouterTypedDict(TypedDict): - id: Literal["auto-router"] - enabled: NotRequired[bool] - allowed_models: NotRequired[List[str]] - - -class Schema17AutoRouter(BaseModel): - ID: Annotated[ - Annotated[ - Literal["auto-router"], AfterValidator(validate_const("auto-router")) - ], - pydantic.Field(alias="id"), - ] = "auto-router" - - enabled: Optional[bool] = None - - allowed_models: Optional[List[str]] = None - - -Schema17TypedDict = TypeAliasType( - "Schema17TypedDict", - Union[ - Schema17ModerationTypedDict, - Schema17ResponseHealingTypedDict, - Schema17AutoRouterTypedDict, - Schema17FileParserTypedDict, - Schema17WebTypedDict, - ], -) - - -Schema17 = Annotated[ - Union[ - Annotated[Schema17AutoRouter, Tag("auto-router")], - Annotated[Schema17Moderation, Tag("moderation")], - Annotated[Schema17Web, Tag("web")], - Annotated[Schema17FileParser, Tag("file-parser")], - Annotated[Schema17ResponseHealing, Tag("response-healing")], - ], - Discriminator(lambda m: get_discriminator(m, "id", "id")), -] diff --git a/src/openrouter/components/_schema19.py b/src/openrouter/components/_schema19.py deleted file mode 100644 index 3c05ebd..0000000 --- a/src/openrouter/components/_schema19.py +++ /dev/null @@ -1,235 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, - UnrecognizedStr, -) -from openrouter.utils import get_discriminator, validate_const, validate_open_enum -import pydantic -from pydantic import Discriminator, Tag, model_serializer -from pydantic.functional_validators import AfterValidator, PlainValidator -from typing import Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict - - -Schema21 = Union[ - Literal[ - "unknown", - "openai-responses-v1", - "azure-openai-responses-v1", - "xai-responses-v1", - "anthropic-claude-v1", - "google-gemini-v1", - ], - UnrecognizedStr, -] - - -class Schema19ReasoningTextTypedDict(TypedDict): - type: Literal["reasoning.text"] - text: NotRequired[Nullable[str]] - signature: NotRequired[Nullable[str]] - id: NotRequired[Nullable[str]] - format_: NotRequired[Nullable[Schema21]] - index: NotRequired[float] - - -class Schema19ReasoningText(BaseModel): - TYPE: Annotated[ - Annotated[ - Literal["reasoning.text"], AfterValidator(validate_const("reasoning.text")) - ], - pydantic.Field(alias="type"), - ] = "reasoning.text" - - text: OptionalNullable[str] = UNSET - - signature: OptionalNullable[str] = UNSET - - id: OptionalNullable[str] = UNSET - - format_: Annotated[ - Annotated[ - OptionalNullable[Schema21], PlainValidator(validate_open_enum(False)) - ], - pydantic.Field(alias="format"), - ] = UNSET - - index: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["text", "signature", "id", "format", "index"] - nullable_fields = ["text", "signature", "id", "format"] - 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 Schema19ReasoningEncryptedTypedDict(TypedDict): - data: str - type: Literal["reasoning.encrypted"] - id: NotRequired[Nullable[str]] - format_: NotRequired[Nullable[Schema21]] - index: NotRequired[float] - - -class Schema19ReasoningEncrypted(BaseModel): - data: str - - TYPE: Annotated[ - Annotated[ - Literal["reasoning.encrypted"], - AfterValidator(validate_const("reasoning.encrypted")), - ], - pydantic.Field(alias="type"), - ] = "reasoning.encrypted" - - id: OptionalNullable[str] = UNSET - - format_: Annotated[ - Annotated[ - OptionalNullable[Schema21], PlainValidator(validate_open_enum(False)) - ], - pydantic.Field(alias="format"), - ] = UNSET - - index: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["id", "format", "index"] - nullable_fields = ["id", "format"] - 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 Schema19ReasoningSummaryTypedDict(TypedDict): - summary: str - type: Literal["reasoning.summary"] - id: NotRequired[Nullable[str]] - format_: NotRequired[Nullable[Schema21]] - index: NotRequired[float] - - -class Schema19ReasoningSummary(BaseModel): - summary: str - - TYPE: Annotated[ - Annotated[ - Literal["reasoning.summary"], - AfterValidator(validate_const("reasoning.summary")), - ], - pydantic.Field(alias="type"), - ] = "reasoning.summary" - - id: OptionalNullable[str] = UNSET - - format_: Annotated[ - Annotated[ - OptionalNullable[Schema21], PlainValidator(validate_open_enum(False)) - ], - pydantic.Field(alias="format"), - ] = UNSET - - index: Optional[float] = None - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["id", "format", "index"] - nullable_fields = ["id", "format"] - 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 - - -Schema19TypedDict = TypeAliasType( - "Schema19TypedDict", - Union[ - Schema19ReasoningSummaryTypedDict, - Schema19ReasoningEncryptedTypedDict, - Schema19ReasoningTextTypedDict, - ], -) - - -Schema19 = Annotated[ - Union[ - Annotated[Schema19ReasoningSummary, Tag("reasoning.summary")], - Annotated[Schema19ReasoningEncrypted, Tag("reasoning.encrypted")], - Annotated[Schema19ReasoningText, Tag("reasoning.text")], - ], - Discriminator(lambda m: get_discriminator(m, "type", "type")), -] diff --git a/src/openrouter/components/_schema5.py b/src/openrouter/components/_schema5.py deleted file mode 100644 index c7458de..0000000 --- a/src/openrouter/components/_schema5.py +++ /dev/null @@ -1,96 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import UnrecognizedStr -from openrouter.utils import validate_open_enum -from pydantic.functional_validators import PlainValidator -from typing import Literal, Union -from typing_extensions import Annotated, TypeAliasType - - -Schema5Enum = Union[ - Literal[ - "AI21", - "AionLabs", - "Alibaba", - "Ambient", - "Amazon Bedrock", - "Amazon Nova", - "Anthropic", - "Arcee AI", - "AtlasCloud", - "Avian", - "Azure", - "BaseTen", - "BytePlus", - "Black Forest Labs", - "Cerebras", - "Chutes", - "Cirrascale", - "Clarifai", - "Cloudflare", - "Cohere", - "Crusoe", - "DeepInfra", - "DeepSeek", - "Featherless", - "Fireworks", - "Friendli", - "GMICloud", - "Google", - "Google AI Studio", - "Groq", - "Hyperbolic", - "Inception", - "Inceptron", - "InferenceNet", - "Infermatic", - "Inflection", - "Liquid", - "Mara", - "Mancer 2", - "Minimax", - "ModelRun", - "Mistral", - "Modular", - "Moonshot AI", - "Morph", - "NCompass", - "Nebius", - "NextBit", - "Novita", - "Nvidia", - "OpenAI", - "OpenInference", - "Parasail", - "Perplexity", - "Phala", - "Relace", - "SambaNova", - "Seed", - "SiliconFlow", - "Sourceful", - "StepFun", - "Stealth", - "StreamLake", - "Switchpoint", - "Together", - "Upstage", - "Venice", - "WandB", - "Xiaomi", - "xAI", - "Z.AI", - "FakeProvider", - ], - UnrecognizedStr, -] - - -Schema5TypedDict = TypeAliasType("Schema5TypedDict", Union[Schema5Enum, str]) - - -Schema5 = TypeAliasType( - "Schema5", - Union[Annotated[Schema5Enum, PlainValidator(validate_open_enum(False))], str], -) diff --git a/src/openrouter/components/assistantmessage.py b/src/openrouter/components/assistantmessage.py index a3ec986..53c5026 100644 --- a/src/openrouter/components/assistantmessage.py +++ b/src/openrouter/components/assistantmessage.py @@ -1,12 +1,16 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from ._schema19 import Schema19, Schema19TypedDict +from .assistantmessageimages import ( + AssistantMessageImages, + AssistantMessageImagesTypedDict, +) from .chatmessagecontentitem import ( ChatMessageContentItem, ChatMessageContentItemTypedDict, ) from .chatmessagetoolcall import ChatMessageToolCall, ChatMessageToolCallTypedDict +from .reasoningdetailunion import ReasoningDetailUnion, ReasoningDetailUnionTypedDict from openrouter.types import ( BaseModel, Nullable, @@ -14,71 +18,72 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import validate_const -import pydantic from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator -from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict +from typing import Any, List, Literal, Optional, Union +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +AssistantMessageRole = Literal["assistant",] AssistantMessageContentTypedDict = TypeAliasType( "AssistantMessageContentTypedDict", - Union[str, List[ChatMessageContentItemTypedDict]], + Union[str, List[ChatMessageContentItemTypedDict], Any], ) +r"""Assistant message content""" AssistantMessageContent = TypeAliasType( - "AssistantMessageContent", Union[str, List[ChatMessageContentItem]] + "AssistantMessageContent", Union[str, List[ChatMessageContentItem], Any] ) - - -class AssistantMessageImageURLTypedDict(TypedDict): - url: str - - -class AssistantMessageImageURL(BaseModel): - url: str - - -class ImageTypedDict(TypedDict): - image_url: AssistantMessageImageURLTypedDict - - -class Image(BaseModel): - image_url: AssistantMessageImageURL +r"""Assistant message content""" class AssistantMessageTypedDict(TypedDict): - role: Literal["assistant"] + r"""Assistant message for requests and responses""" + + role: AssistantMessageRole content: NotRequired[Nullable[AssistantMessageContentTypedDict]] + r"""Assistant message content""" name: NotRequired[str] + r"""Optional name for the assistant""" tool_calls: NotRequired[List[ChatMessageToolCallTypedDict]] + r"""Tool calls made by the assistant""" refusal: NotRequired[Nullable[str]] + r"""Refusal message if content was refused""" reasoning: NotRequired[Nullable[str]] - reasoning_details: NotRequired[List[Schema19TypedDict]] - images: NotRequired[List[ImageTypedDict]] + r"""Reasoning output""" + reasoning_details: NotRequired[List[ReasoningDetailUnionTypedDict]] + r"""Reasoning details for extended thinking models""" + images: NotRequired[List[AssistantMessageImagesTypedDict]] + r"""Generated images from image generation models""" class AssistantMessage(BaseModel): - ROLE: Annotated[ - Annotated[Literal["assistant"], AfterValidator(validate_const("assistant"))], - pydantic.Field(alias="role"), - ] = "assistant" + r"""Assistant message for requests and responses""" + + role: AssistantMessageRole content: OptionalNullable[AssistantMessageContent] = UNSET + r"""Assistant message content""" name: Optional[str] = None + r"""Optional name for the assistant""" tool_calls: Optional[List[ChatMessageToolCall]] = None + r"""Tool calls made by the assistant""" refusal: OptionalNullable[str] = UNSET + r"""Refusal message if content was refused""" reasoning: OptionalNullable[str] = UNSET + r"""Reasoning output""" - reasoning_details: Optional[List[Schema19]] = None + reasoning_details: Optional[List[ReasoningDetailUnion]] = None + r"""Reasoning details for extended thinking models""" - images: Optional[List[Image]] = None + images: Optional[List[AssistantMessageImages]] = None + r"""Generated images from image generation models""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/assistantmessageimages.py b/src/openrouter/components/assistantmessageimages.py new file mode 100644 index 0000000..2f2fdfe --- /dev/null +++ b/src/openrouter/components/assistantmessageimages.py @@ -0,0 +1,23 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class AssistantMessageImagesImageURLTypedDict(TypedDict): + url: str + r"""URL or base64-encoded data of the generated image""" + + +class AssistantMessageImagesImageURL(BaseModel): + url: str + r"""URL or base64-encoded data of the generated image""" + + +class AssistantMessageImagesTypedDict(TypedDict): + image_url: AssistantMessageImagesImageURLTypedDict + + +class AssistantMessageImages(BaseModel): + image_url: AssistantMessageImagesImageURL diff --git a/src/openrouter/components/chaterror.py b/src/openrouter/components/chaterror.py deleted file mode 100644 index b0c2d93..0000000 --- a/src/openrouter/components/chaterror.py +++ /dev/null @@ -1,66 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from openrouter.types import ( - BaseModel, - Nullable, - OptionalNullable, - UNSET, - UNSET_SENTINEL, -) -from pydantic import model_serializer -from typing import Union -from typing_extensions import NotRequired, TypeAliasType, TypedDict - - -CodeTypedDict = TypeAliasType("CodeTypedDict", Union[str, float]) - - -Code = TypeAliasType("Code", Union[str, float]) - - -class ChatErrorErrorTypedDict(TypedDict): - code: Nullable[CodeTypedDict] - message: str - param: NotRequired[Nullable[str]] - type: NotRequired[Nullable[str]] - - -class ChatErrorError(BaseModel): - code: Nullable[Code] - - message: str - - param: OptionalNullable[str] = UNSET - - type: OptionalNullable[str] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = ["param", "type"] - nullable_fields = ["code", "param", "type"] - 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/components/chatgenerationparams.py b/src/openrouter/components/chatgenerationparams.py index c052d8c..fa8b22c 100644 --- a/src/openrouter/components/chatgenerationparams.py +++ b/src/openrouter/components/chatgenerationparams.py @@ -1,22 +1,38 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from ._schema10 import Schema10, Schema10TypedDict -from ._schema17 import Schema17, Schema17TypedDict -from ._schema5 import Schema5, Schema5TypedDict from .chatstreamoptions import ChatStreamOptions, ChatStreamOptionsTypedDict +from .datacollection import DataCollection +from .debugoptions import DebugOptions, DebugOptionsTypedDict from .message import Message, MessageTypedDict -from .providersortunion import ProviderSortUnion, ProviderSortUnionTypedDict -from .reasoningsummaryverbosity import ReasoningSummaryVerbosity +from .pdfparseroptions import PDFParserOptions, PDFParserOptionsTypedDict +from .preferredmaxlatency import PreferredMaxLatency, PreferredMaxLatencyTypedDict +from .preferredminthroughput import ( + PreferredMinThroughput, + PreferredMinThroughputTypedDict, +) +from .providername import ProviderName +from .quantization import Quantization +from .responseformatjsonobject import ( + ResponseFormatJSONObject, + ResponseFormatJSONObjectTypedDict, +) from .responseformatjsonschema import ( ResponseFormatJSONSchema, ResponseFormatJSONSchemaTypedDict, ) +from .responseformattext import ResponseFormatText, ResponseFormatTextTypedDict from .responseformattextgrammar import ( ResponseFormatTextGrammar, ResponseFormatTextGrammarTypedDict, ) +from .responseformattextpython import ( + ResponseFormatTextPython, + ResponseFormatTextPythonTypedDict, +) +from .toolchoiceoption import ToolChoiceOption, ToolChoiceOptionTypedDict from .tooldefinitionjson import ToolDefinitionJSON, ToolDefinitionJSONTypedDict +from .websearchengine import WebSearchEngine from openrouter.types import ( BaseModel, Nullable, @@ -25,59 +41,109 @@ from openrouter.types import ( UNSET_SENTINEL, UnrecognizedStr, ) -from openrouter.utils import get_discriminator, validate_const, validate_open_enum +from openrouter.utils import get_discriminator, validate_open_enum import pydantic -from pydantic import Discriminator, Tag, model_serializer -from pydantic.functional_validators import AfterValidator, PlainValidator +from pydantic import ConfigDict, Discriminator, Tag, model_serializer +from pydantic.functional_validators import PlainValidator from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -Schema3 = Union[ +ChatGenerationParamsOrderTypedDict = TypeAliasType( + "ChatGenerationParamsOrderTypedDict", Union[ProviderName, str] +) + + +ChatGenerationParamsOrder = TypeAliasType( + "ChatGenerationParamsOrder", + Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str], +) + + +ChatGenerationParamsOnlyTypedDict = TypeAliasType( + "ChatGenerationParamsOnlyTypedDict", Union[ProviderName, str] +) + + +ChatGenerationParamsOnly = TypeAliasType( + "ChatGenerationParamsOnly", + Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str], +) + + +ChatGenerationParamsIgnoreTypedDict = TypeAliasType( + "ChatGenerationParamsIgnoreTypedDict", Union[ProviderName, str] +) + + +ChatGenerationParamsIgnore = TypeAliasType( + "ChatGenerationParamsIgnore", + Union[Annotated[ProviderName, PlainValidator(validate_open_enum(False))], str], +) + + +ChatGenerationParamsSortEnum = Union[ Literal[ - "deny", - "allow", + "price", + "throughput", + "latency", ], UnrecognizedStr, ] -Schema8 = Union[ - Literal[ - "int4", - "int8", - "fp4", - "fp6", - "fp8", - "fp16", - "bf16", - "fp32", - "unknown", - ], - UnrecognizedStr, +ChatGenerationParamsProviderSortConfigEnum = Literal[ + "price", + "throughput", + "latency", ] -class Schema15TypedDict(TypedDict): - p50: NotRequired[Nullable[float]] - p75: NotRequired[Nullable[float]] - p90: NotRequired[Nullable[float]] - p99: NotRequired[Nullable[float]] +ChatGenerationParamsBy = Union[ + Literal[ + "price", + "throughput", + "latency", + ], + UnrecognizedStr, +] +r"""The provider sorting strategy (price, throughput, latency)""" -class Schema15(BaseModel): - p50: OptionalNullable[float] = UNSET +ChatGenerationParamsPartition = Union[ + Literal[ + "model", + "none", + ], + UnrecognizedStr, +] +r"""Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model.""" - p75: OptionalNullable[float] = UNSET - p90: OptionalNullable[float] = UNSET +class ChatGenerationParamsProviderSortConfigTypedDict(TypedDict): + by: NotRequired[Nullable[ChatGenerationParamsBy]] + r"""The provider sorting strategy (price, throughput, latency)""" + partition: NotRequired[Nullable[ChatGenerationParamsPartition]] + r"""Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model.""" - p99: OptionalNullable[float] = UNSET + +class ChatGenerationParamsProviderSortConfig(BaseModel): + by: Annotated[ + OptionalNullable[ChatGenerationParamsBy], + PlainValidator(validate_open_enum(False)), + ] = UNSET + r"""The provider sorting strategy (price, throughput, latency)""" + + partition: Annotated[ + OptionalNullable[ChatGenerationParamsPartition], + PlainValidator(validate_open_enum(False)), + ] = UNSET + r"""Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model.""" @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = ["p50", "p75", "p90", "p99"] - nullable_fields = ["p50", "p75", "p90", "p99"] + optional_fields = ["by", "partition"] + nullable_fields = ["by", "partition"] null_default_fields = [] serialized = handler(self) @@ -105,60 +171,177 @@ class Schema15(BaseModel): return m -Schema15UnionTypedDict = TypeAliasType( - "Schema15UnionTypedDict", Union[Schema15TypedDict, float] +ChatGenerationParamsProviderSortConfigUnionTypedDict = TypeAliasType( + "ChatGenerationParamsProviderSortConfigUnionTypedDict", + Union[ + ChatGenerationParamsProviderSortConfigTypedDict, + ChatGenerationParamsProviderSortConfigEnum, + ], ) -Schema15Union = TypeAliasType("Schema15Union", Union[Schema15, float]) +ChatGenerationParamsProviderSortConfigUnion = TypeAliasType( + "ChatGenerationParamsProviderSortConfigUnion", + Union[ + ChatGenerationParamsProviderSortConfig, + ChatGenerationParamsProviderSortConfigEnum, + ], +) -class Schema0TypedDict(TypedDict): +ChatGenerationParamsProviderSort = Union[ + Literal[ + "price", + "throughput", + "latency", + ], + UnrecognizedStr, +] +r"""The provider sorting strategy (price, throughput, latency)""" + + +ChatGenerationParamsSortUnionTypedDict = TypeAliasType( + "ChatGenerationParamsSortUnionTypedDict", + Union[ + ChatGenerationParamsProviderSort, + ChatGenerationParamsProviderSortConfigUnionTypedDict, + ChatGenerationParamsSortEnum, + ], +) +r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + + +ChatGenerationParamsSortUnion = TypeAliasType( + "ChatGenerationParamsSortUnion", + Union[ + Annotated[ + ChatGenerationParamsProviderSort, PlainValidator(validate_open_enum(False)) + ], + ChatGenerationParamsProviderSortConfigUnion, + Annotated[ + ChatGenerationParamsSortEnum, PlainValidator(validate_open_enum(False)) + ], + ], +) +r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" + + +class ChatGenerationParamsMaxPriceTypedDict(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[str] + r"""Price per million prompt tokens""" + completion: NotRequired[str] + image: NotRequired[str] + audio: NotRequired[str] + request: NotRequired[str] + + +class ChatGenerationParamsMaxPrice(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[str] = None + r"""Price per million prompt tokens""" + + completion: Optional[str] = None + + image: Optional[str] = None + + audio: Optional[str] = None + + request: Optional[str] = None + + +class ChatGenerationParamsProviderTypedDict(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]] - data_collection: NotRequired[Nullable[Schema3]] + 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]] + 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. + """ zdr: NotRequired[Nullable[bool]] + r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" enforce_distillable_text: NotRequired[Nullable[bool]] - order: NotRequired[Nullable[List[Schema5TypedDict]]] - only: NotRequired[Nullable[List[Schema5TypedDict]]] - ignore: NotRequired[Nullable[List[Schema5TypedDict]]] - quantizations: NotRequired[Nullable[List[Schema8]]] - sort: NotRequired[Nullable[ProviderSortUnionTypedDict]] - max_price: NotRequired[Schema10TypedDict] - preferred_min_throughput: NotRequired[Nullable[Schema15UnionTypedDict]] - preferred_max_latency: NotRequired[Nullable[Schema15UnionTypedDict]] + r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.""" + order: NotRequired[Nullable[List[ChatGenerationParamsOrderTypedDict]]] + 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[ChatGenerationParamsOnlyTypedDict]]] + 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[ChatGenerationParamsIgnoreTypedDict]]] + 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]]] + r"""A list of quantization levels to filter the provider by.""" + sort: NotRequired[Nullable[ChatGenerationParamsSortUnionTypedDict]] + max_price: NotRequired[ChatGenerationParamsMaxPriceTypedDict] + r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" + preferred_min_throughput: NotRequired[Nullable[PreferredMinThroughputTypedDict]] + r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" + preferred_max_latency: NotRequired[Nullable[PreferredMaxLatencyTypedDict]] + r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" -class Schema0(BaseModel): +class ChatGenerationParamsProvider(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: Annotated[ - OptionalNullable[Schema3], PlainValidator(validate_open_enum(False)) + OptionalNullable[DataCollection], PlainValidator(validate_open_enum(False)) ] = 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. + """ zdr: OptionalNullable[bool] = UNSET + r"""Whether to restrict routing to only ZDR (Zero Data Retention) endpoints. When true, only endpoints that do not retain prompts will be used.""" enforce_distillable_text: OptionalNullable[bool] = UNSET + r"""Whether to restrict routing to only models that allow text distillation. When true, only models where the author has allowed distillation will be used.""" - order: OptionalNullable[List[Schema5]] = UNSET + order: OptionalNullable[List[ChatGenerationParamsOrder]] = 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[Schema5]] = UNSET + only: OptionalNullable[List[ChatGenerationParamsOnly]] = 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[Schema5]] = UNSET + ignore: OptionalNullable[List[ChatGenerationParamsIgnore]] = 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[Annotated[Schema8, PlainValidator(validate_open_enum(False))]] + List[Annotated[Quantization, PlainValidator(validate_open_enum(False))]] ] = UNSET + r"""A list of quantization levels to filter the provider by.""" - sort: OptionalNullable[ProviderSortUnion] = UNSET + sort: OptionalNullable[ChatGenerationParamsSortUnion] = UNSET - max_price: Optional[Schema10] = None + max_price: Optional[ChatGenerationParamsMaxPrice] = None + r"""The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.""" - preferred_min_throughput: OptionalNullable[Schema15Union] = UNSET + preferred_min_throughput: OptionalNullable[PreferredMinThroughput] = UNSET + r"""Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" - preferred_max_latency: OptionalNullable[Schema15Union] = UNSET + preferred_max_latency: OptionalNullable[PreferredMaxLatency] = UNSET + r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -218,15 +401,165 @@ class Schema0(BaseModel): return m -Route = Union[ - Literal[ - "fallback", - "sort", +ChatGenerationParamsIDResponseHealing = Literal["response-healing",] + + +class ChatGenerationParamsPluginResponseHealingTypedDict(TypedDict): + id: ChatGenerationParamsIDResponseHealing + enabled: NotRequired[bool] + r"""Set to false to disable the response-healing plugin for this request. Defaults to true.""" + + +class ChatGenerationParamsPluginResponseHealing(BaseModel): + id: ChatGenerationParamsIDResponseHealing + + enabled: Optional[bool] = None + r"""Set to false to disable the response-healing plugin for this request. Defaults to true.""" + + +ChatGenerationParamsIDFileParser = Literal["file-parser",] + + +class ChatGenerationParamsPluginFileParserTypedDict(TypedDict): + id: ChatGenerationParamsIDFileParser + enabled: NotRequired[bool] + r"""Set to false to disable the file-parser plugin for this request. Defaults to true.""" + pdf: NotRequired[PDFParserOptionsTypedDict] + r"""Options for PDF parsing.""" + + +class ChatGenerationParamsPluginFileParser(BaseModel): + id: ChatGenerationParamsIDFileParser + + enabled: Optional[bool] = None + r"""Set to false to disable the file-parser plugin for this request. Defaults to true.""" + + pdf: Optional[PDFParserOptions] = None + r"""Options for PDF parsing.""" + + +ChatGenerationParamsIDWeb = Literal["web",] + + +class ChatGenerationParamsPluginWebTypedDict(TypedDict): + id: ChatGenerationParamsIDWeb + enabled: NotRequired[bool] + r"""Set to false to disable the web-search plugin for this request. Defaults to true.""" + max_results: NotRequired[float] + search_prompt: NotRequired[str] + engine: NotRequired[WebSearchEngine] + r"""The search engine to use for web search.""" + + +class ChatGenerationParamsPluginWeb(BaseModel): + id: ChatGenerationParamsIDWeb + + enabled: Optional[bool] = None + r"""Set to false to disable the web-search plugin for this request. Defaults to true.""" + + max_results: Optional[float] = None + + search_prompt: Optional[str] = None + + engine: Annotated[ + Optional[WebSearchEngine], PlainValidator(validate_open_enum(False)) + ] = None + r"""The search engine to use for web search.""" + + +ChatGenerationParamsIDModeration = Literal["moderation",] + + +class ChatGenerationParamsPluginModerationTypedDict(TypedDict): + id: ChatGenerationParamsIDModeration + + +class ChatGenerationParamsPluginModeration(BaseModel): + id: ChatGenerationParamsIDModeration + + +ChatGenerationParamsIDAutoRouter = Literal["auto-router",] + + +class ChatGenerationParamsPluginAutoRouterTypedDict(TypedDict): + id: ChatGenerationParamsIDAutoRouter + enabled: NotRequired[bool] + r"""Set to false to disable the auto-router plugin for this request. Defaults to true.""" + allowed_models: NotRequired[List[str]] + r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" + + +class ChatGenerationParamsPluginAutoRouter(BaseModel): + id: ChatGenerationParamsIDAutoRouter + + enabled: Optional[bool] = None + r"""Set to false to disable the auto-router plugin for this request. Defaults to true.""" + + allowed_models: Optional[List[str]] = None + r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" + + +ChatGenerationParamsPluginUnionTypedDict = TypeAliasType( + "ChatGenerationParamsPluginUnionTypedDict", + Union[ + ChatGenerationParamsPluginModerationTypedDict, + ChatGenerationParamsPluginResponseHealingTypedDict, + ChatGenerationParamsPluginAutoRouterTypedDict, + ChatGenerationParamsPluginFileParserTypedDict, + ChatGenerationParamsPluginWebTypedDict, ], - UnrecognizedStr, +) + + +ChatGenerationParamsPluginUnion = Annotated[ + Union[ + Annotated[ChatGenerationParamsPluginAutoRouter, Tag("auto-router")], + Annotated[ChatGenerationParamsPluginModeration, Tag("moderation")], + Annotated[ChatGenerationParamsPluginWeb, Tag("web")], + Annotated[ChatGenerationParamsPluginFileParser, Tag("file-parser")], + Annotated[ChatGenerationParamsPluginResponseHealing, Tag("response-healing")], + ], + Discriminator(lambda m: get_discriminator(m, "id", "id")), ] +class ChatGenerationParamsTraceTypedDict(TypedDict): + r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" + + trace_id: NotRequired[str] + trace_name: NotRequired[str] + span_name: NotRequired[str] + generation_name: NotRequired[str] + parent_span_id: NotRequired[str] + + +class ChatGenerationParamsTrace(BaseModel): + r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + trace_id: Optional[str] = None + + trace_name: Optional[str] = None + + span_name: Optional[str] = None + + generation_name: Optional[str] = None + + parent_span_id: Optional[str] = None + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + Effort = Union[ Literal[ "xhigh", @@ -238,22 +571,26 @@ Effort = Union[ ], UnrecognizedStr, ] +r"""Constrains effort on reasoning for reasoning models""" class ReasoningTypedDict(TypedDict): + r"""Configuration options for reasoning models""" + effort: NotRequired[Nullable[Effort]] - summary: NotRequired[Nullable[ReasoningSummaryVerbosity]] + r"""Constrains effort on reasoning for reasoning models""" + summary: NotRequired[Nullable[Any]] class Reasoning(BaseModel): + r"""Configuration options for reasoning models""" + effort: Annotated[ OptionalNullable[Effort], PlainValidator(validate_open_enum(False)) ] = UNSET + r"""Constrains effort on reasoning for reasoning models""" - summary: Annotated[ - OptionalNullable[ReasoningSummaryVerbosity], - PlainValidator(validate_open_enum(False)), - ] = UNSET + summary: OptionalNullable[Any] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -286,51 +623,17 @@ class Reasoning(BaseModel): return m -class ResponseFormatPythonTypedDict(TypedDict): - type: Literal["python"] - - -class ResponseFormatPython(BaseModel): - TYPE: Annotated[ - Annotated[Literal["python"], AfterValidator(validate_const("python"))], - pydantic.Field(alias="type"), - ] = "python" - - -class ResponseFormatJSONObjectTypedDict(TypedDict): - type: Literal["json_object"] - - -class ResponseFormatJSONObject(BaseModel): - TYPE: Annotated[ - Annotated[ - Literal["json_object"], AfterValidator(validate_const("json_object")) - ], - pydantic.Field(alias="type"), - ] = "json_object" - - -class ResponseFormatTextTypedDict(TypedDict): - type: Literal["text"] - - -class ResponseFormatText(BaseModel): - TYPE: Annotated[ - Annotated[Literal["text"], AfterValidator(validate_const("text"))], - pydantic.Field(alias="type"), - ] = "text" - - ResponseFormatTypedDict = TypeAliasType( "ResponseFormatTypedDict", Union[ ResponseFormatTextTypedDict, ResponseFormatJSONObjectTypedDict, - ResponseFormatPythonTypedDict, + ResponseFormatTextPythonTypedDict, ResponseFormatJSONSchemaTypedDict, ResponseFormatTextGrammarTypedDict, ], ) +r"""Response format configuration""" ResponseFormat = Annotated[ @@ -339,33 +642,28 @@ ResponseFormat = Annotated[ Annotated[ResponseFormatJSONObject, Tag("json_object")], Annotated[ResponseFormatJSONSchema, Tag("json_schema")], Annotated[ResponseFormatTextGrammar, Tag("grammar")], - Annotated[ResponseFormatPython, Tag("python")], + Annotated[ResponseFormatTextPython, Tag("python")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), ] +r"""Response format configuration""" -StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str]]) +StopTypedDict = TypeAliasType("StopTypedDict", Union[str, List[str], Any]) +r"""Stop sequences (up to 4)""" -Stop = TypeAliasType("Stop", Union[str, List[str]]) - - -class DebugTypedDict(TypedDict): - echo_upstream_body: NotRequired[bool] - - -class Debug(BaseModel): - echo_upstream_body: Optional[bool] = None +Stop = TypeAliasType("Stop", Union[str, List[str], Any]) +r"""Stop sequences (up to 4)""" ChatGenerationParamsImageConfigTypedDict = TypeAliasType( - "ChatGenerationParamsImageConfigTypedDict", Union[str, float, List[Any]] + "ChatGenerationParamsImageConfigTypedDict", Union[str, float, List[Nullable[Any]]] ) ChatGenerationParamsImageConfig = TypeAliasType( - "ChatGenerationParamsImageConfig", Union[str, float, List[Any]] + "ChatGenerationParamsImageConfig", Union[str, float, List[Nullable[Any]]] ) @@ -379,108 +677,171 @@ Modality = Union[ class ChatGenerationParamsTypedDict(TypedDict): + r"""Chat completion request parameters""" + messages: List[MessageTypedDict] - provider: NotRequired[Nullable[Schema0TypedDict]] - plugins: NotRequired[List[Schema17TypedDict]] - route: NotRequired[Nullable[Route]] + r"""List of messages for the conversation""" + provider: NotRequired[Nullable[ChatGenerationParamsProviderTypedDict]] + r"""When multiple model providers are available, optionally indicate your routing preference.""" + plugins: NotRequired[List[ChatGenerationParamsPluginUnionTypedDict]] + r"""Plugins you want to enable for this request, including their settings.""" user: NotRequired[str] + r"""Unique user identifier""" session_id: NotRequired[str] + r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.""" + trace: NotRequired[ChatGenerationParamsTraceTypedDict] + r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" model: NotRequired[str] + r"""Model to use for completion""" models: NotRequired[List[str]] + r"""Models 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[ReasoningTypedDict] + r"""Configuration options for reasoning models""" response_format: NotRequired[ResponseFormatTypedDict] + r"""Response format configuration""" seed: NotRequired[Nullable[int]] + r"""Random seed for deterministic outputs""" stop: NotRequired[Nullable[StopTypedDict]] + r"""Stop sequences (up to 4)""" stream: NotRequired[bool] + r"""Enable streaming response""" stream_options: NotRequired[Nullable[ChatStreamOptionsTypedDict]] + r"""Streaming configuration options""" temperature: NotRequired[Nullable[float]] - tool_choice: NotRequired[Any] + r"""Sampling temperature (0-2)""" + parallel_tool_calls: NotRequired[Nullable[bool]] + tool_choice: NotRequired[ToolChoiceOptionTypedDict] + r"""Tool choice configuration""" tools: NotRequired[List[ToolDefinitionJSONTypedDict]] + r"""Available tools for function calling""" top_p: NotRequired[Nullable[float]] - debug: NotRequired[DebugTypedDict] + r"""Nucleus sampling parameter (0-1)""" + debug: NotRequired[DebugOptionsTypedDict] + r"""Debug options for inspecting request transformations (streaming only)""" image_config: NotRequired[Dict[str, ChatGenerationParamsImageConfigTypedDict]] + r"""Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.""" modalities: NotRequired[List[Modality]] + r"""Output modalities for the response. Supported values are \"text\" and \"image\".""" class ChatGenerationParams(BaseModel): + r"""Chat completion request parameters""" + messages: List[Message] + r"""List of messages for the conversation""" - provider: OptionalNullable[Schema0] = UNSET + provider: OptionalNullable[ChatGenerationParamsProvider] = UNSET + r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: Optional[List[Schema17]] = None - - route: Annotated[ - OptionalNullable[Route], PlainValidator(validate_open_enum(False)) - ] = UNSET + plugins: Optional[List[ChatGenerationParamsPluginUnion]] = None + r"""Plugins you want to enable for this request, including their settings.""" user: Optional[str] = None + r"""Unique user identifier""" session_id: Optional[str] = None + r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.""" + + trace: Optional[ChatGenerationParamsTrace] = None + r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" model: Optional[str] = None + r"""Model to use for completion""" models: Optional[List[str]] = None + r"""Models 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: Optional[Reasoning] = None + r"""Configuration options for reasoning models""" response_format: Optional[ResponseFormat] = None + r"""Response format configuration""" seed: OptionalNullable[int] = UNSET + r"""Random seed for deterministic outputs""" stop: OptionalNullable[Stop] = UNSET + r"""Stop sequences (up to 4)""" stream: Optional[bool] = False + r"""Enable streaming response""" stream_options: OptionalNullable[ChatStreamOptions] = UNSET + r"""Streaming configuration options""" - temperature: OptionalNullable[float] = UNSET + temperature: OptionalNullable[float] = 1 + r"""Sampling temperature (0-2)""" - tool_choice: Optional[Any] = None + parallel_tool_calls: OptionalNullable[bool] = UNSET + + tool_choice: Optional[ToolChoiceOption] = None + r"""Tool choice configuration""" tools: Optional[List[ToolDefinitionJSON]] = None + r"""Available tools for function calling""" - top_p: OptionalNullable[float] = UNSET + top_p: OptionalNullable[float] = 1 + r"""Nucleus sampling parameter (0-1)""" - debug: Optional[Debug] = None + debug: Optional[DebugOptions] = None + r"""Debug options for inspecting request transformations (streaming only)""" image_config: Optional[Dict[str, ChatGenerationParamsImageConfig]] = None + r"""Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.""" modalities: Optional[ List[Annotated[Modality, PlainValidator(validate_open_enum(False))]] ] = None + r"""Output modalities for the response. Supported values are \"text\" and \"image\".""" @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ "provider", "plugins", - "route", "user", "session_id", + "trace", "model", "models", "frequency_penalty", @@ -498,6 +859,7 @@ class ChatGenerationParams(BaseModel): "stream", "stream_options", "temperature", + "parallel_tool_calls", "tool_choice", "tools", "top_p", @@ -507,7 +869,6 @@ class ChatGenerationParams(BaseModel): ] nullable_fields = [ "provider", - "route", "frequency_penalty", "logit_bias", "logprobs", @@ -519,6 +880,7 @@ class ChatGenerationParams(BaseModel): "stop", "stream_options", "temperature", + "parallel_tool_calls", "top_p", ] null_default_fields = [] diff --git a/src/openrouter/components/chatgenerationtokenusage.py b/src/openrouter/components/chatgenerationtokenusage.py index 6079682..66bf2dd 100644 --- a/src/openrouter/components/chatgenerationtokenusage.py +++ b/src/openrouter/components/chatgenerationtokenusage.py @@ -14,20 +14,32 @@ from typing_extensions import NotRequired, TypedDict class CompletionTokensDetailsTypedDict(TypedDict): + r"""Detailed completion token usage""" + reasoning_tokens: NotRequired[Nullable[float]] + r"""Tokens used for reasoning""" audio_tokens: NotRequired[Nullable[float]] + r"""Tokens used for audio output""" accepted_prediction_tokens: NotRequired[Nullable[float]] + r"""Accepted prediction tokens""" rejected_prediction_tokens: NotRequired[Nullable[float]] + r"""Rejected prediction tokens""" class CompletionTokensDetails(BaseModel): + r"""Detailed completion token usage""" + reasoning_tokens: OptionalNullable[float] = UNSET + r"""Tokens used for reasoning""" audio_tokens: OptionalNullable[float] = UNSET + r"""Tokens used for audio output""" accepted_prediction_tokens: OptionalNullable[float] = UNSET + r"""Accepted prediction tokens""" rejected_prediction_tokens: OptionalNullable[float] = UNSET + r"""Rejected prediction tokens""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -71,40 +83,66 @@ class CompletionTokensDetails(BaseModel): class PromptTokensDetailsTypedDict(TypedDict): + r"""Detailed prompt token usage""" + cached_tokens: NotRequired[float] + r"""Cached prompt tokens""" cache_write_tokens: NotRequired[float] + r"""Tokens written to cache. Only returned for models with explicit caching and cache write pricing.""" audio_tokens: NotRequired[float] + r"""Audio input tokens""" video_tokens: NotRequired[float] + r"""Video input tokens""" class PromptTokensDetails(BaseModel): + r"""Detailed prompt token usage""" + cached_tokens: Optional[float] = None + r"""Cached prompt tokens""" cache_write_tokens: Optional[float] = None + r"""Tokens written to cache. Only returned for models with explicit caching and cache write pricing.""" audio_tokens: Optional[float] = None + r"""Audio input tokens""" video_tokens: Optional[float] = None + r"""Video input tokens""" class ChatGenerationTokenUsageTypedDict(TypedDict): + r"""Token usage statistics""" + completion_tokens: float + r"""Number of tokens in the completion""" prompt_tokens: float + r"""Number of tokens in the prompt""" total_tokens: float + r"""Total number of tokens""" completion_tokens_details: NotRequired[Nullable[CompletionTokensDetailsTypedDict]] + r"""Detailed completion token usage""" prompt_tokens_details: NotRequired[Nullable[PromptTokensDetailsTypedDict]] + r"""Detailed prompt token usage""" class ChatGenerationTokenUsage(BaseModel): + r"""Token usage statistics""" + completion_tokens: float + r"""Number of tokens in the completion""" prompt_tokens: float + r"""Number of tokens in the prompt""" total_tokens: float + r"""Total number of tokens""" completion_tokens_details: OptionalNullable[CompletionTokensDetails] = UNSET + r"""Detailed completion token usage""" prompt_tokens_details: OptionalNullable[PromptTokensDetails] = UNSET + r"""Detailed prompt token usage""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/chatmessagecontentitem.py b/src/openrouter/components/chatmessagecontentitem.py index eba0a3b..e650b7f 100644 --- a/src/openrouter/components/chatmessagecontentitem.py +++ b/src/openrouter/components/chatmessagecontentitem.py @@ -17,30 +17,52 @@ from .chatmessagecontentitemvideo import ( ChatMessageContentItemVideo, ChatMessageContentItemVideoTypedDict, ) +from .chatmessagecontentitemvideolegacy import ( + ChatMessageContentItemVideoLegacy, + ChatMessageContentItemVideoLegacyTypedDict, +) from openrouter.utils import get_discriminator from pydantic import Discriminator, Tag from typing import Union from typing_extensions import Annotated, TypeAliasType +ChatMessageContentItem1TypedDict = TypeAliasType( + "ChatMessageContentItem1TypedDict", + Union[ + ChatMessageContentItemVideoLegacyTypedDict, ChatMessageContentItemVideoTypedDict + ], +) + + +ChatMessageContentItem1 = Annotated[ + Union[ + Annotated[ChatMessageContentItemVideoLegacy, Tag("input_video")], + Annotated[ChatMessageContentItemVideo, Tag("video_url")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] + + ChatMessageContentItemTypedDict = TypeAliasType( "ChatMessageContentItemTypedDict", Union[ ChatMessageContentItemImageTypedDict, ChatMessageContentItemAudioTypedDict, ChatMessageContentItemTextTypedDict, - ChatMessageContentItemVideoTypedDict, + ChatMessageContentItem1TypedDict, ], ) +r"""Content part for chat completion messages""" -ChatMessageContentItem = Annotated[ +ChatMessageContentItem = TypeAliasType( + "ChatMessageContentItem", Union[ - Annotated[ChatMessageContentItemText, Tag("text")], - Annotated[ChatMessageContentItemImage, Tag("image_url")], - Annotated[ChatMessageContentItemAudio, Tag("input_audio")], - Annotated[ChatMessageContentItemVideo, Tag("input_video")], - Annotated[ChatMessageContentItemVideo, Tag("video_url")], + ChatMessageContentItemImage, + ChatMessageContentItemAudio, + ChatMessageContentItemText, + ChatMessageContentItem1, ], - Discriminator(lambda m: get_discriminator(m, "type", "type")), -] +) +r"""Content part for chat completion messages""" diff --git a/src/openrouter/components/chatmessagecontentitemaudio.py b/src/openrouter/components/chatmessagecontentitemaudio.py index b251803..5838eae 100644 --- a/src/openrouter/components/chatmessagecontentitemaudio.py +++ b/src/openrouter/components/chatmessagecontentitemaudio.py @@ -2,35 +2,39 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import validate_const import pydantic -from pydantic.functional_validators import AfterValidator from typing import Literal from typing_extensions import Annotated, TypedDict +ChatMessageContentItemAudioType = Literal["input_audio",] + + class ChatMessageContentItemAudioInputAudioTypedDict(TypedDict): data: str + r"""Base64 encoded audio data""" format_: str + r"""Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by provider.""" class ChatMessageContentItemAudioInputAudio(BaseModel): data: str + r"""Base64 encoded audio data""" format_: Annotated[str, pydantic.Field(alias="format")] + r"""Audio format (e.g., wav, mp3, flac, m4a, ogg, aiff, aac, pcm16, pcm24). Supported formats vary by provider.""" class ChatMessageContentItemAudioTypedDict(TypedDict): + r"""Audio input content part. Supported audio formats vary by provider.""" + + type: ChatMessageContentItemAudioType input_audio: ChatMessageContentItemAudioInputAudioTypedDict - type: Literal["input_audio"] class ChatMessageContentItemAudio(BaseModel): - input_audio: ChatMessageContentItemAudioInputAudio + r"""Audio input content part. Supported audio formats vary by provider.""" - TYPE: Annotated[ - Annotated[ - Literal["input_audio"], AfterValidator(validate_const("input_audio")) - ], - pydantic.Field(alias="type"), - ] = "input_audio" + type: ChatMessageContentItemAudioType + + input_audio: ChatMessageContentItemAudioInputAudio diff --git a/src/openrouter/components/chatmessagecontentitemcachecontrol.py b/src/openrouter/components/chatmessagecontentitemcachecontrol.py index b96625f..d8ed801 100644 --- a/src/openrouter/components/chatmessagecontentitemcachecontrol.py +++ b/src/openrouter/components/chatmessagecontentitemcachecontrol.py @@ -2,13 +2,15 @@ from __future__ import annotations from openrouter.types import BaseModel, UnrecognizedStr -from openrouter.utils import validate_const, validate_open_enum -import pydantic -from pydantic.functional_validators import AfterValidator, PlainValidator +from openrouter.utils import validate_open_enum +from pydantic.functional_validators import PlainValidator from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +ChatMessageContentItemCacheControlType = Literal["ephemeral",] + + TTL = Union[ Literal[ "5m", @@ -19,14 +21,15 @@ TTL = Union[ class ChatMessageContentItemCacheControlTypedDict(TypedDict): - type: Literal["ephemeral"] + r"""Cache control for the content part""" + + type: ChatMessageContentItemCacheControlType ttl: NotRequired[TTL] class ChatMessageContentItemCacheControl(BaseModel): - TYPE: Annotated[ - Annotated[Literal["ephemeral"], AfterValidator(validate_const("ephemeral"))], - pydantic.Field(alias="type"), - ] = "ephemeral" + r"""Cache control for the content part""" + + type: ChatMessageContentItemCacheControlType ttl: Annotated[Optional[TTL], PlainValidator(validate_open_enum(False))] = None diff --git a/src/openrouter/components/chatmessagecontentitemimage.py b/src/openrouter/components/chatmessagecontentitemimage.py index 8e5d5a4..e6e476b 100644 --- a/src/openrouter/components/chatmessagecontentitemimage.py +++ b/src/openrouter/components/chatmessagecontentitemimage.py @@ -2,13 +2,15 @@ from __future__ import annotations from openrouter.types import BaseModel, UnrecognizedStr -from openrouter.utils import validate_const, validate_open_enum -import pydantic -from pydantic.functional_validators import AfterValidator, PlainValidator +from openrouter.utils import validate_open_enum +from pydantic.functional_validators import PlainValidator from typing import Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypedDict +ChatMessageContentItemImageType = Literal["image_url",] + + ChatMessageContentItemImageDetail = Union[ Literal[ "auto", @@ -17,31 +19,37 @@ ChatMessageContentItemImageDetail = Union[ ], UnrecognizedStr, ] +r"""Image detail level for vision models""" class ChatMessageContentItemImageImageURLTypedDict(TypedDict): url: str + r"""URL of the image (data: URLs supported)""" detail: NotRequired[ChatMessageContentItemImageDetail] + r"""Image detail level for vision models""" class ChatMessageContentItemImageImageURL(BaseModel): url: str + r"""URL of the image (data: URLs supported)""" detail: Annotated[ Optional[ChatMessageContentItemImageDetail], PlainValidator(validate_open_enum(False)), ] = None + r"""Image detail level for vision models""" class ChatMessageContentItemImageTypedDict(TypedDict): + r"""Image content part for vision models""" + + type: ChatMessageContentItemImageType image_url: ChatMessageContentItemImageImageURLTypedDict - type: Literal["image_url"] class ChatMessageContentItemImage(BaseModel): - image_url: ChatMessageContentItemImageImageURL + r"""Image content part for vision models""" - TYPE: Annotated[ - Annotated[Literal["image_url"], AfterValidator(validate_const("image_url"))], - pydantic.Field(alias="type"), - ] = "image_url" + type: ChatMessageContentItemImageType + + image_url: ChatMessageContentItemImageImageURL diff --git a/src/openrouter/components/chatmessagecontentitemtext.py b/src/openrouter/components/chatmessagecontentitemtext.py index 4dc1662..4586c8e 100644 --- a/src/openrouter/components/chatmessagecontentitemtext.py +++ b/src/openrouter/components/chatmessagecontentitemtext.py @@ -6,25 +6,28 @@ from .chatmessagecontentitemcachecontrol import ( ChatMessageContentItemCacheControlTypedDict, ) from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + + +ChatMessageContentItemTextType = Literal["text",] class ChatMessageContentItemTextTypedDict(TypedDict): + r"""Text content part""" + + type: ChatMessageContentItemTextType text: str - type: Literal["text"] cache_control: NotRequired[ChatMessageContentItemCacheControlTypedDict] + r"""Cache control for the content part""" class ChatMessageContentItemText(BaseModel): + r"""Text content part""" + + type: ChatMessageContentItemTextType + text: str - TYPE: Annotated[ - Annotated[Literal["text"], AfterValidator(validate_const("text"))], - pydantic.Field(alias="type"), - ] = "text" - cache_control: Optional[ChatMessageContentItemCacheControl] = None + r"""Cache control for the content part""" diff --git a/src/openrouter/components/chatmessagecontentitemvideo.py b/src/openrouter/components/chatmessagecontentitemvideo.py index 06be297..2b2712e 100644 --- a/src/openrouter/components/chatmessagecontentitemvideo.py +++ b/src/openrouter/components/chatmessagecontentitemvideo.py @@ -1,74 +1,27 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .videoinput import VideoInput, VideoInputTypedDict from openrouter.types import BaseModel -from openrouter.utils import get_discriminator, validate_const -import pydantic -from pydantic import Discriminator, Tag -from pydantic.functional_validators import AfterValidator -from typing import Literal, Union -from typing_extensions import Annotated, TypeAliasType, TypedDict +from typing import Literal +from typing_extensions import TypedDict -class VideoURL2TypedDict(TypedDict): - url: str +ChatMessageContentItemVideoType = Literal["video_url",] -class VideoURL2(BaseModel): - url: str +class ChatMessageContentItemVideoTypedDict(TypedDict): + r"""Video input content part""" + + type: ChatMessageContentItemVideoType + video_url: VideoInputTypedDict + r"""Video input object""" -class ChatMessageContentItemVideoVideoURLTypedDict(TypedDict): - video_url: VideoURL2TypedDict - type: Literal["video_url"] +class ChatMessageContentItemVideo(BaseModel): + r"""Video input content part""" + type: ChatMessageContentItemVideoType -class ChatMessageContentItemVideoVideoURL(BaseModel): - video_url: VideoURL2 - - TYPE: Annotated[ - Annotated[Literal["video_url"], AfterValidator(validate_const("video_url"))], - pydantic.Field(alias="type"), - ] = "video_url" - - -class VideoURL1TypedDict(TypedDict): - url: str - - -class VideoURL1(BaseModel): - url: str - - -class ChatMessageContentItemVideoInputVideoTypedDict(TypedDict): - video_url: VideoURL1TypedDict - type: Literal["input_video"] - - -class ChatMessageContentItemVideoInputVideo(BaseModel): - video_url: VideoURL1 - - TYPE: Annotated[ - Annotated[ - Literal["input_video"], AfterValidator(validate_const("input_video")) - ], - pydantic.Field(alias="type"), - ] = "input_video" - - -ChatMessageContentItemVideoTypedDict = TypeAliasType( - "ChatMessageContentItemVideoTypedDict", - Union[ - ChatMessageContentItemVideoInputVideoTypedDict, - ChatMessageContentItemVideoVideoURLTypedDict, - ], -) - - -ChatMessageContentItemVideo = Annotated[ - Union[ - Annotated[ChatMessageContentItemVideoInputVideo, Tag("input_video")], - Annotated[ChatMessageContentItemVideoVideoURL, Tag("video_url")], - ], - Discriminator(lambda m: get_discriminator(m, "type", "type")), -] + video_url: VideoInput + r"""Video input object""" diff --git a/src/openrouter/components/chatmessagecontentitemvideolegacy.py b/src/openrouter/components/chatmessagecontentitemvideolegacy.py new file mode 100644 index 0000000..dc2d250 --- /dev/null +++ b/src/openrouter/components/chatmessagecontentitemvideolegacy.py @@ -0,0 +1,33 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .videoinput import VideoInput, VideoInputTypedDict +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict, deprecated + + +ChatMessageContentItemVideoLegacyType = Literal["input_video",] + + +@deprecated( + "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." +) +class ChatMessageContentItemVideoLegacyTypedDict(TypedDict): + r"""Video input content part (legacy format - deprecated)""" + + type: ChatMessageContentItemVideoLegacyType + video_url: VideoInputTypedDict + r"""Video input object""" + + +@deprecated( + "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." +) +class ChatMessageContentItemVideoLegacy(BaseModel): + r"""Video input content part (legacy format - deprecated)""" + + type: ChatMessageContentItemVideoLegacyType + + video_url: VideoInput + r"""Video input object""" diff --git a/src/openrouter/components/chatmessagetokenlogprob.py b/src/openrouter/components/chatmessagetokenlogprob.py index 2ac3a4a..34c12d5 100644 --- a/src/openrouter/components/chatmessagetokenlogprob.py +++ b/src/openrouter/components/chatmessagetokenlogprob.py @@ -53,20 +53,32 @@ class ChatMessageTokenLogprobTopLogprob(BaseModel): class ChatMessageTokenLogprobTypedDict(TypedDict): + r"""Token log probability information""" + token: str + r"""The token""" logprob: float + r"""Log probability of the token""" bytes_: Nullable[List[float]] + r"""UTF-8 bytes of the token""" top_logprobs: List[ChatMessageTokenLogprobTopLogprobTypedDict] + r"""Top alternative tokens with probabilities""" class ChatMessageTokenLogprob(BaseModel): + r"""Token log probability information""" + token: str + r"""The token""" logprob: float + r"""Log probability of the token""" bytes_: Annotated[Nullable[List[float]], pydantic.Field(alias="bytes")] + r"""UTF-8 bytes of the token""" top_logprobs: List[ChatMessageTokenLogprobTopLogprob] + r"""Top alternative tokens with probabilities""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/chatmessagetokenlogprobs.py b/src/openrouter/components/chatmessagetokenlogprobs.py index fa9e714..6af442a 100644 --- a/src/openrouter/components/chatmessagetokenlogprobs.py +++ b/src/openrouter/components/chatmessagetokenlogprobs.py @@ -12,14 +12,22 @@ from typing_extensions import TypedDict class ChatMessageTokenLogprobsTypedDict(TypedDict): + r"""Log probabilities for the completion""" + content: Nullable[List[ChatMessageTokenLogprobTypedDict]] + r"""Log probabilities for content tokens""" refusal: Nullable[List[ChatMessageTokenLogprobTypedDict]] + r"""Log probabilities for refusal tokens""" class ChatMessageTokenLogprobs(BaseModel): + r"""Log probabilities for the completion""" + content: Nullable[List[ChatMessageTokenLogprob]] + r"""Log probabilities for content tokens""" refusal: Nullable[List[ChatMessageTokenLogprob]] + r"""Log probabilities for refusal tokens""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/chatmessagetoolcall.py b/src/openrouter/components/chatmessagetoolcall.py index e8890e3..dcf5c8f 100644 --- a/src/openrouter/components/chatmessagetoolcall.py +++ b/src/openrouter/components/chatmessagetoolcall.py @@ -2,36 +2,43 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import Literal -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict + + +ChatMessageToolCallType = Literal["function",] class ChatMessageToolCallFunctionTypedDict(TypedDict): name: str + r"""Function name to call""" arguments: str + r"""Function arguments as JSON string""" class ChatMessageToolCallFunction(BaseModel): name: str + r"""Function name to call""" arguments: str + r"""Function arguments as JSON string""" class ChatMessageToolCallTypedDict(TypedDict): + r"""Tool call made by the assistant""" + id: str + r"""Tool call identifier""" + type: ChatMessageToolCallType function: ChatMessageToolCallFunctionTypedDict - type: Literal["function"] class ChatMessageToolCall(BaseModel): + r"""Tool call made by the assistant""" + id: str + r"""Tool call identifier""" + + type: ChatMessageToolCallType function: ChatMessageToolCallFunction - - TYPE: Annotated[ - Annotated[Literal["function"], AfterValidator(validate_const("function"))], - pydantic.Field(alias="type"), - ] = "function" diff --git a/src/openrouter/components/chatresponse.py b/src/openrouter/components/chatresponse.py index 1e993a1..4aa696f 100644 --- a/src/openrouter/components/chatresponse.py +++ b/src/openrouter/components/chatresponse.py @@ -13,44 +13,54 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import validate_const -import pydantic from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator from typing import List, Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + + +ChatResponseObject = Literal["chat.completion",] class ChatResponseTypedDict(TypedDict): + r"""Chat completion response""" + id: str + r"""Unique completion identifier""" choices: List[ChatResponseChoiceTypedDict] + r"""List of completion choices""" created: float + r"""Unix timestamp of creation""" model: str - object: Literal["chat.completion"] + r"""Model used for completion""" + object: ChatResponseObject system_fingerprint: NotRequired[Nullable[str]] + r"""System fingerprint""" usage: NotRequired[ChatGenerationTokenUsageTypedDict] + r"""Token usage statistics""" class ChatResponse(BaseModel): + r"""Chat completion response""" + id: str + r"""Unique completion identifier""" choices: List[ChatResponseChoice] + r"""List of completion choices""" created: float + r"""Unix timestamp of creation""" model: str + r"""Model used for completion""" - OBJECT: Annotated[ - Annotated[ - Literal["chat.completion"], - AfterValidator(validate_const("chat.completion")), - ], - pydantic.Field(alias="object"), - ] = "chat.completion" + object: ChatResponseObject system_fingerprint: OptionalNullable[str] = UNSET + r"""System fingerprint""" usage: Optional[ChatGenerationTokenUsage] = None + r"""Token usage statistics""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/chatresponsechoice.py b/src/openrouter/components/chatresponsechoice.py index 9592bf1..df2c37e 100644 --- a/src/openrouter/components/chatresponsechoice.py +++ b/src/openrouter/components/chatresponsechoice.py @@ -2,7 +2,6 @@ from __future__ import annotations from .assistantmessage import AssistantMessage, AssistantMessageTypedDict -from .chatcompletionfinishreason import ChatCompletionFinishReason from .chatmessagetokenlogprobs import ( ChatMessageTokenLogprobs, ChatMessageTokenLogprobsTypedDict, @@ -14,29 +13,36 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import validate_open_enum from pydantic import model_serializer -from pydantic.functional_validators import PlainValidator -from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Any +from typing_extensions import NotRequired, TypedDict class ChatResponseChoiceTypedDict(TypedDict): - finish_reason: Nullable[ChatCompletionFinishReason] + r"""Chat completion choice""" + + finish_reason: Nullable[Any] index: float + r"""Choice index""" message: AssistantMessageTypedDict + r"""Assistant message for requests and responses""" logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]] + r"""Log probabilities for the completion""" class ChatResponseChoice(BaseModel): - finish_reason: Annotated[ - Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False)) - ] + r"""Chat completion choice""" + + finish_reason: Nullable[Any] index: float + r"""Choice index""" message: AssistantMessage + r"""Assistant message for requests and responses""" logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET + r"""Log probabilities for the completion""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/chatstreamingchoice.py b/src/openrouter/components/chatstreamingchoice.py index b64b8ff..4eb5dc6 100644 --- a/src/openrouter/components/chatstreamingchoice.py +++ b/src/openrouter/components/chatstreamingchoice.py @@ -1,7 +1,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .chatcompletionfinishreason import ChatCompletionFinishReason from .chatmessagetokenlogprobs import ( ChatMessageTokenLogprobs, ChatMessageTokenLogprobsTypedDict, @@ -17,29 +16,36 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import validate_open_enum from pydantic import model_serializer -from pydantic.functional_validators import PlainValidator -from typing_extensions import Annotated, NotRequired, TypedDict +from typing import Any +from typing_extensions import NotRequired, TypedDict class ChatStreamingChoiceTypedDict(TypedDict): + r"""Streaming completion choice chunk""" + delta: ChatStreamingMessageChunkTypedDict - finish_reason: Nullable[ChatCompletionFinishReason] + r"""Delta changes in streaming response""" + finish_reason: Nullable[Any] index: float + r"""Choice index""" logprobs: NotRequired[Nullable[ChatMessageTokenLogprobsTypedDict]] + r"""Log probabilities for the completion""" class ChatStreamingChoice(BaseModel): - delta: ChatStreamingMessageChunk + r"""Streaming completion choice chunk""" - finish_reason: Annotated[ - Nullable[ChatCompletionFinishReason], PlainValidator(validate_open_enum(False)) - ] + delta: ChatStreamingMessageChunk + r"""Delta changes in streaming response""" + + finish_reason: Nullable[Any] index: float + r"""Choice index""" logprobs: OptionalNullable[ChatMessageTokenLogprobs] = UNSET + r"""Log probabilities for the completion""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/chatstreamingmessagechunk.py b/src/openrouter/components/chatstreamingmessagechunk.py index 3dad989..fb1d23e 100644 --- a/src/openrouter/components/chatstreamingmessagechunk.py +++ b/src/openrouter/components/chatstreamingmessagechunk.py @@ -1,11 +1,11 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from ._schema19 import Schema19, Schema19TypedDict from .chatstreamingmessagetoolcall import ( ChatStreamingMessageToolCall, ChatStreamingMessageToolCallTypedDict, ) +from .reasoningdetailunion import ReasoningDetailUnion, ReasoningDetailUnionTypedDict from openrouter.types import ( BaseModel, Nullable, @@ -19,29 +19,46 @@ from typing_extensions import NotRequired, TypedDict ChatStreamingMessageChunkRole = Literal["assistant",] +r"""The role of the message author""" class ChatStreamingMessageChunkTypedDict(TypedDict): + r"""Delta changes in streaming response""" + role: NotRequired[ChatStreamingMessageChunkRole] + r"""The role of the message author""" content: NotRequired[Nullable[str]] + r"""Message content delta""" reasoning: NotRequired[Nullable[str]] + r"""Reasoning content delta""" refusal: NotRequired[Nullable[str]] + r"""Refusal message delta""" tool_calls: NotRequired[List[ChatStreamingMessageToolCallTypedDict]] - reasoning_details: NotRequired[List[Schema19TypedDict]] + r"""Tool calls delta""" + reasoning_details: NotRequired[List[ReasoningDetailUnionTypedDict]] + r"""Reasoning details for extended thinking models""" class ChatStreamingMessageChunk(BaseModel): + r"""Delta changes in streaming response""" + role: Optional[ChatStreamingMessageChunkRole] = None + r"""The role of the message author""" content: OptionalNullable[str] = UNSET + r"""Message content delta""" reasoning: OptionalNullable[str] = UNSET + r"""Reasoning content delta""" refusal: OptionalNullable[str] = UNSET + r"""Refusal message delta""" tool_calls: Optional[List[ChatStreamingMessageToolCall]] = None + r"""Tool calls delta""" - reasoning_details: Optional[List[Schema19]] = None + reasoning_details: Optional[List[ReasoningDetailUnion]] = None + r"""Reasoning details for extended thinking models""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/chatstreamingmessagetoolcall.py b/src/openrouter/components/chatstreamingmessagetoolcall.py index 6cab64d..9639eab 100644 --- a/src/openrouter/components/chatstreamingmessagetoolcall.py +++ b/src/openrouter/components/chatstreamingmessagetoolcall.py @@ -2,41 +2,57 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + + +ChatStreamingMessageToolCallType = Literal["function",] +r"""Tool call type""" class ChatStreamingMessageToolCallFunctionTypedDict(TypedDict): + r"""Function call details""" + name: NotRequired[str] + r"""Function name""" arguments: NotRequired[str] + r"""Function arguments as JSON string""" class ChatStreamingMessageToolCallFunction(BaseModel): + r"""Function call details""" + name: Optional[str] = None + r"""Function name""" arguments: Optional[str] = None + r"""Function arguments as JSON string""" class ChatStreamingMessageToolCallTypedDict(TypedDict): + r"""Tool call delta for streaming responses""" + index: float + r"""Tool call index in the array""" id: NotRequired[str] - type: Literal["function"] + r"""Tool call identifier""" + type: NotRequired[ChatStreamingMessageToolCallType] + r"""Tool call type""" function: NotRequired[ChatStreamingMessageToolCallFunctionTypedDict] + r"""Function call details""" class ChatStreamingMessageToolCall(BaseModel): + r"""Tool call delta for streaming responses""" + index: float + r"""Tool call index in the array""" id: Optional[str] = None + r"""Tool call identifier""" - TYPE: Annotated[ - Annotated[ - Optional[Literal["function"]], AfterValidator(validate_const("function")) - ], - pydantic.Field(alias="type"), - ] = "function" + type: Optional[ChatStreamingMessageToolCallType] = None + r"""Tool call type""" function: Optional[ChatStreamingMessageToolCallFunction] = None + r"""Function call details""" diff --git a/src/openrouter/components/chatstreamingresponsechunk.py b/src/openrouter/components/chatstreamingresponsechunk.py index 7c32481..d2a1fe0 100644 --- a/src/openrouter/components/chatstreamingresponsechunk.py +++ b/src/openrouter/components/chatstreamingresponsechunk.py @@ -13,58 +13,78 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import validate_const -import pydantic from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator from typing import List, Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict -class ChatStreamingResponseChunkErrorTypedDict(TypedDict): +ChatStreamingResponseChunkObject = Literal["chat.completion.chunk",] + + +class ErrorTypedDict(TypedDict): + r"""Error information""" + message: str + r"""Error message""" code: float + r"""Error code""" -class ChatStreamingResponseChunkError(BaseModel): +class Error(BaseModel): + r"""Error information""" + message: str + r"""Error message""" code: float + r"""Error code""" -class ChatStreamingResponseChunkDataTypedDict(TypedDict): +class ChatStreamingResponseChunkTypedDict(TypedDict): + r"""Streaming chat completion chunk""" + id: str + r"""Unique chunk identifier""" choices: List[ChatStreamingChoiceTypedDict] + r"""List of streaming chunk choices""" created: float + r"""Unix timestamp of creation""" model: str - object: Literal["chat.completion.chunk"] + r"""Model used for completion""" + object: ChatStreamingResponseChunkObject system_fingerprint: NotRequired[Nullable[str]] - error: NotRequired[ChatStreamingResponseChunkErrorTypedDict] + r"""System fingerprint""" + error: NotRequired[ErrorTypedDict] + r"""Error information""" usage: NotRequired[ChatGenerationTokenUsageTypedDict] + r"""Token usage statistics""" -class ChatStreamingResponseChunkData(BaseModel): +class ChatStreamingResponseChunk(BaseModel): + r"""Streaming chat completion chunk""" + id: str + r"""Unique chunk identifier""" choices: List[ChatStreamingChoice] + r"""List of streaming chunk choices""" created: float + r"""Unix timestamp of creation""" model: str + r"""Model used for completion""" - OBJECT: Annotated[ - Annotated[ - Literal["chat.completion.chunk"], - AfterValidator(validate_const("chat.completion.chunk")), - ], - pydantic.Field(alias="object"), - ] = "chat.completion.chunk" + object: ChatStreamingResponseChunkObject system_fingerprint: OptionalNullable[str] = UNSET + r"""System fingerprint""" - error: Optional[ChatStreamingResponseChunkError] = None + error: Optional[Error] = None + r"""Error information""" usage: Optional[ChatGenerationTokenUsage] = None + r"""Token usage statistics""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -95,11 +115,3 @@ class ChatStreamingResponseChunkData(BaseModel): m[k] = val return m - - -class ChatStreamingResponseChunkTypedDict(TypedDict): - data: ChatStreamingResponseChunkDataTypedDict - - -class ChatStreamingResponseChunk(BaseModel): - data: ChatStreamingResponseChunkData diff --git a/src/openrouter/components/chatstreamoptions.py b/src/openrouter/components/chatstreamoptions.py index 6e4d94d..48eb279 100644 --- a/src/openrouter/components/chatstreamoptions.py +++ b/src/openrouter/components/chatstreamoptions.py @@ -2,13 +2,25 @@ from __future__ import annotations from openrouter.types import BaseModel +import pydantic from typing import Optional -from typing_extensions import NotRequired, TypedDict +from typing_extensions import Annotated, NotRequired, TypedDict class ChatStreamOptionsTypedDict(TypedDict): + r"""Streaming configuration options""" + include_usage: NotRequired[bool] + r"""Deprecated: This field has no effect. Full usage details are always included.""" class ChatStreamOptions(BaseModel): - include_usage: Optional[bool] = None + r"""Streaming configuration options""" + + include_usage: Annotated[ + Optional[bool], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = None + r"""Deprecated: This field has no effect. Full usage details are always included.""" diff --git a/src/openrouter/components/debugoptions.py b/src/openrouter/components/debugoptions.py new file mode 100644 index 0000000..a2a990e --- /dev/null +++ b/src/openrouter/components/debugoptions.py @@ -0,0 +1,20 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class DebugOptionsTypedDict(TypedDict): + r"""Debug options for inspecting request transformations (streaming only)""" + + echo_upstream_body: NotRequired[bool] + r"""If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode.""" + + +class DebugOptions(BaseModel): + r"""Debug options for inspecting request transformations (streaming only)""" + + echo_upstream_body: Optional[bool] = None + r"""If true, includes the transformed upstream request body in a debug chunk at the start of the stream. Only works with streaming mode.""" diff --git a/src/openrouter/components/developermessage.py b/src/openrouter/components/developermessage.py index b3042b0..b179df4 100644 --- a/src/openrouter/components/developermessage.py +++ b/src/openrouter/components/developermessage.py @@ -6,36 +6,43 @@ from .chatmessagecontentitemtext import ( ChatMessageContentItemTextTypedDict, ) from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +DeveloperMessageRole = Literal["developer",] DeveloperMessageContentTypedDict = TypeAliasType( "DeveloperMessageContentTypedDict", Union[str, List[ChatMessageContentItemTextTypedDict]], ) +r"""Developer message content""" DeveloperMessageContent = TypeAliasType( "DeveloperMessageContent", Union[str, List[ChatMessageContentItemText]] ) +r"""Developer message content""" class DeveloperMessageTypedDict(TypedDict): + r"""Developer message""" + + role: DeveloperMessageRole content: DeveloperMessageContentTypedDict - role: Literal["developer"] + r"""Developer message content""" name: NotRequired[str] + r"""Optional name for the developer message""" class DeveloperMessage(BaseModel): - content: DeveloperMessageContent + r"""Developer message""" - ROLE: Annotated[ - Annotated[Literal["developer"], AfterValidator(validate_const("developer"))], - pydantic.Field(alias="role"), - ] = "developer" + role: DeveloperMessageRole + + content: DeveloperMessageContent + r"""Developer message content""" name: Optional[str] = None + r"""Optional name for the developer message""" diff --git a/src/openrouter/components/jsonschemaconfig.py b/src/openrouter/components/jsonschemaconfig.py index 44ae090..a5daa6d 100644 --- a/src/openrouter/components/jsonschemaconfig.py +++ b/src/openrouter/components/jsonschemaconfig.py @@ -15,20 +15,34 @@ from typing_extensions import Annotated, NotRequired, TypedDict class JSONSchemaConfigTypedDict(TypedDict): + r"""JSON Schema configuration object""" + name: str + r"""Schema name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)""" description: NotRequired[str] - schema_: NotRequired[Dict[str, Any]] + r"""Schema description for the model""" + schema_: NotRequired[Dict[str, Nullable[Any]]] + r"""JSON Schema object""" strict: NotRequired[Nullable[bool]] + r"""Enable strict schema adherence""" class JSONSchemaConfig(BaseModel): + r"""JSON Schema configuration object""" + 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[Dict[str, Any]], pydantic.Field(alias="schema")] = None + schema_: Annotated[ + Optional[Dict[str, Nullable[Any]]], pydantic.Field(alias="schema") + ] = None + r"""JSON Schema object""" strict: OptionalNullable[bool] = UNSET + r"""Enable strict schema adherence""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/message.py b/src/openrouter/components/message.py index 569d0e0..3aa2cf8 100644 --- a/src/openrouter/components/message.py +++ b/src/openrouter/components/message.py @@ -22,6 +22,7 @@ MessageTypedDict = TypeAliasType( AssistantMessageTypedDict, ], ) +r"""Chat completion message with role-based discrimination""" Message = Annotated[ @@ -34,3 +35,4 @@ Message = Annotated[ ], Discriminator(lambda m: get_discriminator(m, "role", "role")), ] +r"""Chat completion message with role-based discrimination""" diff --git a/src/openrouter/components/modelscountresponse.py b/src/openrouter/components/modelscountresponse.py index 698420e..e80d513 100644 --- a/src/openrouter/components/modelscountresponse.py +++ b/src/openrouter/components/modelscountresponse.py @@ -5,14 +5,14 @@ from openrouter.types import BaseModel from typing_extensions import TypedDict -class ModelsCountResponseDataTypedDict(TypedDict): +class DataTypedDict(TypedDict): r"""Model count data""" count: float r"""Total number of available models""" -class ModelsCountResponseData(BaseModel): +class Data(BaseModel): r"""Model count data""" count: float @@ -22,12 +22,12 @@ class ModelsCountResponseData(BaseModel): class ModelsCountResponseTypedDict(TypedDict): r"""Model count data""" - data: ModelsCountResponseDataTypedDict + data: DataTypedDict r"""Model count data""" class ModelsCountResponse(BaseModel): r"""Model count data""" - data: ModelsCountResponseData + data: Data r"""Model count data""" diff --git a/src/openrouter/components/namedtoolchoice.py b/src/openrouter/components/namedtoolchoice.py index ac7d345..fda1275 100644 --- a/src/openrouter/components/namedtoolchoice.py +++ b/src/openrouter/components/namedtoolchoice.py @@ -2,30 +2,33 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import Literal -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict + + +NamedToolChoiceType = Literal["function",] class NamedToolChoiceFunctionTypedDict(TypedDict): name: str + r"""Function name to call""" class NamedToolChoiceFunction(BaseModel): name: str + r"""Function name to call""" class NamedToolChoiceTypedDict(TypedDict): + r"""Named tool choice for specific function""" + + type: NamedToolChoiceType function: NamedToolChoiceFunctionTypedDict - type: Literal["function"] class NamedToolChoice(BaseModel): - function: NamedToolChoiceFunction + r"""Named tool choice for specific function""" - TYPE: Annotated[ - Annotated[Literal["function"], AfterValidator(validate_const("function"))], - pydantic.Field(alias="type"), - ] = "function" + type: NamedToolChoiceType + + function: NamedToolChoiceFunction diff --git a/src/openrouter/components/openairesponsesreasoningconfig.py b/src/openrouter/components/openairesponsesreasoningconfig.py index 5c4d6da..77f39da 100644 --- a/src/openrouter/components/openairesponsesreasoningconfig.py +++ b/src/openrouter/components/openairesponsesreasoningconfig.py @@ -13,13 +13,12 @@ from openrouter.types import ( from openrouter.utils import validate_open_enum from pydantic import model_serializer from pydantic.functional_validators import PlainValidator -from typing import Optional from typing_extensions import Annotated, NotRequired, TypedDict class OpenAIResponsesReasoningConfigTypedDict(TypedDict): effort: NotRequired[Nullable[OpenAIResponsesReasoningEffort]] - summary: NotRequired[ReasoningSummaryVerbosity] + summary: NotRequired[Nullable[ReasoningSummaryVerbosity]] class OpenAIResponsesReasoningConfig(BaseModel): @@ -29,13 +28,14 @@ class OpenAIResponsesReasoningConfig(BaseModel): ] = UNSET summary: Annotated[ - Optional[ReasoningSummaryVerbosity], PlainValidator(validate_open_enum(False)) - ] = None + OptionalNullable[ReasoningSummaryVerbosity], + PlainValidator(validate_open_enum(False)), + ] = UNSET @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = ["effort", "summary"] - nullable_fields = ["effort"] + nullable_fields = ["effort", "summary"] null_default_fields = [] serialized = handler(self) diff --git a/src/openrouter/components/openresponsesnonstreamingresponse.py b/src/openrouter/components/openresponsesnonstreamingresponse.py index bb3b2c0..5bacc19 100644 --- a/src/openrouter/components/openresponsesnonstreamingresponse.py +++ b/src/openrouter/components/openresponsesnonstreamingresponse.py @@ -55,7 +55,7 @@ from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict -Object = Literal["response",] +OpenResponsesNonStreamingResponseObject = Literal["response",] OpenResponsesNonStreamingResponseType = Literal["function",] @@ -146,7 +146,7 @@ class OpenResponsesNonStreamingResponseTypedDict(TypedDict): r"""Complete non-streaming response from the Responses API""" id: str - object: Object + object: OpenResponsesNonStreamingResponseObject created_at: float model: str status: OpenAIResponsesResponseStatus @@ -190,7 +190,7 @@ class OpenResponsesNonStreamingResponse(BaseModel): id: str - object: Object + object: OpenResponsesNonStreamingResponseObject created_at: float diff --git a/src/openrouter/components/openresponsesreasoning.py b/src/openrouter/components/openresponsesreasoning.py index af1dda6..eea81d6 100644 --- a/src/openrouter/components/openresponsesreasoning.py +++ b/src/openrouter/components/openresponsesreasoning.py @@ -70,7 +70,7 @@ class OpenResponsesReasoningTypedDict(TypedDict): type: OpenResponsesReasoningType id: str summary: List[ReasoningSummaryTextTypedDict] - content: NotRequired[List[ReasoningTextContentTypedDict]] + content: NotRequired[Nullable[List[ReasoningTextContentTypedDict]]] encrypted_content: NotRequired[Nullable[str]] status: NotRequired[OpenResponsesReasoningStatusUnionTypedDict] signature: NotRequired[Nullable[str]] @@ -86,7 +86,7 @@ class OpenResponsesReasoning(BaseModel): summary: List[ReasoningSummaryText] - content: Optional[List[ReasoningTextContent]] = None + content: OptionalNullable[List[ReasoningTextContent]] = UNSET encrypted_content: OptionalNullable[str] = UNSET @@ -111,7 +111,7 @@ class OpenResponsesReasoning(BaseModel): "signature", "format", ] - nullable_fields = ["encrypted_content", "signature", "format"] + nullable_fields = ["content", "encrypted_content", "signature", "format"] null_default_fields = [] serialized = handler(self) diff --git a/src/openrouter/components/openresponsesreasoningconfig.py b/src/openrouter/components/openresponsesreasoningconfig.py index f909558..0d6e861 100644 --- a/src/openrouter/components/openresponsesreasoningconfig.py +++ b/src/openrouter/components/openresponsesreasoningconfig.py @@ -13,7 +13,6 @@ from openrouter.types import ( from openrouter.utils import validate_open_enum from pydantic import model_serializer from pydantic.functional_validators import PlainValidator -from typing import Optional from typing_extensions import Annotated, NotRequired, TypedDict @@ -21,7 +20,7 @@ class OpenResponsesReasoningConfigTypedDict(TypedDict): r"""Configuration for reasoning mode in the response""" effort: NotRequired[Nullable[OpenAIResponsesReasoningEffort]] - summary: NotRequired[ReasoningSummaryVerbosity] + summary: NotRequired[Nullable[ReasoningSummaryVerbosity]] max_tokens: NotRequired[Nullable[float]] enabled: NotRequired[Nullable[bool]] @@ -35,8 +34,9 @@ class OpenResponsesReasoningConfig(BaseModel): ] = UNSET summary: Annotated[ - Optional[ReasoningSummaryVerbosity], PlainValidator(validate_open_enum(False)) - ] = None + OptionalNullable[ReasoningSummaryVerbosity], + PlainValidator(validate_open_enum(False)), + ] = UNSET max_tokens: OptionalNullable[float] = UNSET @@ -45,7 +45,7 @@ class OpenResponsesReasoningConfig(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = ["effort", "summary", "max_tokens", "enabled"] - nullable_fields = ["effort", "max_tokens", "enabled"] + nullable_fields = ["effort", "summary", "max_tokens", "enabled"] null_default_fields = [] serialized = handler(self) diff --git a/src/openrouter/components/openresponsesrequest.py b/src/openrouter/components/openresponsesrequest.py index 8d0071c..35e6daf 100644 --- a/src/openrouter/components/openresponsesrequest.py +++ b/src/openrouter/components/openresponsesrequest.py @@ -55,7 +55,7 @@ from openrouter.types import ( ) from openrouter.utils import get_discriminator, validate_const, validate_open_enum import pydantic -from pydantic import Discriminator, Tag, model_serializer +from pydantic import ConfigDict, Discriminator, Tag, model_serializer from pydantic.functional_validators import AfterValidator, PlainValidator from typing import Any, Dict, List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -244,7 +244,7 @@ class OpenResponsesRequestMaxPrice(BaseModel): request: Optional[str] = None -class ProviderTypedDict(TypedDict): +class OpenResponsesRequestProviderTypedDict(TypedDict): r"""When multiple model providers are available, optionally indicate your routing preference.""" allow_fallbacks: NotRequired[Nullable[bool]] @@ -283,7 +283,7 @@ class ProviderTypedDict(TypedDict): r"""Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.""" -class Provider(BaseModel): +class OpenResponsesRequestProvider(BaseModel): r"""When multiple model providers are available, optionally indicate your routing preference.""" allow_fallbacks: OptionalNullable[bool] = UNSET @@ -395,35 +395,35 @@ class Provider(BaseModel): return m -IDResponseHealing = Literal["response-healing",] +OpenResponsesRequestIDResponseHealing = Literal["response-healing",] -class PluginResponseHealingTypedDict(TypedDict): - id: IDResponseHealing +class OpenResponsesRequestPluginResponseHealingTypedDict(TypedDict): + id: OpenResponsesRequestIDResponseHealing enabled: NotRequired[bool] r"""Set to false to disable the response-healing plugin for this request. Defaults to true.""" -class PluginResponseHealing(BaseModel): - id: IDResponseHealing +class OpenResponsesRequestPluginResponseHealing(BaseModel): + id: OpenResponsesRequestIDResponseHealing enabled: Optional[bool] = None r"""Set to false to disable the response-healing plugin for this request. Defaults to true.""" -IDFileParser = Literal["file-parser",] +OpenResponsesRequestIDFileParser = Literal["file-parser",] -class PluginFileParserTypedDict(TypedDict): - id: IDFileParser +class OpenResponsesRequestPluginFileParserTypedDict(TypedDict): + id: OpenResponsesRequestIDFileParser enabled: NotRequired[bool] r"""Set to false to disable the file-parser plugin for this request. Defaults to true.""" pdf: NotRequired[PDFParserOptionsTypedDict] r"""Options for PDF parsing.""" -class PluginFileParser(BaseModel): - id: IDFileParser +class OpenResponsesRequestPluginFileParser(BaseModel): + id: OpenResponsesRequestIDFileParser enabled: Optional[bool] = None r"""Set to false to disable the file-parser plugin for this request. Defaults to true.""" @@ -432,11 +432,11 @@ class PluginFileParser(BaseModel): r"""Options for PDF parsing.""" -IDWeb = Literal["web",] +OpenResponsesRequestIDWeb = Literal["web",] -class PluginWebTypedDict(TypedDict): - id: IDWeb +class OpenResponsesRequestPluginWebTypedDict(TypedDict): + id: OpenResponsesRequestIDWeb enabled: NotRequired[bool] r"""Set to false to disable the web-search plugin for this request. Defaults to true.""" max_results: NotRequired[float] @@ -445,8 +445,8 @@ class PluginWebTypedDict(TypedDict): r"""The search engine to use for web search.""" -class PluginWeb(BaseModel): - id: IDWeb +class OpenResponsesRequestPluginWeb(BaseModel): + id: OpenResponsesRequestIDWeb enabled: Optional[bool] = None r"""Set to false to disable the web-search plugin for this request. Defaults to true.""" @@ -461,30 +461,30 @@ class PluginWeb(BaseModel): r"""The search engine to use for web search.""" -IDModeration = Literal["moderation",] +OpenResponsesRequestIDModeration = Literal["moderation",] -class PluginModerationTypedDict(TypedDict): - id: IDModeration +class OpenResponsesRequestPluginModerationTypedDict(TypedDict): + id: OpenResponsesRequestIDModeration -class PluginModeration(BaseModel): - id: IDModeration +class OpenResponsesRequestPluginModeration(BaseModel): + id: OpenResponsesRequestIDModeration -IDAutoRouter = Literal["auto-router",] +OpenResponsesRequestIDAutoRouter = Literal["auto-router",] -class PluginAutoRouterTypedDict(TypedDict): - id: IDAutoRouter +class OpenResponsesRequestPluginAutoRouterTypedDict(TypedDict): + id: OpenResponsesRequestIDAutoRouter enabled: NotRequired[bool] r"""Set to false to disable the auto-router plugin for this request. Defaults to true.""" allowed_models: NotRequired[List[str]] r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" -class PluginAutoRouter(BaseModel): - id: IDAutoRouter +class OpenResponsesRequestPluginAutoRouter(BaseModel): + id: OpenResponsesRequestIDAutoRouter enabled: Optional[bool] = None r"""Set to false to disable the auto-router plugin for this request. Defaults to true.""" @@ -493,30 +493,67 @@ class PluginAutoRouter(BaseModel): r"""List of model patterns to filter which models the auto-router can route between. Supports wildcards (e.g., \"anthropic/*\" matches all Anthropic models). When not specified, uses the default supported models list.""" -PluginTypedDict = TypeAliasType( - "PluginTypedDict", +OpenResponsesRequestPluginUnionTypedDict = TypeAliasType( + "OpenResponsesRequestPluginUnionTypedDict", Union[ - PluginModerationTypedDict, - PluginResponseHealingTypedDict, - PluginAutoRouterTypedDict, - PluginFileParserTypedDict, - PluginWebTypedDict, + OpenResponsesRequestPluginModerationTypedDict, + OpenResponsesRequestPluginResponseHealingTypedDict, + OpenResponsesRequestPluginAutoRouterTypedDict, + OpenResponsesRequestPluginFileParserTypedDict, + OpenResponsesRequestPluginWebTypedDict, ], ) -Plugin = Annotated[ +OpenResponsesRequestPluginUnion = Annotated[ Union[ - Annotated[PluginAutoRouter, Tag("auto-router")], - Annotated[PluginModeration, Tag("moderation")], - Annotated[PluginWeb, Tag("web")], - Annotated[PluginFileParser, Tag("file-parser")], - Annotated[PluginResponseHealing, Tag("response-healing")], + Annotated[OpenResponsesRequestPluginAutoRouter, Tag("auto-router")], + Annotated[OpenResponsesRequestPluginModeration, Tag("moderation")], + Annotated[OpenResponsesRequestPluginWeb, Tag("web")], + Annotated[OpenResponsesRequestPluginFileParser, Tag("file-parser")], + Annotated[OpenResponsesRequestPluginResponseHealing, Tag("response-healing")], ], Discriminator(lambda m: get_discriminator(m, "id", "id")), ] +class OpenResponsesRequestTraceTypedDict(TypedDict): + r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" + + trace_id: NotRequired[str] + trace_name: NotRequired[str] + span_name: NotRequired[str] + generation_name: NotRequired[str] + parent_span_id: NotRequired[str] + + +class OpenResponsesRequestTrace(BaseModel): + r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" + + model_config = ConfigDict( + populate_by_name=True, arbitrary_types_allowed=True, extra="allow" + ) + __pydantic_extra__: Dict[str, Nullable[Any]] = pydantic.Field(init=False) + + trace_id: Optional[str] = None + + trace_name: Optional[str] = None + + span_name: Optional[str] = None + + generation_name: Optional[str] = None + + parent_span_id: Optional[str] = None + + @property + def additional_properties(self): + return self.__pydantic_extra__ + + @additional_properties.setter + def additional_properties(self, value): + self.__pydantic_extra__ = value # pyright: ignore[reportIncompatibleVariableOverride] + + class OpenResponsesRequestTypedDict(TypedDict): r"""Request schema for Responses endpoint""" @@ -556,14 +593,16 @@ class OpenResponsesRequestTypedDict(TypedDict): service_tier: NotRequired[ServiceTier] truncation: NotRequired[Nullable[Truncation]] stream: NotRequired[bool] - provider: NotRequired[Nullable[ProviderTypedDict]] + provider: NotRequired[Nullable[OpenResponsesRequestProviderTypedDict]] r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: NotRequired[List[PluginTypedDict]] + plugins: NotRequired[List[OpenResponsesRequestPluginUnionTypedDict]] r"""Plugins you want to enable for this request, including their settings.""" user: NotRequired[str] r"""A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters.""" session_id: NotRequired[str] r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.""" + trace: NotRequired[OpenResponsesRequestTraceTypedDict] + r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" class OpenResponsesRequest(BaseModel): @@ -652,10 +691,10 @@ class OpenResponsesRequest(BaseModel): stream: Optional[bool] = False - provider: OptionalNullable[Provider] = UNSET + provider: OptionalNullable[OpenResponsesRequestProvider] = UNSET r"""When multiple model providers are available, optionally indicate your routing preference.""" - plugins: Optional[List[Plugin]] = None + plugins: Optional[List[OpenResponsesRequestPluginUnion]] = None r"""Plugins you want to enable for this request, including their settings.""" user: Optional[str] = None @@ -664,6 +703,9 @@ class OpenResponsesRequest(BaseModel): session_id: Optional[str] = None r"""A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters.""" + trace: Optional[OpenResponsesRequestTrace] = None + r"""Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ @@ -701,6 +743,7 @@ class OpenResponsesRequest(BaseModel): "plugins", "user", "session_id", + "trace", ] nullable_fields = [ "instructions", diff --git a/src/openrouter/components/providername.py b/src/openrouter/components/providername.py index 29c27a6..67f95e7 100644 --- a/src/openrouter/components/providername.py +++ b/src/openrouter/components/providername.py @@ -41,7 +41,9 @@ ProviderName = Union[ "Inception", "Inceptron", "InferenceNet", + "Ionstream", "Infermatic", + "Io Net", "Inflection", "Liquid", "Mara", diff --git a/src/openrouter/components/providerpreferences.py b/src/openrouter/components/providerpreferences.py index d3ad2c7..8cb76ac 100644 --- a/src/openrouter/components/providerpreferences.py +++ b/src/openrouter/components/providerpreferences.py @@ -8,7 +8,6 @@ from .preferredminthroughput import ( PreferredMinThroughputTypedDict, ) from .providername import ProviderName -from .providersort import ProviderSort from .quantization import Quantization from openrouter.types import ( BaseModel, @@ -58,7 +57,7 @@ ProviderPreferencesIgnore = TypeAliasType( ) -SortEnum = Union[ +ProviderPreferencesSortEnum = Union[ Literal[ "price", "throughput", @@ -68,13 +67,24 @@ SortEnum = Union[ ] -ProviderSortConfigEnum = Literal[ +ProviderPreferencesProviderSortConfigEnum = Literal[ "price", "throughput", "latency", ] +ProviderPreferencesBy = Union[ + Literal[ + "price", + "throughput", + "latency", + ], + UnrecognizedStr, +] +r"""The provider sorting strategy (price, throughput, latency)""" + + ProviderPreferencesPartition = Union[ Literal[ "model", @@ -82,22 +92,28 @@ ProviderPreferencesPartition = Union[ ], UnrecognizedStr, ] +r"""Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model.""" class ProviderPreferencesProviderSortConfigTypedDict(TypedDict): - by: NotRequired[Nullable[ProviderSort]] + by: NotRequired[Nullable[ProviderPreferencesBy]] + r"""The provider sorting strategy (price, throughput, latency)""" partition: NotRequired[Nullable[ProviderPreferencesPartition]] + r"""Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model.""" class ProviderPreferencesProviderSortConfig(BaseModel): by: Annotated[ - OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False)) + OptionalNullable[ProviderPreferencesBy], + PlainValidator(validate_open_enum(False)), ] = UNSET + r"""The provider sorting strategy (price, throughput, latency)""" partition: Annotated[ OptionalNullable[ProviderPreferencesPartition], PlainValidator(validate_open_enum(False)), ] = UNSET + r"""Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model.""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -130,15 +146,20 @@ class ProviderPreferencesProviderSortConfig(BaseModel): return m -ProviderSortConfigUnionTypedDict = TypeAliasType( - "ProviderSortConfigUnionTypedDict", - Union[ProviderPreferencesProviderSortConfigTypedDict, ProviderSortConfigEnum], +ProviderPreferencesProviderSortConfigUnionTypedDict = TypeAliasType( + "ProviderPreferencesProviderSortConfigUnionTypedDict", + Union[ + ProviderPreferencesProviderSortConfigTypedDict, + ProviderPreferencesProviderSortConfigEnum, + ], ) -ProviderSortConfigUnion = TypeAliasType( - "ProviderSortConfigUnion", - Union[ProviderPreferencesProviderSortConfig, ProviderSortConfigEnum], +ProviderPreferencesProviderSortConfigUnion = TypeAliasType( + "ProviderPreferencesProviderSortConfigUnion", + Union[ + ProviderPreferencesProviderSortConfig, ProviderPreferencesProviderSortConfigEnum + ], ) @@ -150,11 +171,16 @@ ProviderPreferencesProviderSort = Union[ ], UnrecognizedStr, ] +r"""The provider sorting strategy (price, throughput, latency)""" ProviderPreferencesSortUnionTypedDict = TypeAliasType( "ProviderPreferencesSortUnionTypedDict", - Union[ProviderPreferencesProviderSort, ProviderSortConfigUnionTypedDict, SortEnum], + Union[ + ProviderPreferencesProviderSort, + ProviderPreferencesProviderSortConfigUnionTypedDict, + ProviderPreferencesSortEnum, + ], ) r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" @@ -165,8 +191,10 @@ ProviderPreferencesSortUnion = TypeAliasType( Annotated[ ProviderPreferencesProviderSort, PlainValidator(validate_open_enum(False)) ], - ProviderSortConfigUnion, - Annotated[SortEnum, PlainValidator(validate_open_enum(False))], + ProviderPreferencesProviderSortConfigUnion, + Annotated[ + ProviderPreferencesSortEnum, PlainValidator(validate_open_enum(False)) + ], ], ) r"""The sorting strategy to use for this request, if \"order\" is not specified. When set, no load balancing is performed.""" diff --git a/src/openrouter/components/providersort.py b/src/openrouter/components/providersort.py index c4cbc29..528a881 100644 --- a/src/openrouter/components/providersort.py +++ b/src/openrouter/components/providersort.py @@ -13,3 +13,4 @@ ProviderSort = Union[ ], UnrecognizedStr, ] +r"""The provider sorting strategy (price, throughput, latency)""" diff --git a/src/openrouter/components/providersortconfig.py b/src/openrouter/components/providersortconfig.py index c53a2fa..cba451e 100644 --- a/src/openrouter/components/providersortconfig.py +++ b/src/openrouter/components/providersortconfig.py @@ -1,7 +1,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .providersort import ProviderSort from openrouter.types import ( BaseModel, Nullable, @@ -17,6 +16,17 @@ from typing import Literal, Union from typing_extensions import Annotated, NotRequired, TypedDict +By = Union[ + Literal[ + "price", + "throughput", + "latency", + ], + UnrecognizedStr, +] +r"""The provider sorting strategy (price, throughput, latency)""" + + Partition = Union[ Literal[ "model", @@ -24,21 +34,30 @@ Partition = Union[ ], UnrecognizedStr, ] +r"""Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model.""" class ProviderSortConfigTypedDict(TypedDict): - by: NotRequired[Nullable[ProviderSort]] + r"""The provider sorting strategy (price, throughput, latency)""" + + by: NotRequired[Nullable[By]] + r"""The provider sorting strategy (price, throughput, latency)""" partition: NotRequired[Nullable[Partition]] + r"""Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model.""" class ProviderSortConfig(BaseModel): - by: Annotated[ - OptionalNullable[ProviderSort], PlainValidator(validate_open_enum(False)) - ] = UNSET + r"""The provider sorting strategy (price, throughput, latency)""" + + by: Annotated[OptionalNullable[By], PlainValidator(validate_open_enum(False))] = ( + UNSET + ) + r"""The provider sorting strategy (price, throughput, latency)""" partition: Annotated[ OptionalNullable[Partition], PlainValidator(validate_open_enum(False)) ] = UNSET + r"""Partitioning strategy for sorting: \"model\" (default) groups endpoints by model before sorting (fallback models remain fallbacks), \"none\" sorts all endpoints together regardless of model.""" @model_serializer(mode="wrap") def serialize_model(self, handler): diff --git a/src/openrouter/components/providersortunion.py b/src/openrouter/components/providersortunion.py deleted file mode 100644 index 52ed036..0000000 --- a/src/openrouter/components/providersortunion.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .providersort import ProviderSort -from .providersortconfig import ProviderSortConfig, ProviderSortConfigTypedDict -from openrouter.utils import validate_open_enum -from pydantic.functional_validators import PlainValidator -from typing import Union -from typing_extensions import Annotated, TypeAliasType - - -ProviderSortUnionTypedDict = TypeAliasType( - "ProviderSortUnionTypedDict", Union[ProviderSortConfigTypedDict, ProviderSort] -) - - -ProviderSortUnion = TypeAliasType( - "ProviderSortUnion", - Union[ - ProviderSortConfig, - Annotated[ProviderSort, PlainValidator(validate_open_enum(False))], - ], -) diff --git a/src/openrouter/components/reasoningdetailencrypted.py b/src/openrouter/components/reasoningdetailencrypted.py new file mode 100644 index 0000000..e8d1942 --- /dev/null +++ b/src/openrouter/components/reasoningdetailencrypted.py @@ -0,0 +1,93 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils import validate_open_enum +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import PlainValidator +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +ReasoningDetailEncryptedType = Literal["reasoning.encrypted",] + + +ReasoningDetailEncryptedFormat = Union[ + Literal[ + "unknown", + "openai-responses-v1", + "azure-openai-responses-v1", + "xai-responses-v1", + "anthropic-claude-v1", + "google-gemini-v1", + ], + UnrecognizedStr, +] + + +class ReasoningDetailEncryptedTypedDict(TypedDict): + r"""Reasoning detail encrypted schema""" + + type: ReasoningDetailEncryptedType + data: str + id: NotRequired[Nullable[str]] + format_: NotRequired[Nullable[ReasoningDetailEncryptedFormat]] + index: NotRequired[float] + + +class ReasoningDetailEncrypted(BaseModel): + r"""Reasoning detail encrypted schema""" + + type: ReasoningDetailEncryptedType + + data: str + + id: OptionalNullable[str] = UNSET + + format_: Annotated[ + Annotated[ + OptionalNullable[ReasoningDetailEncryptedFormat], + PlainValidator(validate_open_enum(False)), + ], + pydantic.Field(alias="format"), + ] = UNSET + + index: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["id", "format", "index"] + nullable_fields = ["id", "format"] + 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/components/reasoningdetailsummary.py b/src/openrouter/components/reasoningdetailsummary.py new file mode 100644 index 0000000..19be6e5 --- /dev/null +++ b/src/openrouter/components/reasoningdetailsummary.py @@ -0,0 +1,93 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils import validate_open_enum +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import PlainValidator +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +ReasoningDetailSummaryType = Literal["reasoning.summary",] + + +ReasoningDetailSummaryFormat = Union[ + Literal[ + "unknown", + "openai-responses-v1", + "azure-openai-responses-v1", + "xai-responses-v1", + "anthropic-claude-v1", + "google-gemini-v1", + ], + UnrecognizedStr, +] + + +class ReasoningDetailSummaryTypedDict(TypedDict): + r"""Reasoning detail summary schema""" + + type: ReasoningDetailSummaryType + summary: str + id: NotRequired[Nullable[str]] + format_: NotRequired[Nullable[ReasoningDetailSummaryFormat]] + index: NotRequired[float] + + +class ReasoningDetailSummary(BaseModel): + r"""Reasoning detail summary schema""" + + type: ReasoningDetailSummaryType + + summary: str + + id: OptionalNullable[str] = UNSET + + format_: Annotated[ + Annotated[ + OptionalNullable[ReasoningDetailSummaryFormat], + PlainValidator(validate_open_enum(False)), + ], + pydantic.Field(alias="format"), + ] = UNSET + + index: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["id", "format", "index"] + nullable_fields = ["id", "format"] + 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/components/reasoningdetailtext.py b/src/openrouter/components/reasoningdetailtext.py new file mode 100644 index 0000000..422067d --- /dev/null +++ b/src/openrouter/components/reasoningdetailtext.py @@ -0,0 +1,96 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from openrouter.utils import validate_open_enum +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import PlainValidator +from typing import Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypedDict + + +ReasoningDetailTextType = Literal["reasoning.text",] + + +ReasoningDetailTextFormat = Union[ + Literal[ + "unknown", + "openai-responses-v1", + "azure-openai-responses-v1", + "xai-responses-v1", + "anthropic-claude-v1", + "google-gemini-v1", + ], + UnrecognizedStr, +] + + +class ReasoningDetailTextTypedDict(TypedDict): + r"""Reasoning detail text schema""" + + type: ReasoningDetailTextType + text: NotRequired[Nullable[str]] + signature: NotRequired[Nullable[str]] + id: NotRequired[Nullable[str]] + format_: NotRequired[Nullable[ReasoningDetailTextFormat]] + index: NotRequired[float] + + +class ReasoningDetailText(BaseModel): + r"""Reasoning detail text schema""" + + type: ReasoningDetailTextType + + text: OptionalNullable[str] = UNSET + + signature: OptionalNullable[str] = UNSET + + id: OptionalNullable[str] = UNSET + + format_: Annotated[ + Annotated[ + OptionalNullable[ReasoningDetailTextFormat], + PlainValidator(validate_open_enum(False)), + ], + pydantic.Field(alias="format"), + ] = UNSET + + index: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = ["text", "signature", "id", "format", "index"] + nullable_fields = ["text", "signature", "id", "format"] + 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/components/reasoningdetailunion.py b/src/openrouter/components/reasoningdetailunion.py new file mode 100644 index 0000000..6364730 --- /dev/null +++ b/src/openrouter/components/reasoningdetailunion.py @@ -0,0 +1,38 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .reasoningdetailencrypted import ( + ReasoningDetailEncrypted, + ReasoningDetailEncryptedTypedDict, +) +from .reasoningdetailsummary import ( + ReasoningDetailSummary, + ReasoningDetailSummaryTypedDict, +) +from .reasoningdetailtext import ReasoningDetailText, ReasoningDetailTextTypedDict +from openrouter.utils import get_discriminator +from pydantic import Discriminator, Tag +from typing import Union +from typing_extensions import Annotated, TypeAliasType + + +ReasoningDetailUnionTypedDict = TypeAliasType( + "ReasoningDetailUnionTypedDict", + Union[ + ReasoningDetailSummaryTypedDict, + ReasoningDetailEncryptedTypedDict, + ReasoningDetailTextTypedDict, + ], +) +r"""Reasoning detail union schema""" + + +ReasoningDetailUnion = Annotated[ + Union[ + Annotated[ReasoningDetailSummary, Tag("reasoning.summary")], + Annotated[ReasoningDetailEncrypted, Tag("reasoning.encrypted")], + Annotated[ReasoningDetailText, Tag("reasoning.text")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] +r"""Reasoning detail union schema""" diff --git a/src/openrouter/components/responsesformatjsonobject.py b/src/openrouter/components/responseformatjsonobject.py similarity index 56% rename from src/openrouter/components/responsesformatjsonobject.py rename to src/openrouter/components/responseformatjsonobject.py index e6080b5..ed3e1a6 100644 --- a/src/openrouter/components/responsesformatjsonobject.py +++ b/src/openrouter/components/responseformatjsonobject.py @@ -6,16 +6,16 @@ from typing import Literal from typing_extensions import TypedDict -ResponsesFormatJSONObjectType = Literal["json_object",] +ResponseFormatJSONObjectType = Literal["json_object",] -class ResponsesFormatJSONObjectTypedDict(TypedDict): +class ResponseFormatJSONObjectTypedDict(TypedDict): r"""JSON object response format""" - type: ResponsesFormatJSONObjectType + type: ResponseFormatJSONObjectType -class ResponsesFormatJSONObject(BaseModel): +class ResponseFormatJSONObject(BaseModel): r"""JSON object response format""" - type: ResponsesFormatJSONObjectType + type: ResponseFormatJSONObjectType diff --git a/src/openrouter/components/responseformatjsonschema.py b/src/openrouter/components/responseformatjsonschema.py index efe2a2f..0dac22e 100644 --- a/src/openrouter/components/responseformatjsonschema.py +++ b/src/openrouter/components/responseformatjsonschema.py @@ -3,24 +3,25 @@ from __future__ import annotations from .jsonschemaconfig import JSONSchemaConfig, JSONSchemaConfigTypedDict from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import Literal -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict + + +ResponseFormatJSONSchemaType = Literal["json_schema",] class ResponseFormatJSONSchemaTypedDict(TypedDict): + r"""JSON Schema response format for structured outputs""" + + type: ResponseFormatJSONSchemaType json_schema: JSONSchemaConfigTypedDict - type: Literal["json_schema"] + r"""JSON Schema configuration object""" class ResponseFormatJSONSchema(BaseModel): - json_schema: JSONSchemaConfig + r"""JSON Schema response format for structured outputs""" - TYPE: Annotated[ - Annotated[ - Literal["json_schema"], AfterValidator(validate_const("json_schema")) - ], - pydantic.Field(alias="type"), - ] = "json_schema" + type: ResponseFormatJSONSchemaType + + json_schema: JSONSchemaConfig + r"""JSON Schema configuration object""" diff --git a/src/openrouter/components/responseformattext.py b/src/openrouter/components/responseformattext.py new file mode 100644 index 0000000..b369722 --- /dev/null +++ b/src/openrouter/components/responseformattext.py @@ -0,0 +1,21 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +ResponseFormatTextType = Literal["text",] + + +class ResponseFormatTextTypedDict(TypedDict): + r"""Default text response format""" + + type: ResponseFormatTextType + + +class ResponseFormatText(BaseModel): + r"""Default text response format""" + + type: ResponseFormatTextType diff --git a/src/openrouter/components/responseformattextconfig.py b/src/openrouter/components/responseformattextconfig.py index a82e125..4f4346a 100644 --- a/src/openrouter/components/responseformattextconfig.py +++ b/src/openrouter/components/responseformattextconfig.py @@ -1,9 +1,9 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .responsesformatjsonobject import ( - ResponsesFormatJSONObject, - ResponsesFormatJSONObjectTypedDict, +from .responseformatjsonobject import ( + ResponseFormatJSONObject, + ResponseFormatJSONObjectTypedDict, ) from .responsesformattext import ResponsesFormatText, ResponsesFormatTextTypedDict from .responsesformattextjsonschemaconfig import ( @@ -20,7 +20,7 @@ ResponseFormatTextConfigTypedDict = TypeAliasType( "ResponseFormatTextConfigTypedDict", Union[ ResponsesFormatTextTypedDict, - ResponsesFormatJSONObjectTypedDict, + ResponseFormatJSONObjectTypedDict, ResponsesFormatTextJSONSchemaConfigTypedDict, ], ) @@ -30,7 +30,7 @@ r"""Text response format configuration""" ResponseFormatTextConfig = Annotated[ Union[ Annotated[ResponsesFormatText, Tag("text")], - Annotated[ResponsesFormatJSONObject, Tag("json_object")], + Annotated[ResponseFormatJSONObject, Tag("json_object")], Annotated[ResponsesFormatTextJSONSchemaConfig, Tag("json_schema")], ], Discriminator(lambda m: get_discriminator(m, "type", "type")), diff --git a/src/openrouter/components/responseformattextgrammar.py b/src/openrouter/components/responseformattextgrammar.py index 446c6ec..4ae8030 100644 --- a/src/openrouter/components/responseformattextgrammar.py +++ b/src/openrouter/components/responseformattextgrammar.py @@ -2,22 +2,25 @@ from __future__ import annotations from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import Literal -from typing_extensions import Annotated, TypedDict +from typing_extensions import TypedDict + + +ResponseFormatTextGrammarType = Literal["grammar",] class ResponseFormatTextGrammarTypedDict(TypedDict): + r"""Custom grammar response format""" + + type: ResponseFormatTextGrammarType grammar: str - type: Literal["grammar"] + r"""Custom grammar for text generation""" class ResponseFormatTextGrammar(BaseModel): - grammar: str + r"""Custom grammar response format""" - TYPE: Annotated[ - Annotated[Literal["grammar"], AfterValidator(validate_const("grammar"))], - pydantic.Field(alias="type"), - ] = "grammar" + type: ResponseFormatTextGrammarType + + grammar: str + r"""Custom grammar for text generation""" diff --git a/src/openrouter/components/responseformattextpython.py b/src/openrouter/components/responseformattextpython.py new file mode 100644 index 0000000..4654eb6 --- /dev/null +++ b/src/openrouter/components/responseformattextpython.py @@ -0,0 +1,21 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing import Literal +from typing_extensions import TypedDict + + +ResponseFormatTextPythonType = Literal["python",] + + +class ResponseFormatTextPythonTypedDict(TypedDict): + r"""Python code response format""" + + type: ResponseFormatTextPythonType + + +class ResponseFormatTextPython(BaseModel): + r"""Python code response format""" + + type: ResponseFormatTextPythonType diff --git a/src/openrouter/components/responseserrorfield.py b/src/openrouter/components/responseserrorfield.py index d38e923..d3c7762 100644 --- a/src/openrouter/components/responseserrorfield.py +++ b/src/openrouter/components/responseserrorfield.py @@ -8,7 +8,7 @@ from typing import Literal, Union from typing_extensions import Annotated, TypedDict -CodeEnum = Union[ +Code = Union[ Literal[ "server_error", "rate_limit_exceeded", @@ -36,13 +36,13 @@ CodeEnum = Union[ class ResponsesErrorFieldTypedDict(TypedDict): r"""Error information returned from the API""" - code: CodeEnum + code: Code message: str class ResponsesErrorField(BaseModel): r"""Error information returned from the API""" - code: Annotated[CodeEnum, PlainValidator(validate_open_enum(False))] + code: Annotated[Code, PlainValidator(validate_open_enum(False))] message: str diff --git a/src/openrouter/components/responsesoutputitemreasoning.py b/src/openrouter/components/responsesoutputitemreasoning.py index a94fb36..b0c8a9c 100644 --- a/src/openrouter/components/responsesoutputitemreasoning.py +++ b/src/openrouter/components/responsesoutputitemreasoning.py @@ -71,7 +71,7 @@ class ResponsesOutputItemReasoningTypedDict(TypedDict): type: ResponsesOutputItemReasoningType id: str summary: List[ReasoningSummaryTextTypedDict] - content: NotRequired[List[ReasoningTextContentTypedDict]] + content: NotRequired[Nullable[List[ReasoningTextContentTypedDict]]] encrypted_content: NotRequired[Nullable[str]] status: NotRequired[ResponsesOutputItemReasoningStatusUnionTypedDict] signature: NotRequired[Nullable[str]] @@ -89,7 +89,7 @@ class ResponsesOutputItemReasoning(BaseModel): summary: List[ReasoningSummaryText] - content: Optional[List[ReasoningTextContent]] = None + content: OptionalNullable[List[ReasoningTextContent]] = UNSET encrypted_content: OptionalNullable[str] = UNSET @@ -116,7 +116,7 @@ class ResponsesOutputItemReasoning(BaseModel): "signature", "format", ] - nullable_fields = ["encrypted_content", "signature", "format"] + nullable_fields = ["content", "encrypted_content", "signature", "format"] null_default_fields = [] serialized = handler(self) diff --git a/src/openrouter/components/systemmessage.py b/src/openrouter/components/systemmessage.py index 19b6e67..6143e2e 100644 --- a/src/openrouter/components/systemmessage.py +++ b/src/openrouter/components/systemmessage.py @@ -6,36 +6,43 @@ from .chatmessagecontentitemtext import ( ChatMessageContentItemTextTypedDict, ) from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +SystemMessageRole = Literal["system",] SystemMessageContentTypedDict = TypeAliasType( "SystemMessageContentTypedDict", Union[str, List[ChatMessageContentItemTextTypedDict]], ) +r"""System message content""" SystemMessageContent = TypeAliasType( "SystemMessageContent", Union[str, List[ChatMessageContentItemText]] ) +r"""System message content""" class SystemMessageTypedDict(TypedDict): + r"""System message for setting behavior""" + + role: SystemMessageRole content: SystemMessageContentTypedDict - role: Literal["system"] + r"""System message content""" name: NotRequired[str] + r"""Optional name for the system message""" class SystemMessage(BaseModel): - content: SystemMessageContent + r"""System message for setting behavior""" - ROLE: Annotated[ - Annotated[Literal["system"], AfterValidator(validate_const("system"))], - pydantic.Field(alias="role"), - ] = "system" + role: SystemMessageRole + + content: SystemMessageContent + r"""System message content""" name: Optional[str] = None + r"""Optional name for the system message""" diff --git a/src/openrouter/components/toolchoiceoption.py b/src/openrouter/components/toolchoiceoption.py new file mode 100644 index 0000000..f280435 --- /dev/null +++ b/src/openrouter/components/toolchoiceoption.py @@ -0,0 +1,39 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .namedtoolchoice import NamedToolChoice, NamedToolChoiceTypedDict +from typing import Literal, Union +from typing_extensions import TypeAliasType + + +ToolChoiceOptionRequired = Literal["required",] + + +ToolChoiceOptionAuto = Literal["auto",] + + +ToolChoiceOptionNone = Literal["none",] + + +ToolChoiceOptionTypedDict = TypeAliasType( + "ToolChoiceOptionTypedDict", + Union[ + NamedToolChoiceTypedDict, + ToolChoiceOptionNone, + ToolChoiceOptionAuto, + ToolChoiceOptionRequired, + ], +) +r"""Tool choice configuration""" + + +ToolChoiceOption = TypeAliasType( + "ToolChoiceOption", + Union[ + NamedToolChoice, + ToolChoiceOptionNone, + ToolChoiceOptionAuto, + ToolChoiceOptionRequired, + ], +) +r"""Tool choice configuration""" diff --git a/src/openrouter/components/tooldefinitionjson.py b/src/openrouter/components/tooldefinitionjson.py index 1dde81b..56f14a9 100644 --- a/src/openrouter/components/tooldefinitionjson.py +++ b/src/openrouter/components/tooldefinitionjson.py @@ -1,6 +1,10 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .chatmessagecontentitemcachecontrol import ( + ChatMessageContentItemCacheControl, + ChatMessageContentItemCacheControlTypedDict, +) from openrouter.types import ( BaseModel, Nullable, @@ -8,29 +12,41 @@ from openrouter.types import ( UNSET, UNSET_SENTINEL, ) -from openrouter.utils import validate_const -import pydantic from pydantic import model_serializer -from pydantic.functional_validators import AfterValidator from typing import Any, Dict, Literal, Optional -from typing_extensions import Annotated, NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + + +ToolDefinitionJSONType = Literal["function",] class ToolDefinitionJSONFunctionTypedDict(TypedDict): + r"""Function definition for tool calling""" + name: str + r"""Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)""" description: NotRequired[str] - parameters: NotRequired[Dict[str, Any]] + r"""Function description for the model""" + parameters: NotRequired[Dict[str, Nullable[Any]]] + r"""Function parameters as JSON Schema object""" strict: NotRequired[Nullable[bool]] + r"""Enable strict schema adherence""" class ToolDefinitionJSONFunction(BaseModel): + r"""Function definition for tool calling""" + name: str + r"""Function name (a-z, A-Z, 0-9, underscores, dashes, max 64 chars)""" description: Optional[str] = None + r"""Function description for the model""" - parameters: Optional[Dict[str, Any]] = None + parameters: Optional[Dict[str, Nullable[Any]]] = None + r"""Function parameters as JSON Schema object""" strict: OptionalNullable[bool] = UNSET + r"""Enable strict schema adherence""" @model_serializer(mode="wrap") def serialize_model(self, handler): @@ -64,14 +80,22 @@ class ToolDefinitionJSONFunction(BaseModel): class ToolDefinitionJSONTypedDict(TypedDict): + r"""Tool definition for function calling""" + + type: ToolDefinitionJSONType function: ToolDefinitionJSONFunctionTypedDict - type: Literal["function"] + r"""Function definition for tool calling""" + cache_control: NotRequired[ChatMessageContentItemCacheControlTypedDict] + r"""Cache control for the content part""" class ToolDefinitionJSON(BaseModel): - function: ToolDefinitionJSONFunction + r"""Tool definition for function calling""" - TYPE: Annotated[ - Annotated[Literal["function"], AfterValidator(validate_const("function"))], - pydantic.Field(alias="type"), - ] = "function" + type: ToolDefinitionJSONType + + function: ToolDefinitionJSONFunction + r"""Function definition for tool calling""" + + cache_control: Optional[ChatMessageContentItemCacheControl] = None + r"""Cache control for the content part""" diff --git a/src/openrouter/components/toolresponsemessage.py b/src/openrouter/components/toolresponsemessage.py index 666740e..5b7b747 100644 --- a/src/openrouter/components/toolresponsemessage.py +++ b/src/openrouter/components/toolresponsemessage.py @@ -6,36 +6,43 @@ from .chatmessagecontentitem import ( ChatMessageContentItemTypedDict, ) from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import List, Literal, Union -from typing_extensions import Annotated, TypeAliasType, TypedDict +from typing_extensions import TypeAliasType, TypedDict + + +ToolResponseMessageRole = Literal["tool",] ToolResponseMessageContentTypedDict = TypeAliasType( "ToolResponseMessageContentTypedDict", Union[str, List[ChatMessageContentItemTypedDict]], ) +r"""Tool response content""" ToolResponseMessageContent = TypeAliasType( "ToolResponseMessageContent", Union[str, List[ChatMessageContentItem]] ) +r"""Tool response content""" class ToolResponseMessageTypedDict(TypedDict): + r"""Tool response message""" + + role: ToolResponseMessageRole content: ToolResponseMessageContentTypedDict + r"""Tool response content""" tool_call_id: str - role: Literal["tool"] + r"""ID of the assistant message tool call this message responds to""" class ToolResponseMessage(BaseModel): + r"""Tool response message""" + + role: ToolResponseMessageRole + content: ToolResponseMessageContent + r"""Tool response content""" tool_call_id: str - - ROLE: Annotated[ - Annotated[Literal["tool"], AfterValidator(validate_const("tool"))], - pydantic.Field(alias="role"), - ] = "tool" + r"""ID of the assistant message tool call this message responds to""" diff --git a/src/openrouter/components/usermessage.py b/src/openrouter/components/usermessage.py index ce9e9d6..5300ded 100644 --- a/src/openrouter/components/usermessage.py +++ b/src/openrouter/components/usermessage.py @@ -6,35 +6,42 @@ from .chatmessagecontentitem import ( ChatMessageContentItemTypedDict, ) from openrouter.types import BaseModel -from openrouter.utils import validate_const -import pydantic -from pydantic.functional_validators import AfterValidator from typing import List, Literal, Optional, Union -from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict +from typing_extensions import NotRequired, TypeAliasType, TypedDict + + +UserMessageRole = Literal["user",] UserMessageContentTypedDict = TypeAliasType( "UserMessageContentTypedDict", Union[str, List[ChatMessageContentItemTypedDict]] ) +r"""User message content""" UserMessageContent = TypeAliasType( "UserMessageContent", Union[str, List[ChatMessageContentItem]] ) +r"""User message content""" class UserMessageTypedDict(TypedDict): + r"""User message""" + + role: UserMessageRole content: UserMessageContentTypedDict - role: Literal["user"] + r"""User message content""" name: NotRequired[str] + r"""Optional name for the user""" class UserMessage(BaseModel): - content: UserMessageContent + r"""User message""" - ROLE: Annotated[ - Annotated[Literal["user"], AfterValidator(validate_const("user"))], - pydantic.Field(alias="role"), - ] = "user" + role: UserMessageRole + + content: UserMessageContent + r"""User message content""" name: Optional[str] = None + r"""Optional name for the user""" diff --git a/src/openrouter/components/videoinput.py b/src/openrouter/components/videoinput.py new file mode 100644 index 0000000..3cb4490 --- /dev/null +++ b/src/openrouter/components/videoinput.py @@ -0,0 +1,19 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from openrouter.types import BaseModel +from typing_extensions import TypedDict + + +class VideoInputTypedDict(TypedDict): + r"""Video input object""" + + url: str + r"""URL of the video (data: URLs supported)""" + + +class VideoInput(BaseModel): + r"""Video input object""" + + url: str + r"""URL of the video (data: URLs supported)""" diff --git a/src/openrouter/errors/__init__.py b/src/openrouter/errors/__init__.py index b8f32f8..2c9e7bb 100644 --- a/src/openrouter/errors/__init__.py +++ b/src/openrouter/errors/__init__.py @@ -15,7 +15,6 @@ if TYPE_CHECKING: BadRequestResponseError, BadRequestResponseErrorData, ) - from .chaterror import ChatError, ChatErrorData from .edgenetworktimeoutresponse_error import ( EdgeNetworkTimeoutResponseError, EdgeNetworkTimeoutResponseErrorData, @@ -70,8 +69,6 @@ __all__ = [ "BadGatewayResponseErrorData", "BadRequestResponseError", "BadRequestResponseErrorData", - "ChatError", - "ChatErrorData", "EdgeNetworkTimeoutResponseError", "EdgeNetworkTimeoutResponseErrorData", "ForbiddenResponseError", @@ -107,8 +104,6 @@ _dynamic_imports: dict[str, str] = { "BadGatewayResponseErrorData": ".badgatewayresponse_error", "BadRequestResponseError": ".badrequestresponse_error", "BadRequestResponseErrorData": ".badrequestresponse_error", - "ChatError": ".chaterror", - "ChatErrorData": ".chaterror", "EdgeNetworkTimeoutResponseError": ".edgenetworktimeoutresponse_error", "EdgeNetworkTimeoutResponseErrorData": ".edgenetworktimeoutresponse_error", "ForbiddenResponseError": ".forbiddenresponse_error", diff --git a/src/openrouter/errors/chaterror.py b/src/openrouter/errors/chaterror.py deleted file mode 100644 index 3236d3c..0000000 --- a/src/openrouter/errors/chaterror.py +++ /dev/null @@ -1,29 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from dataclasses import dataclass, field -import httpx -from openrouter.components import chaterror as components_chaterror -from openrouter.errors import OpenRouterError -from openrouter.types import BaseModel -from typing import Optional - - -class ChatErrorData(BaseModel): - error: components_chaterror.ChatErrorError - - -@dataclass(unsafe_hash=True) -class ChatError(OpenRouterError): - data: ChatErrorData = field(hash=False) - - def __init__( - self, - data: ChatErrorData, - raw_response: httpx.Response, - body: Optional[str] = None, - ): - fallback = body or raw_response.text - message = str(data.error.message) or fallback - super().__init__(message, raw_response, body) - object.__setattr__(self, "data", data) diff --git a/src/openrouter/oauth.py b/src/openrouter/oauth.py index 024af82..ff44c48 100644 --- a/src/openrouter/oauth.py +++ b/src/openrouter/oauth.py @@ -297,6 +297,8 @@ class OAuth(BaseSDK): ] = None, limit: Optional[float] = None, expires_at: OptionalNullable[datetime] = UNSET, + key_label: Optional[str] = None, + usage_limit_type: Optional[operations.UsageLimitType] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -316,6 +318,8 @@ class OAuth(BaseSDK): :param code_challenge_method: The method used to generate the code challenge :param limit: Credit limit for the API key to be created :param expires_at: Optional expiration time for the API key to be created + :param key_label: Optional custom label for the API key. Defaults to the app name if not provided. + :param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval. :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 @@ -340,6 +344,8 @@ class OAuth(BaseSDK): code_challenge_method=code_challenge_method, limit=limit, expires_at=expires_at, + key_label=key_label, + usage_limit_type=usage_limit_type, ), ) @@ -439,6 +445,8 @@ class OAuth(BaseSDK): ] = None, limit: Optional[float] = None, expires_at: OptionalNullable[datetime] = UNSET, + key_label: Optional[str] = None, + usage_limit_type: Optional[operations.UsageLimitType] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -458,6 +466,8 @@ class OAuth(BaseSDK): :param code_challenge_method: The method used to generate the code challenge :param limit: Credit limit for the API key to be created :param expires_at: Optional expiration time for the API key to be created + :param key_label: Optional custom label for the API key. Defaults to the app name if not provided. + :param usage_limit_type: Optional credit limit reset interval. When set, the credit limit resets on this interval. :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 @@ -482,6 +492,8 @@ class OAuth(BaseSDK): code_challenge_method=code_challenge_method, limit=limit, expires_at=expires_at, + key_label=key_label, + usage_limit_type=usage_limit_type, ), ) diff --git a/src/openrouter/operations/__init__.py b/src/openrouter/operations/__init__.py index a8f6455..e3aca11 100644 --- a/src/openrouter/operations/__init__.py +++ b/src/openrouter/operations/__init__.py @@ -58,6 +58,7 @@ if TYPE_CHECKING: CreateAuthKeysCodeRequestTypedDict, CreateAuthKeysCodeResponse, CreateAuthKeysCodeResponseTypedDict, + UsageLimitType, ) from .createcoinbasecharge import ( CallData, @@ -363,6 +364,8 @@ if TYPE_CHECKING: SendChatCompletionRequestRequest, SendChatCompletionRequestRequestTypedDict, SendChatCompletionRequestResponse, + SendChatCompletionRequestResponseBody, + SendChatCompletionRequestResponseBodyTypedDict, SendChatCompletionRequestResponseTypedDict, ) from .updateguardrail import ( @@ -678,6 +681,8 @@ __all__ = [ "SendChatCompletionRequestRequest", "SendChatCompletionRequestRequestTypedDict", "SendChatCompletionRequestResponse", + "SendChatCompletionRequestResponseBody", + "SendChatCompletionRequestResponseBodyTypedDict", "SendChatCompletionRequestResponseTypedDict", "TransferIntent", "TransferIntentTypedDict", @@ -707,6 +712,7 @@ __all__ = [ "UpdateKeysResponse", "UpdateKeysResponseTypedDict", "Usage", + "UsageLimitType", "UsageTypedDict", "Web3Data", "Web3DataTypedDict", @@ -756,6 +762,7 @@ _dynamic_imports: dict[str, str] = { "CreateAuthKeysCodeRequestTypedDict": ".createauthkeyscode", "CreateAuthKeysCodeResponse": ".createauthkeyscode", "CreateAuthKeysCodeResponseTypedDict": ".createauthkeyscode", + "UsageLimitType": ".createauthkeyscode", "CallData": ".createcoinbasecharge", "CallDataTypedDict": ".createcoinbasecharge", "CreateCoinbaseChargeData": ".createcoinbasecharge", @@ -1005,6 +1012,8 @@ _dynamic_imports: dict[str, str] = { "SendChatCompletionRequestRequest": ".sendchatcompletionrequest", "SendChatCompletionRequestRequestTypedDict": ".sendchatcompletionrequest", "SendChatCompletionRequestResponse": ".sendchatcompletionrequest", + "SendChatCompletionRequestResponseBody": ".sendchatcompletionrequest", + "SendChatCompletionRequestResponseBodyTypedDict": ".sendchatcompletionrequest", "SendChatCompletionRequestResponseTypedDict": ".sendchatcompletionrequest", "UpdateGuardrailData": ".updateguardrail", "UpdateGuardrailDataTypedDict": ".updateguardrail", diff --git a/src/openrouter/operations/createauthkeyscode.py b/src/openrouter/operations/createauthkeyscode.py index 9ca929d..62f121a 100644 --- a/src/openrouter/operations/createauthkeyscode.py +++ b/src/openrouter/operations/createauthkeyscode.py @@ -66,6 +66,17 @@ CreateAuthKeysCodeCodeChallengeMethod = Union[ r"""The method used to generate the code challenge""" +UsageLimitType = Union[ + Literal[ + "daily", + "weekly", + "monthly", + ], + UnrecognizedStr, +] +r"""Optional credit limit reset interval. When set, the credit limit resets on this interval.""" + + class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict): callback_url: str r"""The callback URL to redirect to after authorization. Note, only https URLs on ports 443 and 3000 are allowed.""" @@ -77,6 +88,10 @@ class CreateAuthKeysCodeRequestBodyTypedDict(TypedDict): r"""Credit limit for the API key to be created""" expires_at: NotRequired[Nullable[datetime]] r"""Optional expiration time for the API key to be created""" + key_label: NotRequired[str] + r"""Optional custom label for the API key. Defaults to the app name if not provided.""" + usage_limit_type: NotRequired[UsageLimitType] + r"""Optional credit limit reset interval. When set, the credit limit resets on this interval.""" class CreateAuthKeysCodeRequestBody(BaseModel): @@ -98,6 +113,14 @@ class CreateAuthKeysCodeRequestBody(BaseModel): expires_at: OptionalNullable[datetime] = UNSET r"""Optional expiration time for the API key to be created""" + key_label: Optional[str] = None + r"""Optional custom label for the API key. Defaults to the app name if not provided.""" + + usage_limit_type: Annotated[ + Optional[UsageLimitType], PlainValidator(validate_open_enum(False)) + ] = None + r"""Optional credit limit reset interval. When set, the credit limit resets on this interval.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ @@ -105,6 +128,8 @@ class CreateAuthKeysCodeRequestBody(BaseModel): "code_challenge_method", "limit", "expires_at", + "key_label", + "usage_limit_type", ] nullable_fields = ["expires_at"] null_default_fields = [] diff --git a/src/openrouter/operations/getgeneration.py b/src/openrouter/operations/getgeneration.py index cad7425..05aa6ff 100644 --- a/src/openrouter/operations/getgeneration.py +++ b/src/openrouter/operations/getgeneration.py @@ -160,7 +160,9 @@ ProviderName = Union[ "Inception", "Inceptron", "InferenceNet", + "Ionstream", "Infermatic", + "Io Net", "Inflection", "Liquid", "Mara", diff --git a/src/openrouter/operations/sendchatcompletionrequest.py b/src/openrouter/operations/sendchatcompletionrequest.py index 4db4072..bb23c22 100644 --- a/src/openrouter/operations/sendchatcompletionrequest.py +++ b/src/openrouter/operations/sendchatcompletionrequest.py @@ -55,7 +55,6 @@ class SendChatCompletionRequestRequestTypedDict(TypedDict): chat_generation_params: ( components_chatgenerationparams.ChatGenerationParamsTypedDict ) - r"""Chat completion request parameters""" http_referer: NotRequired[str] r"""The app identifier should be your app's URL and is used as the primary identifier for rankings. This is used to track API usage per application. @@ -72,7 +71,6 @@ class SendChatCompletionRequestRequest(BaseModel): components_chatgenerationparams.ChatGenerationParams, FieldMetadata(request=RequestMetadata(media_type="application/json")), ] - r"""Chat completion request parameters""" http_referer: Annotated[ Optional[str], @@ -94,16 +92,30 @@ class SendChatCompletionRequestRequest(BaseModel): """ +class SendChatCompletionRequestResponseBodyTypedDict(TypedDict): + r"""Successful chat completion response""" + + data: components_chatstreamingresponsechunk.ChatStreamingResponseChunkTypedDict + r"""Streaming chat completion chunk""" + + +class SendChatCompletionRequestResponseBody(BaseModel): + r"""Successful chat completion response""" + + data: components_chatstreamingresponsechunk.ChatStreamingResponseChunk + r"""Streaming chat completion chunk""" + + SendChatCompletionRequestResponseTypedDict = TypeAliasType( "SendChatCompletionRequestResponseTypedDict", Union[ components_chatresponse.ChatResponseTypedDict, Union[ eventstreaming.EventStream[ - components_chatstreamingresponsechunk.ChatStreamingResponseChunkDataTypedDict + components_chatstreamingresponsechunk.ChatStreamingResponseChunkTypedDict ], eventstreaming.EventStreamAsync[ - components_chatstreamingresponsechunk.ChatStreamingResponseChunkDataTypedDict + components_chatstreamingresponsechunk.ChatStreamingResponseChunkTypedDict ], ], ], @@ -116,10 +128,10 @@ SendChatCompletionRequestResponse = TypeAliasType( components_chatresponse.ChatResponse, Union[ eventstreaming.EventStream[ - components_chatstreamingresponsechunk.ChatStreamingResponseChunkData + components_chatstreamingresponsechunk.ChatStreamingResponseChunk ], eventstreaming.EventStreamAsync[ - components_chatstreamingresponsechunk.ChatStreamingResponseChunkData + components_chatstreamingresponsechunk.ChatStreamingResponseChunk ], ], ], diff --git a/src/openrouter/responses.py b/src/openrouter/responses.py index 8c4281e..d3382e7 100644 --- a/src/openrouter/responses.py +++ b/src/openrouter/responses.py @@ -86,13 +86,25 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Union[Literal[False], None] = None, provider: OptionalNullable[ - Union[components.Provider, components.ProviderTypedDict] + Union[ + components.OpenResponsesRequestProvider, + components.OpenResponsesRequestProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Plugin], List[components.PluginTypedDict]] + Union[ + List[components.OpenResponsesRequestPluginUnion], + List[components.OpenResponsesRequestPluginUnionTypedDict], + ] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.OpenResponsesRequestTrace, + components.OpenResponsesRequestTraceTypedDict, + ] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -140,6 +152,7 @@ class Responses(BaseSDK): :param plugins: Plugins you want to enable for this request, including their settings. :param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :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 @@ -215,13 +228,25 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Literal[True], provider: OptionalNullable[ - Union[components.Provider, components.ProviderTypedDict] + Union[ + components.OpenResponsesRequestProvider, + components.OpenResponsesRequestProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Plugin], List[components.PluginTypedDict]] + Union[ + List[components.OpenResponsesRequestPluginUnion], + List[components.OpenResponsesRequestPluginUnionTypedDict], + ] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.OpenResponsesRequestTrace, + components.OpenResponsesRequestTraceTypedDict, + ] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -269,6 +294,7 @@ class Responses(BaseSDK): :param plugins: Plugins you want to enable for this request, including their settings. :param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :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 @@ -343,13 +369,25 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Optional[bool] = False, provider: OptionalNullable[ - Union[components.Provider, components.ProviderTypedDict] + Union[ + components.OpenResponsesRequestProvider, + components.OpenResponsesRequestProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Plugin], List[components.PluginTypedDict]] + Union[ + List[components.OpenResponsesRequestPluginUnion], + List[components.OpenResponsesRequestPluginUnionTypedDict], + ] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.OpenResponsesRequestTrace, + components.OpenResponsesRequestTraceTypedDict, + ] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -397,6 +435,7 @@ class Responses(BaseSDK): :param plugins: Plugins you want to enable for this request, including their settings. :param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :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 @@ -459,13 +498,16 @@ class Responses(BaseSDK): truncation=truncation, stream=stream, provider=utils.get_pydantic_model( - provider, OptionalNullable[components.Provider] + provider, OptionalNullable[components.OpenResponsesRequestProvider] ), plugins=utils.get_pydantic_model( - plugins, Optional[List[components.Plugin]] + plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] ), user=user, session_id=session_id, + trace=utils.get_pydantic_model( + trace, Optional[components.OpenResponsesRequestTrace] + ), ), ) @@ -734,13 +776,25 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Union[Literal[False], None] = None, provider: OptionalNullable[ - Union[components.Provider, components.ProviderTypedDict] + Union[ + components.OpenResponsesRequestProvider, + components.OpenResponsesRequestProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Plugin], List[components.PluginTypedDict]] + Union[ + List[components.OpenResponsesRequestPluginUnion], + List[components.OpenResponsesRequestPluginUnionTypedDict], + ] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.OpenResponsesRequestTrace, + components.OpenResponsesRequestTraceTypedDict, + ] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -788,6 +842,7 @@ class Responses(BaseSDK): :param plugins: Plugins you want to enable for this request, including their settings. :param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :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 @@ -863,13 +918,25 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Literal[True], provider: OptionalNullable[ - Union[components.Provider, components.ProviderTypedDict] + Union[ + components.OpenResponsesRequestProvider, + components.OpenResponsesRequestProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Plugin], List[components.PluginTypedDict]] + Union[ + List[components.OpenResponsesRequestPluginUnion], + List[components.OpenResponsesRequestPluginUnionTypedDict], + ] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.OpenResponsesRequestTrace, + components.OpenResponsesRequestTraceTypedDict, + ] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -917,6 +984,7 @@ class Responses(BaseSDK): :param plugins: Plugins you want to enable for this request, including their settings. :param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :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 @@ -991,13 +1059,25 @@ class Responses(BaseSDK): truncation: OptionalNullable[components.Truncation] = UNSET, stream: Optional[bool] = False, provider: OptionalNullable[ - Union[components.Provider, components.ProviderTypedDict] + Union[ + components.OpenResponsesRequestProvider, + components.OpenResponsesRequestProviderTypedDict, + ] ] = UNSET, plugins: Optional[ - Union[List[components.Plugin], List[components.PluginTypedDict]] + Union[ + List[components.OpenResponsesRequestPluginUnion], + List[components.OpenResponsesRequestPluginUnionTypedDict], + ] ] = None, user: Optional[str] = None, session_id: Optional[str] = None, + trace: Optional[ + Union[ + components.OpenResponsesRequestTrace, + components.OpenResponsesRequestTraceTypedDict, + ] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -1045,6 +1125,7 @@ class Responses(BaseSDK): :param plugins: Plugins you want to enable for this request, including their settings. :param user: A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 128 characters. :param session_id: A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 128 characters. + :param trace: Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. :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 @@ -1107,13 +1188,16 @@ class Responses(BaseSDK): truncation=truncation, stream=stream, provider=utils.get_pydantic_model( - provider, OptionalNullable[components.Provider] + provider, OptionalNullable[components.OpenResponsesRequestProvider] ), plugins=utils.get_pydantic_model( - plugins, Optional[List[components.Plugin]] + plugins, Optional[List[components.OpenResponsesRequestPluginUnion]] ), user=user, session_id=session_id, + trace=utils.get_pydantic_model( + trace, Optional[components.OpenResponsesRequestTrace] + ), ), ) diff --git a/src/openrouter/sdk.py b/src/openrouter/sdk.py index 062548f..84ff3ef 100644 --- a/src/openrouter/sdk.py +++ b/src/openrouter/sdk.py @@ -38,6 +38,7 @@ class OpenRouter(BaseSDK): beta: "Beta" analytics: "Analytics" r"""Analytics and usage endpoints""" + chat: "Chat" credits: "Credits" r"""Credit management endpoints""" embeddings: "Embeddings" @@ -56,10 +57,10 @@ class OpenRouter(BaseSDK): r"""Guardrails endpoints""" o_auth: "OAuth" r"""OAuth authentication endpoints""" - chat: "Chat" _sub_sdk_map = { "beta": ("openrouter.beta", "Beta"), "analytics": ("openrouter.analytics", "Analytics"), + "chat": ("openrouter.chat", "Chat"), "credits": ("openrouter.credits", "Credits"), "embeddings": ("openrouter.embeddings", "Embeddings"), "generations": ("openrouter.generations", "Generations"), @@ -69,7 +70,6 @@ class OpenRouter(BaseSDK): "api_keys": ("openrouter.api_keys", "APIKeys"), "guardrails": ("openrouter.guardrails", "Guardrails"), "o_auth": ("openrouter.oauth", "OAuth"), - "chat": ("openrouter.chat", "Chat"), } def __init__( diff --git a/uv.lock b/uv.lock index 6b1deff..65058fe 100644 --- a/uv.lock +++ b/uv.lock @@ -211,7 +211,7 @@ wheels = [ [[package]] name = "openrouter" -version = "0.2.0" +version = "0.7.11" source = { editable = "." } dependencies = [ { name = "httpcore" },