@openrouter/sdk 0.0.0-beta.2 → 0.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FUNCTIONS.md +1 -3
- package/REACT_QUERY.md +10 -14
- package/README.md +62 -40
- package/dist/commonjs/funcs/analyticsGetActivity.js +3 -2
- package/dist/commonjs/funcs/analyticsGetActivity.js.map +1 -1
- package/dist/commonjs/funcs/apiKeysDeleteKeysHash.js +3 -2
- package/dist/commonjs/funcs/apiKeysDeleteKeysHash.js.map +1 -1
- package/dist/commonjs/funcs/apiKeysGetAuthKey.js +3 -2
- package/dist/commonjs/funcs/apiKeysGetAuthKey.js.map +1 -1
- package/dist/commonjs/funcs/apiKeysGetKey.js +3 -2
- package/dist/commonjs/funcs/apiKeysGetKey.js.map +1 -1
- package/dist/commonjs/funcs/apiKeysGetKeys.js +3 -2
- package/dist/commonjs/funcs/apiKeysGetKeys.js.map +1 -1
- package/dist/commonjs/funcs/apiKeysGetKeysHash.js +3 -2
- package/dist/commonjs/funcs/apiKeysGetKeysHash.js.map +1 -1
- package/dist/commonjs/funcs/apiKeysPatchKeysHash.js +3 -2
- package/dist/commonjs/funcs/apiKeysPatchKeysHash.js.map +1 -1
- package/dist/commonjs/funcs/apiKeysPostKeys.js +3 -2
- package/dist/commonjs/funcs/apiKeysPostKeys.js.map +1 -1
- package/dist/commonjs/funcs/chatSend.js +3 -2
- package/dist/commonjs/funcs/chatSend.js.map +1 -1
- package/dist/{esm/funcs/postCreditsCoinbase.d.ts → commonjs/funcs/creditsPostCreditsCoinbase.d.ts} +2 -2
- package/dist/commonjs/funcs/creditsPostCreditsCoinbase.d.ts.map +1 -0
- package/dist/commonjs/funcs/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +14 -9
- package/dist/commonjs/funcs/creditsPostCreditsCoinbase.js.map +1 -0
- package/dist/commonjs/funcs/{embeddingsPostEmbeddings.d.ts → embeddingsGenerate.d.ts} +2 -2
- package/dist/commonjs/funcs/embeddingsGenerate.d.ts.map +1 -0
- package/dist/commonjs/funcs/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +6 -5
- package/dist/commonjs/funcs/embeddingsGenerate.js.map +1 -0
- package/dist/commonjs/funcs/endpointsGetEndpointsZdr.js +3 -2
- package/dist/commonjs/funcs/endpointsGetEndpointsZdr.js.map +1 -1
- package/dist/commonjs/funcs/endpointsGetModelsAuthorSlugEndpoints.js +3 -2
- package/dist/commonjs/funcs/endpointsGetModelsAuthorSlugEndpoints.js.map +1 -1
- package/dist/commonjs/funcs/generationsGetGeneration.js +3 -2
- package/dist/commonjs/funcs/generationsGetGeneration.js.map +1 -1
- package/dist/commonjs/funcs/getCredits.js +3 -2
- package/dist/commonjs/funcs/getCredits.js.map +1 -1
- package/dist/{esm/funcs/parametersGetParametersAuthorSlug.d.ts → commonjs/funcs/modelGetParametersAuthorSlug.d.ts} +2 -2
- package/dist/commonjs/funcs/modelGetParametersAuthorSlug.d.ts.map +1 -0
- package/dist/commonjs/funcs/{parametersGetParametersAuthorSlug.js → modelGetParametersAuthorSlug.js} +14 -9
- package/dist/commonjs/funcs/modelGetParametersAuthorSlug.js.map +1 -0
- package/dist/commonjs/funcs/modelsGetModels.js +3 -2
- package/dist/commonjs/funcs/modelsGetModels.js.map +1 -1
- package/dist/commonjs/funcs/modelsGetModelsCount.js +3 -2
- package/dist/commonjs/funcs/modelsGetModelsCount.js.map +1 -1
- package/dist/commonjs/funcs/modelsGetModelsUser.d.ts +1 -1
- package/dist/commonjs/funcs/modelsGetModelsUser.d.ts.map +1 -1
- package/dist/commonjs/funcs/modelsGetModelsUser.js +12 -7
- package/dist/commonjs/funcs/modelsGetModelsUser.js.map +1 -1
- package/dist/commonjs/funcs/oAuthPostAuthKeys.d.ts +17 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeys.d.ts.map +1 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeys.js +116 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeys.js.map +1 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeysCode.d.ts +17 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeysCode.d.ts.map +1 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeysCode.js +116 -0
- package/dist/commonjs/funcs/oAuthPostAuthKeysCode.js.map +1 -0
- package/dist/{esm/funcs/getProviders.d.ts → commonjs/funcs/providersGetProviders.d.ts} +5 -2
- package/dist/commonjs/funcs/providersGetProviders.d.ts.map +1 -0
- package/dist/commonjs/funcs/{getProviders.js → providersGetProviders.js} +9 -5
- package/dist/commonjs/funcs/providersGetProviders.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +4 -8
- package/dist/commonjs/lib/config.d.ts.map +1 -1
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/lib/env.d.ts +0 -1
- package/dist/commonjs/lib/env.d.ts.map +1 -1
- package/dist/commonjs/lib/env.js +0 -1
- package/dist/commonjs/lib/env.js.map +1 -1
- package/dist/commonjs/lib/security.d.ts.map +1 -1
- package/dist/commonjs/lib/security.js +1 -7
- package/dist/commonjs/lib/security.js.map +1 -1
- package/dist/commonjs/models/chaterror.d.ts +23 -2
- package/dist/commonjs/models/chaterror.d.ts.map +1 -1
- package/dist/commonjs/models/chaterror.js +27 -3
- package/dist/commonjs/models/chaterror.js.map +1 -1
- package/dist/commonjs/models/chatresponse.d.ts +2 -2
- package/dist/commonjs/models/chatresponse.d.ts.map +1 -1
- package/dist/commonjs/models/chatresponse.js +2 -2
- package/dist/commonjs/models/chatresponse.js.map +1 -1
- package/dist/commonjs/models/chatstreamingresponsechunk.d.ts +2 -2
- package/dist/commonjs/models/chatstreamingresponsechunk.d.ts.map +1 -1
- package/dist/commonjs/models/chatstreamingresponsechunk.js +2 -2
- package/dist/commonjs/models/chatstreamingresponsechunk.js.map +1 -1
- package/dist/commonjs/models/errorresponse.d.ts +8 -8
- package/dist/commonjs/models/errorresponse.d.ts.map +1 -1
- package/dist/commonjs/models/errorresponse.js +14 -13
- package/dist/commonjs/models/errorresponse.js.map +1 -1
- package/dist/commonjs/models/operations/getmodelsuser.d.ts +25 -0
- package/dist/commonjs/models/operations/getmodelsuser.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getmodelsuser.js +29 -2
- package/dist/commonjs/models/operations/getmodelsuser.js.map +1 -1
- package/dist/commonjs/models/operations/getparametersauthorslug.d.ts +25 -0
- package/dist/commonjs/models/operations/getparametersauthorslug.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getparametersauthorslug.js +28 -1
- package/dist/commonjs/models/operations/getparametersauthorslug.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/postauthkeys.d.ts +132 -0
- package/dist/commonjs/models/operations/postauthkeys.d.ts.map +1 -0
- package/dist/commonjs/models/operations/postauthkeys.js +175 -0
- package/dist/commonjs/models/operations/postauthkeys.js.map +1 -0
- package/dist/commonjs/models/operations/postauthkeyscode.d.ts +167 -0
- package/dist/commonjs/models/operations/postauthkeyscode.d.ts.map +1 -0
- package/dist/commonjs/models/operations/postauthkeyscode.js +210 -0
- package/dist/commonjs/models/operations/postauthkeyscode.js.map +1 -0
- package/dist/commonjs/models/operations/postcreditscoinbase.d.ts +25 -0
- package/dist/commonjs/models/operations/postcreditscoinbase.d.ts.map +1 -1
- package/dist/commonjs/models/operations/postcreditscoinbase.js +28 -1
- package/dist/commonjs/models/operations/postcreditscoinbase.js.map +1 -1
- package/dist/commonjs/models/security.d.ts +0 -2
- package/dist/commonjs/models/security.d.ts.map +1 -1
- package/dist/commonjs/models/security.js +0 -2
- package/dist/commonjs/models/security.js.map +1 -1
- package/dist/commonjs/react-query/creditsPostCreditsCoinbase.d.ts +21 -0
- package/dist/commonjs/react-query/creditsPostCreditsCoinbase.d.ts.map +1 -0
- package/dist/commonjs/react-query/creditsPostCreditsCoinbase.js +44 -0
- package/dist/commonjs/react-query/creditsPostCreditsCoinbase.js.map +1 -0
- package/dist/commonjs/react-query/embeddingsGenerate.d.ts +23 -0
- package/dist/commonjs/react-query/embeddingsGenerate.d.ts.map +1 -0
- package/dist/commonjs/react-query/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +13 -13
- package/dist/commonjs/react-query/embeddingsGenerate.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +6 -4
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +6 -4
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/modelGetParametersAuthorSlug.d.ts +38 -0
- package/dist/commonjs/react-query/modelGetParametersAuthorSlug.d.ts.map +1 -0
- package/dist/commonjs/react-query/modelGetParametersAuthorSlug.js +88 -0
- package/dist/commonjs/react-query/modelGetParametersAuthorSlug.js.map +1 -0
- package/dist/commonjs/react-query/modelsGetModelsUser.d.ts +4 -4
- package/dist/commonjs/react-query/modelsGetModelsUser.d.ts.map +1 -1
- package/dist/commonjs/react-query/modelsGetModelsUser.js +8 -8
- package/dist/commonjs/react-query/modelsGetModelsUser.js.map +1 -1
- package/dist/commonjs/react-query/oAuthPostAuthKeys.d.ts +23 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeys.d.ts.map +1 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeys.js +47 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeys.js.map +1 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeysCode.d.ts +23 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeysCode.d.ts.map +1 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeysCode.js +47 -0
- package/dist/commonjs/react-query/oAuthPostAuthKeysCode.js.map +1 -0
- package/dist/commonjs/react-query/providersGetProviders.d.ts +23 -0
- package/dist/commonjs/react-query/providersGetProviders.d.ts.map +1 -0
- package/dist/commonjs/react-query/providersGetProviders.js +69 -0
- package/dist/commonjs/react-query/providersGetProviders.js.map +1 -0
- package/dist/commonjs/sdk/credits.d.ts +9 -0
- package/dist/commonjs/sdk/credits.d.ts.map +1 -0
- package/dist/commonjs/sdk/credits.js +19 -0
- package/dist/commonjs/sdk/credits.js.map +1 -0
- package/dist/commonjs/sdk/embeddings.d.ts +1 -1
- package/dist/commonjs/sdk/embeddings.d.ts.map +1 -1
- package/dist/commonjs/sdk/embeddings.js +3 -3
- package/dist/commonjs/sdk/embeddings.js.map +1 -1
- package/dist/commonjs/sdk/model.d.ts +9 -0
- package/dist/commonjs/sdk/model.d.ts.map +1 -0
- package/dist/commonjs/sdk/model.js +19 -0
- package/dist/commonjs/sdk/model.js.map +1 -0
- package/dist/commonjs/sdk/models.d.ts +1 -1
- package/dist/commonjs/sdk/models.d.ts.map +1 -1
- package/dist/commonjs/sdk/models.js +2 -2
- package/dist/commonjs/sdk/models.js.map +1 -1
- package/dist/commonjs/sdk/oauth.d.ts +19 -0
- package/dist/commonjs/sdk/oauth.d.ts.map +1 -0
- package/dist/commonjs/sdk/oauth.js +32 -0
- package/dist/commonjs/sdk/oauth.js.map +1 -0
- package/dist/commonjs/sdk/providers.d.ts +9 -0
- package/dist/commonjs/sdk/providers.d.ts.map +1 -0
- package/dist/commonjs/sdk/providers.js +19 -0
- package/dist/commonjs/sdk/providers.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +12 -8
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +15 -14
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/analyticsGetActivity.js +3 -2
- package/dist/esm/funcs/analyticsGetActivity.js.map +1 -1
- package/dist/esm/funcs/apiKeysDeleteKeysHash.js +3 -2
- package/dist/esm/funcs/apiKeysDeleteKeysHash.js.map +1 -1
- package/dist/esm/funcs/apiKeysGetAuthKey.js +3 -2
- package/dist/esm/funcs/apiKeysGetAuthKey.js.map +1 -1
- package/dist/esm/funcs/apiKeysGetKey.js +3 -2
- package/dist/esm/funcs/apiKeysGetKey.js.map +1 -1
- package/dist/esm/funcs/apiKeysGetKeys.js +3 -2
- package/dist/esm/funcs/apiKeysGetKeys.js.map +1 -1
- package/dist/esm/funcs/apiKeysGetKeysHash.js +3 -2
- package/dist/esm/funcs/apiKeysGetKeysHash.js.map +1 -1
- package/dist/esm/funcs/apiKeysPatchKeysHash.js +3 -2
- package/dist/esm/funcs/apiKeysPatchKeysHash.js.map +1 -1
- package/dist/esm/funcs/apiKeysPostKeys.js +3 -2
- package/dist/esm/funcs/apiKeysPostKeys.js.map +1 -1
- package/dist/esm/funcs/chatSend.js +3 -2
- package/dist/esm/funcs/chatSend.js.map +1 -1
- package/dist/{commonjs/funcs/postCreditsCoinbase.d.ts → esm/funcs/creditsPostCreditsCoinbase.d.ts} +2 -2
- package/dist/esm/funcs/creditsPostCreditsCoinbase.d.ts.map +1 -0
- package/dist/esm/funcs/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +14 -9
- package/dist/esm/funcs/creditsPostCreditsCoinbase.js.map +1 -0
- package/dist/esm/funcs/{embeddingsPostEmbeddings.d.ts → embeddingsGenerate.d.ts} +2 -2
- package/dist/esm/funcs/embeddingsGenerate.d.ts.map +1 -0
- package/dist/esm/funcs/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +5 -4
- package/dist/esm/funcs/embeddingsGenerate.js.map +1 -0
- package/dist/esm/funcs/endpointsGetEndpointsZdr.js +3 -2
- package/dist/esm/funcs/endpointsGetEndpointsZdr.js.map +1 -1
- package/dist/esm/funcs/endpointsGetModelsAuthorSlugEndpoints.js +3 -2
- package/dist/esm/funcs/endpointsGetModelsAuthorSlugEndpoints.js.map +1 -1
- package/dist/esm/funcs/generationsGetGeneration.js +3 -2
- package/dist/esm/funcs/generationsGetGeneration.js.map +1 -1
- package/dist/esm/funcs/getCredits.js +3 -2
- package/dist/esm/funcs/getCredits.js.map +1 -1
- package/dist/{commonjs/funcs/parametersGetParametersAuthorSlug.d.ts → esm/funcs/modelGetParametersAuthorSlug.d.ts} +2 -2
- package/dist/esm/funcs/modelGetParametersAuthorSlug.d.ts.map +1 -0
- package/dist/esm/funcs/{parametersGetParametersAuthorSlug.js → modelGetParametersAuthorSlug.js} +14 -9
- package/dist/esm/funcs/modelGetParametersAuthorSlug.js.map +1 -0
- package/dist/esm/funcs/modelsGetModels.js +3 -2
- package/dist/esm/funcs/modelsGetModels.js.map +1 -1
- package/dist/esm/funcs/modelsGetModelsCount.js +3 -2
- package/dist/esm/funcs/modelsGetModelsCount.js.map +1 -1
- package/dist/esm/funcs/modelsGetModelsUser.d.ts +1 -1
- package/dist/esm/funcs/modelsGetModelsUser.d.ts.map +1 -1
- package/dist/esm/funcs/modelsGetModelsUser.js +13 -8
- package/dist/esm/funcs/modelsGetModelsUser.js.map +1 -1
- package/dist/esm/funcs/oAuthPostAuthKeys.d.ts +17 -0
- package/dist/esm/funcs/oAuthPostAuthKeys.d.ts.map +1 -0
- package/dist/esm/funcs/oAuthPostAuthKeys.js +80 -0
- package/dist/esm/funcs/oAuthPostAuthKeys.js.map +1 -0
- package/dist/esm/funcs/oAuthPostAuthKeysCode.d.ts +17 -0
- package/dist/esm/funcs/oAuthPostAuthKeysCode.d.ts.map +1 -0
- package/dist/esm/funcs/oAuthPostAuthKeysCode.js +80 -0
- package/dist/esm/funcs/oAuthPostAuthKeysCode.js.map +1 -0
- package/dist/{commonjs/funcs/getProviders.d.ts → esm/funcs/providersGetProviders.d.ts} +5 -2
- package/dist/esm/funcs/providersGetProviders.d.ts.map +1 -0
- package/dist/esm/funcs/{getProviders.js → providersGetProviders.js} +8 -4
- package/dist/esm/funcs/providersGetProviders.js.map +1 -0
- package/dist/esm/lib/config.d.ts +4 -8
- package/dist/esm/lib/config.d.ts.map +1 -1
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/lib/env.d.ts +0 -1
- package/dist/esm/lib/env.d.ts.map +1 -1
- package/dist/esm/lib/env.js +0 -1
- package/dist/esm/lib/env.js.map +1 -1
- package/dist/esm/lib/security.d.ts.map +1 -1
- package/dist/esm/lib/security.js +1 -7
- package/dist/esm/lib/security.js.map +1 -1
- package/dist/esm/models/chaterror.d.ts +23 -2
- package/dist/esm/models/chaterror.d.ts.map +1 -1
- package/dist/esm/models/chaterror.js +24 -2
- package/dist/esm/models/chaterror.js.map +1 -1
- package/dist/esm/models/chatresponse.d.ts +2 -2
- package/dist/esm/models/chatresponse.d.ts.map +1 -1
- package/dist/esm/models/chatresponse.js +2 -2
- package/dist/esm/models/chatresponse.js.map +1 -1
- package/dist/esm/models/chatstreamingresponsechunk.d.ts +2 -2
- package/dist/esm/models/chatstreamingresponsechunk.d.ts.map +1 -1
- package/dist/esm/models/chatstreamingresponsechunk.js +2 -2
- package/dist/esm/models/chatstreamingresponsechunk.js.map +1 -1
- package/dist/esm/models/errorresponse.d.ts +8 -8
- package/dist/esm/models/errorresponse.d.ts.map +1 -1
- package/dist/esm/models/errorresponse.js +13 -12
- package/dist/esm/models/errorresponse.js.map +1 -1
- package/dist/esm/models/operations/getmodelsuser.d.ts +25 -0
- package/dist/esm/models/operations/getmodelsuser.d.ts.map +1 -1
- package/dist/esm/models/operations/getmodelsuser.js +25 -0
- package/dist/esm/models/operations/getmodelsuser.js.map +1 -1
- package/dist/esm/models/operations/getparametersauthorslug.d.ts +25 -0
- package/dist/esm/models/operations/getparametersauthorslug.d.ts.map +1 -1
- package/dist/esm/models/operations/getparametersauthorslug.js +25 -0
- package/dist/esm/models/operations/getparametersauthorslug.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/postauthkeys.d.ts +132 -0
- package/dist/esm/models/operations/postauthkeys.d.ts.map +1 -0
- package/dist/esm/models/operations/postauthkeys.js +133 -0
- package/dist/esm/models/operations/postauthkeys.js.map +1 -0
- package/dist/esm/models/operations/postauthkeyscode.d.ts +167 -0
- package/dist/esm/models/operations/postauthkeyscode.d.ts.map +1 -0
- package/dist/esm/models/operations/postauthkeyscode.js +166 -0
- package/dist/esm/models/operations/postauthkeyscode.js.map +1 -0
- package/dist/esm/models/operations/postcreditscoinbase.d.ts +25 -0
- package/dist/esm/models/operations/postcreditscoinbase.d.ts.map +1 -1
- package/dist/esm/models/operations/postcreditscoinbase.js +25 -0
- package/dist/esm/models/operations/postcreditscoinbase.js.map +1 -1
- package/dist/esm/models/security.d.ts +0 -2
- package/dist/esm/models/security.d.ts.map +1 -1
- package/dist/esm/models/security.js +0 -2
- package/dist/esm/models/security.js.map +1 -1
- package/dist/esm/react-query/creditsPostCreditsCoinbase.d.ts +21 -0
- package/dist/esm/react-query/creditsPostCreditsCoinbase.d.ts.map +1 -0
- package/dist/esm/react-query/{postCreditsCoinbase.js → creditsPostCreditsCoinbase.js} +10 -10
- package/dist/esm/react-query/creditsPostCreditsCoinbase.js.map +1 -0
- package/dist/esm/react-query/embeddingsGenerate.d.ts +23 -0
- package/dist/esm/react-query/embeddingsGenerate.d.ts.map +1 -0
- package/dist/esm/react-query/{embeddingsPostEmbeddings.js → embeddingsGenerate.js} +10 -10
- package/dist/esm/react-query/embeddingsGenerate.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +6 -4
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +6 -4
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/modelGetParametersAuthorSlug.d.ts +38 -0
- package/dist/esm/react-query/modelGetParametersAuthorSlug.d.ts.map +1 -0
- package/dist/esm/react-query/modelGetParametersAuthorSlug.js +78 -0
- package/dist/esm/react-query/modelGetParametersAuthorSlug.js.map +1 -0
- package/dist/esm/react-query/modelsGetModelsUser.d.ts +4 -4
- package/dist/esm/react-query/modelsGetModelsUser.d.ts.map +1 -1
- package/dist/esm/react-query/modelsGetModelsUser.js +8 -8
- package/dist/esm/react-query/modelsGetModelsUser.js.map +1 -1
- package/dist/esm/react-query/oAuthPostAuthKeys.d.ts +23 -0
- package/dist/esm/react-query/oAuthPostAuthKeys.d.ts.map +1 -0
- package/dist/esm/react-query/oAuthPostAuthKeys.js +42 -0
- package/dist/esm/react-query/oAuthPostAuthKeys.js.map +1 -0
- package/dist/esm/react-query/oAuthPostAuthKeysCode.d.ts +23 -0
- package/dist/esm/react-query/oAuthPostAuthKeysCode.d.ts.map +1 -0
- package/dist/esm/react-query/oAuthPostAuthKeysCode.js +42 -0
- package/dist/esm/react-query/oAuthPostAuthKeysCode.js.map +1 -0
- package/dist/esm/react-query/providersGetProviders.d.ts +23 -0
- package/dist/esm/react-query/providersGetProviders.d.ts.map +1 -0
- package/dist/esm/react-query/providersGetProviders.js +60 -0
- package/dist/esm/react-query/providersGetProviders.js.map +1 -0
- package/dist/esm/sdk/credits.d.ts +9 -0
- package/dist/esm/sdk/credits.d.ts.map +1 -0
- package/dist/esm/sdk/credits.js +15 -0
- package/dist/esm/sdk/credits.js.map +1 -0
- package/dist/esm/sdk/embeddings.d.ts +1 -1
- package/dist/esm/sdk/embeddings.d.ts.map +1 -1
- package/dist/esm/sdk/embeddings.js +3 -3
- package/dist/esm/sdk/embeddings.js.map +1 -1
- package/dist/esm/sdk/model.d.ts +9 -0
- package/dist/esm/sdk/model.d.ts.map +1 -0
- package/dist/esm/sdk/model.js +15 -0
- package/dist/esm/sdk/model.js.map +1 -0
- package/dist/esm/sdk/models.d.ts +1 -1
- package/dist/esm/sdk/models.d.ts.map +1 -1
- package/dist/esm/sdk/models.js +2 -2
- package/dist/esm/sdk/models.js.map +1 -1
- package/dist/esm/sdk/oauth.d.ts +19 -0
- package/dist/esm/sdk/oauth.d.ts.map +1 -0
- package/dist/esm/sdk/oauth.js +28 -0
- package/dist/esm/sdk/oauth.js.map +1 -0
- package/dist/esm/sdk/providers.d.ts +9 -0
- package/dist/esm/sdk/providers.d.ts.map +1 -0
- package/dist/esm/sdk/providers.js +15 -0
- package/dist/esm/sdk/providers.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +12 -8
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +15 -14
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/docs/sdks/analytics/README.md +2 -6
- package/docs/sdks/apikeys/README.md +14 -42
- package/docs/sdks/chat/README.md +2 -6
- package/docs/sdks/credits/README.md +95 -0
- package/docs/sdks/embeddings/README.md +10 -14
- package/docs/sdks/endpoints/README.md +4 -12
- package/docs/sdks/generations/README.md +2 -6
- package/docs/sdks/{parameters → model}/README.md +19 -22
- package/docs/sdks/models/README.md +13 -24
- package/docs/sdks/oauth/README.md +199 -0
- package/docs/sdks/openrouter/README.md +2 -196
- package/docs/sdks/providers/README.md +104 -0
- package/examples/chatCompletions.example.ts +95 -0
- package/examples/getCredits.example.ts +1 -3
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/analyticsGetActivity.ts +3 -2
- package/src/funcs/apiKeysDeleteKeysHash.ts +3 -2
- package/src/funcs/apiKeysGetAuthKey.ts +3 -2
- package/src/funcs/apiKeysGetKey.ts +3 -2
- package/src/funcs/apiKeysGetKeys.ts +3 -2
- package/src/funcs/apiKeysGetKeysHash.ts +3 -2
- package/src/funcs/apiKeysPatchKeysHash.ts +3 -2
- package/src/funcs/apiKeysPostKeys.ts +3 -2
- package/src/funcs/chatSend.ts +3 -2
- package/src/funcs/{postCreditsCoinbase.ts → creditsPostCreditsCoinbase.ts} +16 -6
- package/src/funcs/{embeddingsPostEmbeddings.ts → embeddingsGenerate.ts} +4 -3
- package/src/funcs/endpointsGetEndpointsZdr.ts +3 -2
- package/src/funcs/endpointsGetModelsAuthorSlugEndpoints.ts +3 -2
- package/src/funcs/generationsGetGeneration.ts +3 -2
- package/src/funcs/getCredits.ts +3 -2
- package/src/funcs/{parametersGetParametersAuthorSlug.ts → modelGetParametersAuthorSlug.ts} +16 -6
- package/src/funcs/modelsGetModels.ts +3 -2
- package/src/funcs/modelsGetModelsCount.ts +3 -2
- package/src/funcs/modelsGetModelsUser.ts +15 -5
- package/src/funcs/oAuthPostAuthKeys.ts +164 -0
- package/src/funcs/oAuthPostAuthKeysCode.ts +164 -0
- package/src/funcs/{getProviders.ts → providersGetProviders.ts} +7 -3
- package/src/lib/config.ts +4 -8
- package/src/lib/env.ts +0 -2
- package/src/lib/security.ts +1 -8
- package/src/models/chaterror.ts +44 -4
- package/src/models/chatresponse.ts +4 -4
- package/src/models/chatstreamingresponsechunk.ts +4 -4
- package/src/models/errorresponse.ts +14 -15
- package/src/models/operations/getmodelsuser.ts +58 -0
- package/src/models/operations/getparametersauthorslug.ts +60 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/postauthkeys.ts +272 -0
- package/src/models/operations/postauthkeyscode.ts +352 -0
- package/src/models/operations/postcreditscoinbase.ts +60 -0
- package/src/models/security.ts +0 -4
- package/src/react-query/{postCreditsCoinbase.ts → creditsPostCreditsCoinbase.ts} +21 -18
- package/src/react-query/{embeddingsPostEmbeddings.ts → embeddingsGenerate.ts} +18 -19
- package/src/react-query/index.ts +6 -4
- package/src/react-query/{parametersGetParametersAuthorSlug.ts → modelGetParametersAuthorSlug.ts} +37 -34
- package/src/react-query/modelsGetModelsUser.ts +8 -0
- package/src/react-query/oAuthPostAuthKeys.ts +88 -0
- package/src/react-query/oAuthPostAuthKeysCode.ts +89 -0
- package/src/react-query/{getProviders.ts → providersGetProviders.ts} +35 -27
- package/src/sdk/credits.ts +26 -0
- package/src/sdk/embeddings.ts +3 -3
- package/src/sdk/{parameters.ts → model.ts} +5 -3
- package/src/sdk/models.ts +2 -0
- package/src/sdk/oauth.ts +45 -0
- package/src/sdk/providers.ts +22 -0
- package/src/sdk/sdk.ts +22 -29
- package/dist/commonjs/funcs/embeddingsPostEmbeddings.d.ts.map +0 -1
- package/dist/commonjs/funcs/embeddingsPostEmbeddings.js.map +0 -1
- package/dist/commonjs/funcs/getProviders.d.ts.map +0 -1
- package/dist/commonjs/funcs/getProviders.js.map +0 -1
- package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.d.ts.map +0 -1
- package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.js.map +0 -1
- package/dist/commonjs/funcs/postCreditsCoinbase.d.ts.map +0 -1
- package/dist/commonjs/funcs/postCreditsCoinbase.js.map +0 -1
- package/dist/commonjs/react-query/embeddingsPostEmbeddings.d.ts +0 -23
- package/dist/commonjs/react-query/embeddingsPostEmbeddings.d.ts.map +0 -1
- package/dist/commonjs/react-query/embeddingsPostEmbeddings.js.map +0 -1
- package/dist/commonjs/react-query/getProviders.d.ts +0 -17
- package/dist/commonjs/react-query/getProviders.d.ts.map +0 -1
- package/dist/commonjs/react-query/getProviders.js +0 -63
- package/dist/commonjs/react-query/getProviders.js.map +0 -1
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts +0 -38
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts.map +0 -1
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js +0 -88
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js.map +0 -1
- package/dist/commonjs/react-query/postCreditsCoinbase.d.ts +0 -20
- package/dist/commonjs/react-query/postCreditsCoinbase.d.ts.map +0 -1
- package/dist/commonjs/react-query/postCreditsCoinbase.js +0 -44
- package/dist/commonjs/react-query/postCreditsCoinbase.js.map +0 -1
- package/dist/commonjs/sdk/parameters.d.ts +0 -9
- package/dist/commonjs/sdk/parameters.d.ts.map +0 -1
- package/dist/commonjs/sdk/parameters.js +0 -19
- package/dist/commonjs/sdk/parameters.js.map +0 -1
- package/dist/esm/funcs/embeddingsPostEmbeddings.d.ts.map +0 -1
- package/dist/esm/funcs/embeddingsPostEmbeddings.js.map +0 -1
- package/dist/esm/funcs/getProviders.d.ts.map +0 -1
- package/dist/esm/funcs/getProviders.js.map +0 -1
- package/dist/esm/funcs/parametersGetParametersAuthorSlug.d.ts.map +0 -1
- package/dist/esm/funcs/parametersGetParametersAuthorSlug.js.map +0 -1
- package/dist/esm/funcs/postCreditsCoinbase.d.ts.map +0 -1
- package/dist/esm/funcs/postCreditsCoinbase.js.map +0 -1
- package/dist/esm/react-query/embeddingsPostEmbeddings.d.ts +0 -23
- package/dist/esm/react-query/embeddingsPostEmbeddings.d.ts.map +0 -1
- package/dist/esm/react-query/embeddingsPostEmbeddings.js.map +0 -1
- package/dist/esm/react-query/getProviders.d.ts +0 -17
- package/dist/esm/react-query/getProviders.d.ts.map +0 -1
- package/dist/esm/react-query/getProviders.js +0 -54
- package/dist/esm/react-query/getProviders.js.map +0 -1
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts +0 -38
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts.map +0 -1
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.js +0 -78
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.js.map +0 -1
- package/dist/esm/react-query/postCreditsCoinbase.d.ts +0 -20
- package/dist/esm/react-query/postCreditsCoinbase.d.ts.map +0 -1
- package/dist/esm/react-query/postCreditsCoinbase.js.map +0 -1
- package/dist/esm/sdk/parameters.d.ts +0 -9
- package/dist/esm/sdk/parameters.d.ts.map +0 -1
- package/dist/esm/sdk/parameters.js +0 -15
- package/dist/esm/sdk/parameters.js.map +0 -1
- package/examples/chatCompletion.example.ts +0 -19
- package/examples/chatCompletionStream.example.ts +0 -30
- package/examples/unauthorized.example.ts +0 -19
|
@@ -10,8 +10,6 @@ OpenRouter Documentation
|
|
|
10
10
|
### Available Operations
|
|
11
11
|
|
|
12
12
|
* [getCredits](#getcredits) - Get total credits purchased and used for the authenticated user
|
|
13
|
-
* [postCreditsCoinbase](#postcreditscoinbase) - Create a Coinbase charge for crypto payment
|
|
14
|
-
* [getProviders](#getproviders)
|
|
15
13
|
|
|
16
14
|
## getCredits
|
|
17
15
|
|
|
@@ -24,9 +22,7 @@ Get total credits purchased and used for the authenticated user
|
|
|
24
22
|
import { OpenRouter } from "@openrouter/sdk";
|
|
25
23
|
|
|
26
24
|
const openRouter = new OpenRouter({
|
|
27
|
-
|
|
28
|
-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
29
|
-
},
|
|
25
|
+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
30
26
|
});
|
|
31
27
|
|
|
32
28
|
async function run() {
|
|
@@ -49,9 +45,7 @@ import { getCredits } from "@openrouter/sdk/funcs/getCredits.js";
|
|
|
49
45
|
// Use `OpenRouterCore` for best tree-shaking performance.
|
|
50
46
|
// You can create one instance of it to use across an application.
|
|
51
47
|
const openRouter = new OpenRouterCore({
|
|
52
|
-
|
|
53
|
-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
54
|
-
},
|
|
48
|
+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
55
49
|
});
|
|
56
50
|
|
|
57
51
|
async function run() {
|
|
@@ -110,192 +104,4 @@ import {
|
|
|
110
104
|
|
|
111
105
|
| Error Type | Status Code | Content Type |
|
|
112
106
|
| ----------------------------- | ----------------------------- | ----------------------------- |
|
|
113
|
-
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
|
114
|
-
|
|
115
|
-
## postCreditsCoinbase
|
|
116
|
-
|
|
117
|
-
Create a Coinbase charge for crypto payment
|
|
118
|
-
|
|
119
|
-
### Example Usage
|
|
120
|
-
|
|
121
|
-
<!-- UsageSnippet language="typescript" operationID="post_/credits/coinbase" method="post" path="/credits/coinbase" -->
|
|
122
|
-
```typescript
|
|
123
|
-
import { OpenRouter } from "@openrouter/sdk";
|
|
124
|
-
|
|
125
|
-
const openRouter = new OpenRouter({
|
|
126
|
-
security: {
|
|
127
|
-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
async function run() {
|
|
132
|
-
const result = await openRouter.postCreditsCoinbase();
|
|
133
|
-
|
|
134
|
-
console.log(result);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
run();
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Standalone function
|
|
141
|
-
|
|
142
|
-
The standalone function version of this method:
|
|
143
|
-
|
|
144
|
-
```typescript
|
|
145
|
-
import { OpenRouterCore } from "@openrouter/sdk/core.js";
|
|
146
|
-
import { postCreditsCoinbase } from "@openrouter/sdk/funcs/postCreditsCoinbase.js";
|
|
147
|
-
|
|
148
|
-
// Use `OpenRouterCore` for best tree-shaking performance.
|
|
149
|
-
// You can create one instance of it to use across an application.
|
|
150
|
-
const openRouter = new OpenRouterCore({
|
|
151
|
-
security: {
|
|
152
|
-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
153
|
-
},
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
async function run() {
|
|
157
|
-
const res = await postCreditsCoinbase(openRouter);
|
|
158
|
-
if (res.ok) {
|
|
159
|
-
const { value: result } = res;
|
|
160
|
-
console.log(result);
|
|
161
|
-
} else {
|
|
162
|
-
console.log("postCreditsCoinbase failed:", res.error);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
run();
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### React hooks and utilities
|
|
170
|
-
|
|
171
|
-
This method can be used in React components through the following hooks and
|
|
172
|
-
associated utilities.
|
|
173
|
-
|
|
174
|
-
> Check out [this guide][hook-guide] for information about each of the utilities
|
|
175
|
-
> below and how to get started using React hooks.
|
|
176
|
-
|
|
177
|
-
[hook-guide]: ../../../REACT_QUERY.md
|
|
178
|
-
|
|
179
|
-
```tsx
|
|
180
|
-
import {
|
|
181
|
-
// Mutation hook for triggering the API call.
|
|
182
|
-
usePostCreditsCoinbaseMutation
|
|
183
|
-
} from "@openrouter/sdk/react-query/postCreditsCoinbase.js";
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Parameters
|
|
187
|
-
|
|
188
|
-
| Parameter | Type | Required | Description |
|
|
189
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
190
|
-
| `request` | [operations.PostCreditsCoinbaseRequest](../../models/operations/postcreditscoinbaserequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
191
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
192
|
-
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
193
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
194
|
-
|
|
195
|
-
### Response
|
|
196
|
-
|
|
197
|
-
**Promise\<[operations.PostCreditsCoinbaseResponse](../../models/operations/postcreditscoinbaseresponse.md)\>**
|
|
198
|
-
|
|
199
|
-
### Errors
|
|
200
|
-
|
|
201
|
-
| Error Type | Status Code | Content Type |
|
|
202
|
-
| ----------------------------- | ----------------------------- | ----------------------------- |
|
|
203
|
-
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
|
204
|
-
|
|
205
|
-
## getProviders
|
|
206
|
-
|
|
207
|
-
### Example Usage
|
|
208
|
-
|
|
209
|
-
<!-- UsageSnippet language="typescript" operationID="get_/providers" method="get" path="/providers" -->
|
|
210
|
-
```typescript
|
|
211
|
-
import { OpenRouter } from "@openrouter/sdk";
|
|
212
|
-
|
|
213
|
-
const openRouter = new OpenRouter({
|
|
214
|
-
security: {
|
|
215
|
-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
216
|
-
},
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
async function run() {
|
|
220
|
-
const result = await openRouter.getProviders();
|
|
221
|
-
|
|
222
|
-
console.log(result);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
run();
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Standalone function
|
|
229
|
-
|
|
230
|
-
The standalone function version of this method:
|
|
231
|
-
|
|
232
|
-
```typescript
|
|
233
|
-
import { OpenRouterCore } from "@openrouter/sdk/core.js";
|
|
234
|
-
import { getProviders } from "@openrouter/sdk/funcs/getProviders.js";
|
|
235
|
-
|
|
236
|
-
// Use `OpenRouterCore` for best tree-shaking performance.
|
|
237
|
-
// You can create one instance of it to use across an application.
|
|
238
|
-
const openRouter = new OpenRouterCore({
|
|
239
|
-
security: {
|
|
240
|
-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
async function run() {
|
|
245
|
-
const res = await getProviders(openRouter);
|
|
246
|
-
if (res.ok) {
|
|
247
|
-
const { value: result } = res;
|
|
248
|
-
console.log(result);
|
|
249
|
-
} else {
|
|
250
|
-
console.log("getProviders failed:", res.error);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
run();
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### React hooks and utilities
|
|
258
|
-
|
|
259
|
-
This method can be used in React components through the following hooks and
|
|
260
|
-
associated utilities.
|
|
261
|
-
|
|
262
|
-
> Check out [this guide][hook-guide] for information about each of the utilities
|
|
263
|
-
> below and how to get started using React hooks.
|
|
264
|
-
|
|
265
|
-
[hook-guide]: ../../../REACT_QUERY.md
|
|
266
|
-
|
|
267
|
-
```tsx
|
|
268
|
-
import {
|
|
269
|
-
// Query hooks for fetching data.
|
|
270
|
-
useGetProviders,
|
|
271
|
-
useGetProvidersSuspense,
|
|
272
|
-
|
|
273
|
-
// Utility for prefetching data during server-side rendering and in React
|
|
274
|
-
// Server Components that will be immediately available to client components
|
|
275
|
-
// using the hooks.
|
|
276
|
-
prefetchGetProviders,
|
|
277
|
-
|
|
278
|
-
// Utility to invalidate the query cache for this query in response to
|
|
279
|
-
// mutations and other user actions.
|
|
280
|
-
invalidateAllGetProviders,
|
|
281
|
-
} from "@openrouter/sdk/react-query/getProviders.js";
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### Parameters
|
|
285
|
-
|
|
286
|
-
| Parameter | Type | Required | Description |
|
|
287
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
288
|
-
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
289
|
-
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
290
|
-
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
291
|
-
|
|
292
|
-
### Response
|
|
293
|
-
|
|
294
|
-
**Promise\<[operations.GetProvidersResponse](../../models/operations/getprovidersresponse.md)\>**
|
|
295
|
-
|
|
296
|
-
### Errors
|
|
297
|
-
|
|
298
|
-
| Error Type | Status Code | Content Type |
|
|
299
|
-
| ----------------------------- | ----------------------------- | ----------------------------- |
|
|
300
|
-
| errors.InternalServerError | 500 | application/json |
|
|
301
107
|
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Providers
|
|
2
|
+
(*providers*)
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
### Available Operations
|
|
7
|
+
|
|
8
|
+
* [getProviders](#getproviders) - List all available model providers
|
|
9
|
+
|
|
10
|
+
## getProviders
|
|
11
|
+
|
|
12
|
+
List all available model providers
|
|
13
|
+
|
|
14
|
+
### Example Usage
|
|
15
|
+
|
|
16
|
+
<!-- UsageSnippet language="typescript" operationID="get_/providers" method="get" path="/providers" -->
|
|
17
|
+
```typescript
|
|
18
|
+
import { OpenRouter } from "@openrouter/sdk";
|
|
19
|
+
|
|
20
|
+
const openRouter = new OpenRouter({
|
|
21
|
+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
async function run() {
|
|
25
|
+
const result = await openRouter.providers.getProviders();
|
|
26
|
+
|
|
27
|
+
console.log(result);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
run();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Standalone function
|
|
34
|
+
|
|
35
|
+
The standalone function version of this method:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { OpenRouterCore } from "@openrouter/sdk/core.js";
|
|
39
|
+
import { providersGetProviders } from "@openrouter/sdk/funcs/providersGetProviders.js";
|
|
40
|
+
|
|
41
|
+
// Use `OpenRouterCore` for best tree-shaking performance.
|
|
42
|
+
// You can create one instance of it to use across an application.
|
|
43
|
+
const openRouter = new OpenRouterCore({
|
|
44
|
+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
async function run() {
|
|
48
|
+
const res = await providersGetProviders(openRouter);
|
|
49
|
+
if (res.ok) {
|
|
50
|
+
const { value: result } = res;
|
|
51
|
+
console.log(result);
|
|
52
|
+
} else {
|
|
53
|
+
console.log("providersGetProviders failed:", res.error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
run();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### React hooks and utilities
|
|
61
|
+
|
|
62
|
+
This method can be used in React components through the following hooks and
|
|
63
|
+
associated utilities.
|
|
64
|
+
|
|
65
|
+
> Check out [this guide][hook-guide] for information about each of the utilities
|
|
66
|
+
> below and how to get started using React hooks.
|
|
67
|
+
|
|
68
|
+
[hook-guide]: ../../../REACT_QUERY.md
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import {
|
|
72
|
+
// Query hooks for fetching data.
|
|
73
|
+
useProvidersGetProviders,
|
|
74
|
+
useProvidersGetProvidersSuspense,
|
|
75
|
+
|
|
76
|
+
// Utility for prefetching data during server-side rendering and in React
|
|
77
|
+
// Server Components that will be immediately available to client components
|
|
78
|
+
// using the hooks.
|
|
79
|
+
prefetchProvidersGetProviders,
|
|
80
|
+
|
|
81
|
+
// Utility to invalidate the query cache for this query in response to
|
|
82
|
+
// mutations and other user actions.
|
|
83
|
+
invalidateAllProvidersGetProviders,
|
|
84
|
+
} from "@openrouter/sdk/react-query/providersGetProviders.js";
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Parameters
|
|
88
|
+
|
|
89
|
+
| Parameter | Type | Required | Description |
|
|
90
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
91
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
92
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
93
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
94
|
+
|
|
95
|
+
### Response
|
|
96
|
+
|
|
97
|
+
**Promise\<[operations.GetProvidersResponse](../../models/operations/getprovidersresponse.md)\>**
|
|
98
|
+
|
|
99
|
+
### Errors
|
|
100
|
+
|
|
101
|
+
| Error Type | Status Code | Content Type |
|
|
102
|
+
| ----------------------------- | ----------------------------- | ----------------------------- |
|
|
103
|
+
| errors.InternalServerError | 500 | application/json |
|
|
104
|
+
| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import dotenv from "dotenv";
|
|
6
|
+
dotenv.config();
|
|
7
|
+
/**
|
|
8
|
+
* Example usage of the @openrouter/sdk SDK for chat completions
|
|
9
|
+
*
|
|
10
|
+
* To run this example from the examples directory with Bun:
|
|
11
|
+
* bun run chatCompletions.example.ts
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { OpenRouter } from "@openrouter/sdk";
|
|
15
|
+
import type { EventStream } from "@openrouter/sdk/lib/event-streams.js";
|
|
16
|
+
import type { ChatStreamingResponseChunk } from "@openrouter/sdk/models/index.js";
|
|
17
|
+
|
|
18
|
+
if (!process.env["OPENROUTER_API_KEY"]) {
|
|
19
|
+
throw new Error("Missing OPENROUTER_API_KEY environment variable");
|
|
20
|
+
}
|
|
21
|
+
const openRouter = new OpenRouter({
|
|
22
|
+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
23
|
+
debugLogger: console
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
async function nonStreamingExample() {
|
|
27
|
+
console.log("=== Non-Streaming Example ===\n");
|
|
28
|
+
|
|
29
|
+
const result = await openRouter.chat.send({
|
|
30
|
+
model: "qwen/qwen3-max",
|
|
31
|
+
messages: [
|
|
32
|
+
{
|
|
33
|
+
role: "user",
|
|
34
|
+
content: "Tell me a short joke about programming",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
stream: false,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if ("choices" in result) {
|
|
41
|
+
console.log("Model:", result.model);
|
|
42
|
+
console.log("Response:", result.choices[0].message.content);
|
|
43
|
+
console.log("Usage:", result.usage);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function streamingExample() {
|
|
48
|
+
console.log("\n=== Streaming Example ===\n");
|
|
49
|
+
|
|
50
|
+
const result = await openRouter.chat.send({
|
|
51
|
+
model: "qwen/qwen3-max",
|
|
52
|
+
messages: [
|
|
53
|
+
{
|
|
54
|
+
role: "user",
|
|
55
|
+
content: "Write a haiku about TypeScript",
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
stream: true,
|
|
59
|
+
streamOptions: {
|
|
60
|
+
includeUsage: true,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (result && typeof result === "object" && Symbol.asyncIterator in result) {
|
|
65
|
+
const stream = result as EventStream<ChatStreamingResponseChunk>;
|
|
66
|
+
|
|
67
|
+
console.log("Streaming response:");
|
|
68
|
+
let fullContent = "";
|
|
69
|
+
|
|
70
|
+
for await (const chunk of stream) {
|
|
71
|
+
if (chunk.data.choices && chunk.data.choices[0]?.delta?.content) {
|
|
72
|
+
const content = chunk.data.choices[0].delta.content;
|
|
73
|
+
process.stdout.write(content);
|
|
74
|
+
fullContent += content;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (chunk.data.usage) {
|
|
78
|
+
console.log("\n\nStream usage:", chunk.data.usage);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log("\n\nFull response:", fullContent);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function main() {
|
|
87
|
+
try {
|
|
88
|
+
await nonStreamingExample();
|
|
89
|
+
await streamingExample();
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error("Error:", error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
main();
|
|
@@ -14,9 +14,7 @@ dotenv.config();
|
|
|
14
14
|
import { OpenRouter } from "@openrouter/sdk";
|
|
15
15
|
|
|
16
16
|
const openRouter = new OpenRouter({
|
|
17
|
-
|
|
18
|
-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
19
|
-
},
|
|
17
|
+
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
20
18
|
});
|
|
21
19
|
|
|
22
20
|
async function main() {
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -96,7 +96,8 @@ async function $do(
|
|
|
96
96
|
Accept: "application/json",
|
|
97
97
|
}));
|
|
98
98
|
|
|
99
|
-
const
|
|
99
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
100
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
100
101
|
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
101
102
|
|
|
102
103
|
const context = {
|
|
@@ -107,7 +108,7 @@ async function $do(
|
|
|
107
108
|
|
|
108
109
|
resolvedSecurity: requestSecurity,
|
|
109
110
|
|
|
110
|
-
securitySource: client._options.
|
|
111
|
+
securitySource: client._options.apiKey,
|
|
111
112
|
retryConfig: options?.retries
|
|
112
113
|
|| client._options.retryConfig
|
|
113
114
|
|| { strategy: "none" },
|
|
@@ -95,7 +95,8 @@ async function $do(
|
|
|
95
95
|
Accept: "application/json",
|
|
96
96
|
}));
|
|
97
97
|
|
|
98
|
-
const
|
|
98
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
99
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
99
100
|
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
100
101
|
|
|
101
102
|
const context = {
|
|
@@ -106,7 +107,7 @@ async function $do(
|
|
|
106
107
|
|
|
107
108
|
resolvedSecurity: requestSecurity,
|
|
108
109
|
|
|
109
|
-
securitySource: client._options.
|
|
110
|
+
securitySource: client._options.apiKey,
|
|
110
111
|
retryConfig: options?.retries
|
|
111
112
|
|| client._options.retryConfig
|
|
112
113
|
|| { strategy: "none" },
|
|
@@ -75,7 +75,8 @@ async function $do(
|
|
|
75
75
|
Accept: "application/json",
|
|
76
76
|
}));
|
|
77
77
|
|
|
78
|
-
const
|
|
78
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
79
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
79
80
|
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
80
81
|
|
|
81
82
|
const context = {
|
|
@@ -86,7 +87,7 @@ async function $do(
|
|
|
86
87
|
|
|
87
88
|
resolvedSecurity: requestSecurity,
|
|
88
89
|
|
|
89
|
-
securitySource: client._options.
|
|
90
|
+
securitySource: client._options.apiKey,
|
|
90
91
|
retryConfig: options?.retries
|
|
91
92
|
|| client._options.retryConfig
|
|
92
93
|
|| { strategy: "none" },
|
|
@@ -75,7 +75,8 @@ async function $do(
|
|
|
75
75
|
Accept: "application/json",
|
|
76
76
|
}));
|
|
77
77
|
|
|
78
|
-
const
|
|
78
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
79
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
79
80
|
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
80
81
|
|
|
81
82
|
const context = {
|
|
@@ -86,7 +87,7 @@ async function $do(
|
|
|
86
87
|
|
|
87
88
|
resolvedSecurity: requestSecurity,
|
|
88
89
|
|
|
89
|
-
securitySource: client._options.
|
|
90
|
+
securitySource: client._options.apiKey,
|
|
90
91
|
retryConfig: options?.retries
|
|
91
92
|
|| client._options.retryConfig
|
|
92
93
|
|| { strategy: "none" },
|
|
@@ -93,7 +93,8 @@ async function $do(
|
|
|
93
93
|
Accept: "application/json",
|
|
94
94
|
}));
|
|
95
95
|
|
|
96
|
-
const
|
|
96
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
97
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
97
98
|
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
98
99
|
|
|
99
100
|
const context = {
|
|
@@ -104,7 +105,7 @@ async function $do(
|
|
|
104
105
|
|
|
105
106
|
resolvedSecurity: requestSecurity,
|
|
106
107
|
|
|
107
|
-
securitySource: client._options.
|
|
108
|
+
securitySource: client._options.apiKey,
|
|
108
109
|
retryConfig: options?.retries
|
|
109
110
|
|| client._options.retryConfig
|
|
110
111
|
|| { strategy: "none" },
|
|
@@ -95,7 +95,8 @@ async function $do(
|
|
|
95
95
|
Accept: "application/json",
|
|
96
96
|
}));
|
|
97
97
|
|
|
98
|
-
const
|
|
98
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
99
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
99
100
|
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
100
101
|
|
|
101
102
|
const context = {
|
|
@@ -106,7 +107,7 @@ async function $do(
|
|
|
106
107
|
|
|
107
108
|
resolvedSecurity: requestSecurity,
|
|
108
109
|
|
|
109
|
-
securitySource: client._options.
|
|
110
|
+
securitySource: client._options.apiKey,
|
|
110
111
|
retryConfig: options?.retries
|
|
111
112
|
|| client._options.retryConfig
|
|
112
113
|
|| { strategy: "none" },
|
|
@@ -96,7 +96,8 @@ async function $do(
|
|
|
96
96
|
Accept: "application/json",
|
|
97
97
|
}));
|
|
98
98
|
|
|
99
|
-
const
|
|
99
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
100
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
100
101
|
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
101
102
|
|
|
102
103
|
const context = {
|
|
@@ -107,7 +108,7 @@ async function $do(
|
|
|
107
108
|
|
|
108
109
|
resolvedSecurity: requestSecurity,
|
|
109
110
|
|
|
110
|
-
securitySource: client._options.
|
|
111
|
+
securitySource: client._options.apiKey,
|
|
111
112
|
retryConfig: options?.retries
|
|
112
113
|
|| client._options.retryConfig
|
|
113
114
|
|| { strategy: "none" },
|
|
@@ -92,7 +92,8 @@ async function $do(
|
|
|
92
92
|
Accept: "application/json",
|
|
93
93
|
}));
|
|
94
94
|
|
|
95
|
-
const
|
|
95
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
96
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
96
97
|
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
97
98
|
|
|
98
99
|
const context = {
|
|
@@ -103,7 +104,7 @@ async function $do(
|
|
|
103
104
|
|
|
104
105
|
resolvedSecurity: requestSecurity,
|
|
105
106
|
|
|
106
|
-
securitySource: client._options.
|
|
107
|
+
securitySource: client._options.apiKey,
|
|
107
108
|
retryConfig: options?.retries
|
|
108
109
|
|| client._options.retryConfig
|
|
109
110
|
|| { strategy: "none" },
|
package/src/funcs/chatSend.ts
CHANGED
|
@@ -105,7 +105,8 @@ async function $do(
|
|
|
105
105
|
|| "application/json;q=1, text/event-stream;q=0",
|
|
106
106
|
}));
|
|
107
107
|
|
|
108
|
-
const
|
|
108
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
109
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
109
110
|
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
110
111
|
|
|
111
112
|
const context = {
|
|
@@ -116,7 +117,7 @@ async function $do(
|
|
|
116
117
|
|
|
117
118
|
resolvedSecurity: requestSecurity,
|
|
118
119
|
|
|
119
|
-
securitySource: client._options.
|
|
120
|
+
securitySource: client._options.apiKey,
|
|
120
121
|
retryConfig: options?.retries
|
|
121
122
|
|| client._options.retryConfig
|
|
122
123
|
|| { strategy: "none" },
|