@openrouter/sdk 0.0.0-beta.2 → 0.0.0-beta.4
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 +6 -10
- package/README.md +31 -24
- 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/commonjs/funcs/embeddingsPostEmbeddings.js +3 -2
- package/dist/commonjs/funcs/embeddingsPostEmbeddings.js.map +1 -1
- 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/commonjs/funcs/getProviders.js +3 -2
- package/dist/commonjs/funcs/getProviders.js.map +1 -1
- 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/parametersGetParametersAuthorSlug.d.ts +1 -1
- package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.d.ts.map +1 -1
- package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.js +12 -7
- package/dist/commonjs/funcs/parametersGetParametersAuthorSlug.js.map +1 -1
- package/dist/commonjs/funcs/postCreditsCoinbase.d.ts +1 -1
- package/dist/commonjs/funcs/postCreditsCoinbase.d.ts.map +1 -1
- package/dist/commonjs/funcs/postCreditsCoinbase.js +12 -7
- package/dist/commonjs/funcs/postCreditsCoinbase.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -7
- package/dist/commonjs/lib/config.d.ts.map +1 -1
- package/dist/commonjs/lib/config.js +2 -2
- 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/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/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/parametersGetParametersAuthorSlug.d.ts +4 -4
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.d.ts.map +1 -1
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js +8 -8
- package/dist/commonjs/react-query/parametersGetParametersAuthorSlug.js.map +1 -1
- package/dist/commonjs/react-query/postCreditsCoinbase.d.ts +1 -0
- package/dist/commonjs/react-query/postCreditsCoinbase.d.ts.map +1 -1
- package/dist/commonjs/react-query/postCreditsCoinbase.js +2 -2
- package/dist/commonjs/react-query/postCreditsCoinbase.js.map +1 -1
- 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/parameters.d.ts +1 -1
- package/dist/commonjs/sdk/parameters.d.ts.map +1 -1
- package/dist/commonjs/sdk/parameters.js +2 -2
- package/dist/commonjs/sdk/parameters.js.map +1 -1
- package/dist/commonjs/sdk/sdk.d.ts +1 -1
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +2 -2
- 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/esm/funcs/embeddingsPostEmbeddings.js +3 -2
- package/dist/esm/funcs/embeddingsPostEmbeddings.js.map +1 -1
- 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/esm/funcs/getProviders.js +3 -2
- package/dist/esm/funcs/getProviders.js.map +1 -1
- 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/parametersGetParametersAuthorSlug.d.ts +1 -1
- package/dist/esm/funcs/parametersGetParametersAuthorSlug.d.ts.map +1 -1
- package/dist/esm/funcs/parametersGetParametersAuthorSlug.js +13 -8
- package/dist/esm/funcs/parametersGetParametersAuthorSlug.js.map +1 -1
- package/dist/esm/funcs/postCreditsCoinbase.d.ts +1 -1
- package/dist/esm/funcs/postCreditsCoinbase.d.ts.map +1 -1
- package/dist/esm/funcs/postCreditsCoinbase.js +13 -8
- package/dist/esm/funcs/postCreditsCoinbase.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -7
- package/dist/esm/lib/config.d.ts.map +1 -1
- package/dist/esm/lib/config.js +2 -2
- 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/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/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/parametersGetParametersAuthorSlug.d.ts +4 -4
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.d.ts.map +1 -1
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.js +8 -8
- package/dist/esm/react-query/parametersGetParametersAuthorSlug.js.map +1 -1
- package/dist/esm/react-query/postCreditsCoinbase.d.ts +1 -0
- package/dist/esm/react-query/postCreditsCoinbase.d.ts.map +1 -1
- package/dist/esm/react-query/postCreditsCoinbase.js +2 -2
- package/dist/esm/react-query/postCreditsCoinbase.js.map +1 -1
- 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/parameters.d.ts +1 -1
- package/dist/esm/sdk/parameters.d.ts.map +1 -1
- package/dist/esm/sdk/parameters.js +2 -2
- package/dist/esm/sdk/parameters.js.map +1 -1
- package/dist/esm/sdk/sdk.d.ts +1 -1
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +2 -2
- 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/embeddings/README.md +2 -6
- package/docs/sdks/endpoints/README.md +4 -12
- package/docs/sdks/generations/README.md +2 -6
- package/docs/sdks/models/README.md +13 -24
- package/docs/sdks/openrouter/README.md +13 -24
- package/docs/sdks/parameters/README.md +7 -10
- 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/embeddingsPostEmbeddings.ts +3 -2
- 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/getProviders.ts +3 -2
- package/src/funcs/modelsGetModels.ts +3 -2
- package/src/funcs/modelsGetModelsCount.ts +3 -2
- package/src/funcs/modelsGetModelsUser.ts +15 -5
- package/src/funcs/parametersGetParametersAuthorSlug.ts +15 -5
- package/src/funcs/postCreditsCoinbase.ts +15 -5
- package/src/lib/config.ts +3 -7
- 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/postcreditscoinbase.ts +60 -0
- package/src/models/security.ts +0 -4
- package/src/react-query/modelsGetModelsUser.ts +8 -0
- package/src/react-query/parametersGetParametersAuthorSlug.ts +8 -0
- package/src/react-query/postCreditsCoinbase.ts +3 -0
- package/src/sdk/models.ts +2 -0
- package/src/sdk/parameters.ts +2 -0
- package/src/sdk/sdk.ts +2 -0
- package/examples/chatCompletion.example.ts +0 -19
- package/examples/chatCompletionStream.example.ts +0 -30
- package/examples/unauthorized.example.ts +0 -19
|
@@ -10,6 +10,10 @@ import { Result as SafeParseResult } from "../../types/fp.js";
|
|
|
10
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
11
|
import * as models from "../index.js";
|
|
12
12
|
|
|
13
|
+
export type PostCreditsCoinbaseSecurity = {
|
|
14
|
+
bearer: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
13
17
|
export const ChainId = {
|
|
14
18
|
One: 1,
|
|
15
19
|
OneHundredAndThirtySeven: 137,
|
|
@@ -69,6 +73,62 @@ export type PostCreditsCoinbaseResponse =
|
|
|
69
73
|
| PostCreditsCoinbaseResponseBody
|
|
70
74
|
| models.ErrorResponse;
|
|
71
75
|
|
|
76
|
+
/** @internal */
|
|
77
|
+
export const PostCreditsCoinbaseSecurity$inboundSchema: z.ZodType<
|
|
78
|
+
PostCreditsCoinbaseSecurity,
|
|
79
|
+
z.ZodTypeDef,
|
|
80
|
+
unknown
|
|
81
|
+
> = z.object({
|
|
82
|
+
bearer: z.string(),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
/** @internal */
|
|
86
|
+
export type PostCreditsCoinbaseSecurity$Outbound = {
|
|
87
|
+
bearer: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/** @internal */
|
|
91
|
+
export const PostCreditsCoinbaseSecurity$outboundSchema: z.ZodType<
|
|
92
|
+
PostCreditsCoinbaseSecurity$Outbound,
|
|
93
|
+
z.ZodTypeDef,
|
|
94
|
+
PostCreditsCoinbaseSecurity
|
|
95
|
+
> = z.object({
|
|
96
|
+
bearer: z.string(),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @internal
|
|
101
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
102
|
+
*/
|
|
103
|
+
export namespace PostCreditsCoinbaseSecurity$ {
|
|
104
|
+
/** @deprecated use `PostCreditsCoinbaseSecurity$inboundSchema` instead. */
|
|
105
|
+
export const inboundSchema = PostCreditsCoinbaseSecurity$inboundSchema;
|
|
106
|
+
/** @deprecated use `PostCreditsCoinbaseSecurity$outboundSchema` instead. */
|
|
107
|
+
export const outboundSchema = PostCreditsCoinbaseSecurity$outboundSchema;
|
|
108
|
+
/** @deprecated use `PostCreditsCoinbaseSecurity$Outbound` instead. */
|
|
109
|
+
export type Outbound = PostCreditsCoinbaseSecurity$Outbound;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function postCreditsCoinbaseSecurityToJSON(
|
|
113
|
+
postCreditsCoinbaseSecurity: PostCreditsCoinbaseSecurity,
|
|
114
|
+
): string {
|
|
115
|
+
return JSON.stringify(
|
|
116
|
+
PostCreditsCoinbaseSecurity$outboundSchema.parse(
|
|
117
|
+
postCreditsCoinbaseSecurity,
|
|
118
|
+
),
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function postCreditsCoinbaseSecurityFromJSON(
|
|
123
|
+
jsonString: string,
|
|
124
|
+
): SafeParseResult<PostCreditsCoinbaseSecurity, SDKValidationError> {
|
|
125
|
+
return safeParse(
|
|
126
|
+
jsonString,
|
|
127
|
+
(x) => PostCreditsCoinbaseSecurity$inboundSchema.parse(JSON.parse(x)),
|
|
128
|
+
`Failed to parse 'PostCreditsCoinbaseSecurity' from JSON`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
72
132
|
/** @internal */
|
|
73
133
|
export const ChainId$inboundSchema: z.ZodNativeEnum<typeof ChainId> = z
|
|
74
134
|
.nativeEnum(ChainId);
|
package/src/models/security.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
|
9
9
|
|
|
10
10
|
export type Security = {
|
|
11
11
|
apiKey?: string | undefined;
|
|
12
|
-
bearer?: string | undefined;
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
/** @internal */
|
|
@@ -19,13 +18,11 @@ export const Security$inboundSchema: z.ZodType<
|
|
|
19
18
|
unknown
|
|
20
19
|
> = z.object({
|
|
21
20
|
apiKey: z.string().optional(),
|
|
22
|
-
bearer: z.string().optional(),
|
|
23
21
|
});
|
|
24
22
|
|
|
25
23
|
/** @internal */
|
|
26
24
|
export type Security$Outbound = {
|
|
27
25
|
apiKey?: string | undefined;
|
|
28
|
-
bearer?: string | undefined;
|
|
29
26
|
};
|
|
30
27
|
|
|
31
28
|
/** @internal */
|
|
@@ -35,7 +32,6 @@ export const Security$outboundSchema: z.ZodType<
|
|
|
35
32
|
Security
|
|
36
33
|
> = z.object({
|
|
37
34
|
apiKey: z.string().optional(),
|
|
38
|
-
bearer: z.string().optional(),
|
|
39
35
|
});
|
|
40
36
|
|
|
41
37
|
/**
|
|
@@ -27,12 +27,14 @@ export type ModelsGetModelsUserQueryData = operations.GetModelsUserResponse;
|
|
|
27
27
|
* List models filtered by user provider preferences
|
|
28
28
|
*/
|
|
29
29
|
export function useModelsGetModelsUser(
|
|
30
|
+
security: operations.GetModelsUserSecurity,
|
|
30
31
|
options?: QueryHookOptions<ModelsGetModelsUserQueryData>,
|
|
31
32
|
): UseQueryResult<ModelsGetModelsUserQueryData, Error> {
|
|
32
33
|
const client = useOpenRouterContext();
|
|
33
34
|
return useQuery({
|
|
34
35
|
...buildModelsGetModelsUserQuery(
|
|
35
36
|
client,
|
|
37
|
+
security,
|
|
36
38
|
options,
|
|
37
39
|
),
|
|
38
40
|
...options,
|
|
@@ -43,12 +45,14 @@ export function useModelsGetModelsUser(
|
|
|
43
45
|
* List models filtered by user provider preferences
|
|
44
46
|
*/
|
|
45
47
|
export function useModelsGetModelsUserSuspense(
|
|
48
|
+
security: operations.GetModelsUserSecurity,
|
|
46
49
|
options?: SuspenseQueryHookOptions<ModelsGetModelsUserQueryData>,
|
|
47
50
|
): UseSuspenseQueryResult<ModelsGetModelsUserQueryData, Error> {
|
|
48
51
|
const client = useOpenRouterContext();
|
|
49
52
|
return useSuspenseQuery({
|
|
50
53
|
...buildModelsGetModelsUserQuery(
|
|
51
54
|
client,
|
|
55
|
+
security,
|
|
52
56
|
options,
|
|
53
57
|
),
|
|
54
58
|
...options,
|
|
@@ -58,10 +62,12 @@ export function useModelsGetModelsUserSuspense(
|
|
|
58
62
|
export function prefetchModelsGetModelsUser(
|
|
59
63
|
queryClient: QueryClient,
|
|
60
64
|
client$: OpenRouterCore,
|
|
65
|
+
security: operations.GetModelsUserSecurity,
|
|
61
66
|
): Promise<void> {
|
|
62
67
|
return queryClient.prefetchQuery({
|
|
63
68
|
...buildModelsGetModelsUserQuery(
|
|
64
69
|
client$,
|
|
70
|
+
security,
|
|
65
71
|
),
|
|
66
72
|
});
|
|
67
73
|
}
|
|
@@ -87,6 +93,7 @@ export function invalidateAllModelsGetModelsUser(
|
|
|
87
93
|
|
|
88
94
|
export function buildModelsGetModelsUserQuery(
|
|
89
95
|
client$: OpenRouterCore,
|
|
96
|
+
security: operations.GetModelsUserSecurity,
|
|
90
97
|
options?: RequestOptions,
|
|
91
98
|
): {
|
|
92
99
|
queryKey: QueryKey;
|
|
@@ -107,6 +114,7 @@ export function buildModelsGetModelsUserQuery(
|
|
|
107
114
|
|
|
108
115
|
return unwrapAsync(modelsGetModelsUser(
|
|
109
116
|
client$,
|
|
117
|
+
security,
|
|
110
118
|
mergedOptions,
|
|
111
119
|
));
|
|
112
120
|
},
|
|
@@ -32,6 +32,7 @@ export type ParametersGetParametersAuthorSlugQueryData =
|
|
|
32
32
|
* Get a model's supported parameters and data about which are most popular
|
|
33
33
|
*/
|
|
34
34
|
export function useParametersGetParametersAuthorSlug(
|
|
35
|
+
security: operations.GetParametersAuthorSlugSecurity,
|
|
35
36
|
request: operations.GetParametersAuthorSlugRequest,
|
|
36
37
|
options?: QueryHookOptions<ParametersGetParametersAuthorSlugQueryData>,
|
|
37
38
|
): UseQueryResult<ParametersGetParametersAuthorSlugQueryData, Error> {
|
|
@@ -39,6 +40,7 @@ export function useParametersGetParametersAuthorSlug(
|
|
|
39
40
|
return useQuery({
|
|
40
41
|
...buildParametersGetParametersAuthorSlugQuery(
|
|
41
42
|
client,
|
|
43
|
+
security,
|
|
42
44
|
request,
|
|
43
45
|
options,
|
|
44
46
|
),
|
|
@@ -50,6 +52,7 @@ export function useParametersGetParametersAuthorSlug(
|
|
|
50
52
|
* Get a model's supported parameters and data about which are most popular
|
|
51
53
|
*/
|
|
52
54
|
export function useParametersGetParametersAuthorSlugSuspense(
|
|
55
|
+
security: operations.GetParametersAuthorSlugSecurity,
|
|
53
56
|
request: operations.GetParametersAuthorSlugRequest,
|
|
54
57
|
options?: SuspenseQueryHookOptions<
|
|
55
58
|
ParametersGetParametersAuthorSlugQueryData
|
|
@@ -59,6 +62,7 @@ export function useParametersGetParametersAuthorSlugSuspense(
|
|
|
59
62
|
return useSuspenseQuery({
|
|
60
63
|
...buildParametersGetParametersAuthorSlugQuery(
|
|
61
64
|
client,
|
|
65
|
+
security,
|
|
62
66
|
request,
|
|
63
67
|
options,
|
|
64
68
|
),
|
|
@@ -69,11 +73,13 @@ export function useParametersGetParametersAuthorSlugSuspense(
|
|
|
69
73
|
export function prefetchParametersGetParametersAuthorSlug(
|
|
70
74
|
queryClient: QueryClient,
|
|
71
75
|
client$: OpenRouterCore,
|
|
76
|
+
security: operations.GetParametersAuthorSlugSecurity,
|
|
72
77
|
request: operations.GetParametersAuthorSlugRequest,
|
|
73
78
|
): Promise<void> {
|
|
74
79
|
return queryClient.prefetchQuery({
|
|
75
80
|
...buildParametersGetParametersAuthorSlugQuery(
|
|
76
81
|
client$,
|
|
82
|
+
security,
|
|
77
83
|
request,
|
|
78
84
|
),
|
|
79
85
|
});
|
|
@@ -134,6 +140,7 @@ export function invalidateAllParametersGetParametersAuthorSlug(
|
|
|
134
140
|
|
|
135
141
|
export function buildParametersGetParametersAuthorSlugQuery(
|
|
136
142
|
client$: OpenRouterCore,
|
|
143
|
+
security: operations.GetParametersAuthorSlugSecurity,
|
|
137
144
|
request: operations.GetParametersAuthorSlugRequest,
|
|
138
145
|
options?: RequestOptions,
|
|
139
146
|
): {
|
|
@@ -159,6 +166,7 @@ export function buildParametersGetParametersAuthorSlugQuery(
|
|
|
159
166
|
|
|
160
167
|
return unwrapAsync(parametersGetParametersAuthorSlug(
|
|
161
168
|
client$,
|
|
169
|
+
security,
|
|
162
170
|
request,
|
|
163
171
|
mergedOptions,
|
|
164
172
|
));
|
|
@@ -17,6 +17,7 @@ import { useOpenRouterContext } from "./_context.js";
|
|
|
17
17
|
import { MutationHookOptions } from "./_types.js";
|
|
18
18
|
|
|
19
19
|
export type PostCreditsCoinbaseMutationVariables = {
|
|
20
|
+
security: operations.PostCreditsCoinbaseSecurity;
|
|
20
21
|
request?: operations.PostCreditsCoinbaseRequest | undefined;
|
|
21
22
|
options?: RequestOptions;
|
|
22
23
|
};
|
|
@@ -61,6 +62,7 @@ export function buildPostCreditsCoinbaseMutation(
|
|
|
61
62
|
return {
|
|
62
63
|
mutationKey: mutationKeyPostCreditsCoinbase(),
|
|
63
64
|
mutationFn: function postCreditsCoinbaseMutationFn({
|
|
65
|
+
security,
|
|
64
66
|
request,
|
|
65
67
|
options,
|
|
66
68
|
}): Promise<PostCreditsCoinbaseMutationData> {
|
|
@@ -78,6 +80,7 @@ export function buildPostCreditsCoinbaseMutation(
|
|
|
78
80
|
};
|
|
79
81
|
return unwrapAsync(postCreditsCoinbase(
|
|
80
82
|
client$,
|
|
83
|
+
security,
|
|
81
84
|
request,
|
|
82
85
|
mergedOptions,
|
|
83
86
|
));
|
package/src/sdk/models.ts
CHANGED
|
@@ -45,10 +45,12 @@ export class Models extends ClientSDK {
|
|
|
45
45
|
* List models filtered by user provider preferences
|
|
46
46
|
*/
|
|
47
47
|
async getModelsUser(
|
|
48
|
+
security: operations.GetModelsUserSecurity,
|
|
48
49
|
options?: RequestOptions,
|
|
49
50
|
): Promise<operations.GetModelsUserResponse> {
|
|
50
51
|
return unwrapAsync(modelsGetModelsUser(
|
|
51
52
|
this,
|
|
53
|
+
security,
|
|
52
54
|
options,
|
|
53
55
|
));
|
|
54
56
|
}
|
package/src/sdk/parameters.ts
CHANGED
|
@@ -12,11 +12,13 @@ export class ParametersT extends ClientSDK {
|
|
|
12
12
|
* Get a model's supported parameters and data about which are most popular
|
|
13
13
|
*/
|
|
14
14
|
async getParametersAuthorSlug(
|
|
15
|
+
security: operations.GetParametersAuthorSlugSecurity,
|
|
15
16
|
request: operations.GetParametersAuthorSlugRequest,
|
|
16
17
|
options?: RequestOptions,
|
|
17
18
|
): Promise<operations.GetParametersAuthorSlugResponse> {
|
|
18
19
|
return unwrapAsync(parametersGetParametersAuthorSlug(
|
|
19
20
|
this,
|
|
21
|
+
security,
|
|
20
22
|
request,
|
|
21
23
|
options,
|
|
22
24
|
));
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -74,11 +74,13 @@ export class OpenRouter extends ClientSDK {
|
|
|
74
74
|
* Create a Coinbase charge for crypto payment
|
|
75
75
|
*/
|
|
76
76
|
async postCreditsCoinbase(
|
|
77
|
+
security: operations.PostCreditsCoinbaseSecurity,
|
|
77
78
|
request?: operations.PostCreditsCoinbaseRequest | undefined,
|
|
78
79
|
options?: RequestOptions,
|
|
79
80
|
): Promise<operations.PostCreditsCoinbaseResponse> {
|
|
80
81
|
return unwrapAsync(postCreditsCoinbase(
|
|
81
82
|
this,
|
|
83
|
+
security,
|
|
82
84
|
request,
|
|
83
85
|
options,
|
|
84
86
|
));
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import dotenv from "dotenv";
|
|
2
|
-
dotenv.config();
|
|
3
|
-
import { OpenRouter } from "open-router";
|
|
4
|
-
const openRouter = new OpenRouter({
|
|
5
|
-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
6
|
-
});
|
|
7
|
-
async function main() {
|
|
8
|
-
const result = await openRouter.chat.complete({
|
|
9
|
-
model: "openai/gpt-3.5-turbo",
|
|
10
|
-
messages: [
|
|
11
|
-
{
|
|
12
|
-
role: "user",
|
|
13
|
-
content: "Hello, how are you?",
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
});
|
|
17
|
-
console.log(result);
|
|
18
|
-
}
|
|
19
|
-
main()
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import dotenv from "dotenv";
|
|
2
|
-
dotenv.config();
|
|
3
|
-
|
|
4
|
-
import { OpenRouter } from "open-router";
|
|
5
|
-
|
|
6
|
-
const openRouter = new OpenRouter({
|
|
7
|
-
apiKey: process.env["OPENROUTER_API_KEY"] ?? "",
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
async function main() {
|
|
11
|
-
const result = await openRouter.chat.complete({
|
|
12
|
-
model: "openai/gpt-3.5-turbo",
|
|
13
|
-
stream: true,
|
|
14
|
-
messages: [
|
|
15
|
-
{
|
|
16
|
-
role: "user",
|
|
17
|
-
content: "Hello, how are you?",
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
for await (const chunk of result) {
|
|
23
|
-
if (chunk.data?.choices?.[0]?.delta?.content) {
|
|
24
|
-
process.stdout.write(chunk.data.choices[0].delta.content);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
console.log("\n\nStreaming completed");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
main()
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import dotenv from "dotenv";
|
|
2
|
-
dotenv.config();
|
|
3
|
-
import { OpenRouter } from "open-router";
|
|
4
|
-
const openRouter = new OpenRouter({
|
|
5
|
-
apiKey: "",
|
|
6
|
-
});
|
|
7
|
-
async function main() {
|
|
8
|
-
const result = await openRouter.chat.complete({
|
|
9
|
-
model: "openai/gpt-3.5-turbo",
|
|
10
|
-
messages: [
|
|
11
|
-
{
|
|
12
|
-
role: "user",
|
|
13
|
-
content: "Hello, how are you?",
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
});
|
|
17
|
-
console.log(result);
|
|
18
|
-
}
|
|
19
|
-
main()
|