@openrouter/sdk 0.1.17 → 0.1.23

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.
Files changed (80) hide show
  1. package/README.md +0 -8
  2. package/esm/funcs/callModel.d.ts +77 -0
  3. package/esm/funcs/callModel.js +100 -0
  4. package/esm/lib/config.d.ts +10 -2
  5. package/esm/lib/config.js +2 -2
  6. package/esm/lib/env.d.ts +13 -0
  7. package/esm/lib/env.js +16 -0
  8. package/esm/lib/response-wrapper.d.ts +116 -0
  9. package/esm/lib/response-wrapper.js +459 -0
  10. package/esm/lib/reusable-stream.d.ts +39 -0
  11. package/esm/lib/reusable-stream.js +173 -0
  12. package/esm/lib/sdks.js +2 -2
  13. package/esm/lib/stream-transformers.d.ts +47 -0
  14. package/esm/lib/stream-transformers.js +280 -0
  15. package/esm/lib/tool-executor.d.ts +53 -0
  16. package/esm/lib/tool-executor.js +181 -0
  17. package/esm/lib/tool-orchestrator.d.ts +50 -0
  18. package/esm/lib/tool-orchestrator.js +132 -0
  19. package/esm/lib/tool-types.d.ts +199 -0
  20. package/esm/lib/tool-types.js +32 -0
  21. package/esm/sdk/sdk.d.ts +10 -0
  22. package/esm/sdk/sdk.js +9 -0
  23. package/jsr.json +1 -1
  24. package/package.json +2 -16
  25. package/vitest.config.ts +4 -0
  26. package/REACT_QUERY.md +0 -296
  27. package/esm/react-query/_context.d.ts +0 -8
  28. package/esm/react-query/_context.js +0 -14
  29. package/esm/react-query/_types.d.ts +0 -27
  30. package/esm/react-query/_types.js +0 -5
  31. package/esm/react-query/analyticsGetUserActivity.d.ts +0 -36
  32. package/esm/react-query/analyticsGetUserActivity.js +0 -77
  33. package/esm/react-query/apiKeysCreate.d.ts +0 -20
  34. package/esm/react-query/apiKeysCreate.js +0 -39
  35. package/esm/react-query/apiKeysDelete.d.ts +0 -20
  36. package/esm/react-query/apiKeysDelete.js +0 -39
  37. package/esm/react-query/apiKeysGet.d.ts +0 -24
  38. package/esm/react-query/apiKeysGet.js +0 -66
  39. package/esm/react-query/apiKeysGetCurrentKeyMetadata.d.ts +0 -29
  40. package/esm/react-query/apiKeysGetCurrentKeyMetadata.js +0 -66
  41. package/esm/react-query/apiKeysList.d.ts +0 -37
  42. package/esm/react-query/apiKeysList.js +0 -69
  43. package/esm/react-query/apiKeysUpdate.d.ts +0 -20
  44. package/esm/react-query/apiKeysUpdate.js +0 -39
  45. package/esm/react-query/betaResponsesSend.d.ts +0 -24
  46. package/esm/react-query/betaResponsesSend.js +0 -42
  47. package/esm/react-query/chatSend.d.ts +0 -24
  48. package/esm/react-query/chatSend.js +0 -42
  49. package/esm/react-query/completionsGenerate.d.ts +0 -23
  50. package/esm/react-query/completionsGenerate.js +0 -42
  51. package/esm/react-query/creditsCreateCoinbaseCharge.d.ts +0 -25
  52. package/esm/react-query/creditsCreateCoinbaseCharge.js +0 -42
  53. package/esm/react-query/creditsGetCredits.d.ts +0 -29
  54. package/esm/react-query/creditsGetCredits.js +0 -66
  55. package/esm/react-query/embeddingsGenerate.d.ts +0 -23
  56. package/esm/react-query/embeddingsGenerate.js +0 -42
  57. package/esm/react-query/embeddingsListModels.d.ts +0 -29
  58. package/esm/react-query/embeddingsListModels.js +0 -66
  59. package/esm/react-query/endpointsList.d.ts +0 -24
  60. package/esm/react-query/endpointsList.js +0 -66
  61. package/esm/react-query/endpointsListZdrEndpoints.d.ts +0 -23
  62. package/esm/react-query/endpointsListZdrEndpoints.js +0 -60
  63. package/esm/react-query/generationsGetGeneration.d.ts +0 -30
  64. package/esm/react-query/generationsGetGeneration.js +0 -71
  65. package/esm/react-query/index.d.ts +0 -27
  66. package/esm/react-query/index.js +0 -30
  67. package/esm/react-query/modelsCount.d.ts +0 -23
  68. package/esm/react-query/modelsCount.js +0 -60
  69. package/esm/react-query/modelsList.d.ts +0 -38
  70. package/esm/react-query/modelsList.js +0 -69
  71. package/esm/react-query/modelsListForUser.d.ts +0 -24
  72. package/esm/react-query/modelsListForUser.js +0 -60
  73. package/esm/react-query/oAuthCreateAuthCode.d.ts +0 -23
  74. package/esm/react-query/oAuthCreateAuthCode.js +0 -42
  75. package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.d.ts +0 -23
  76. package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.js +0 -42
  77. package/esm/react-query/parametersGetParameters.d.ts +0 -38
  78. package/esm/react-query/parametersGetParameters.js +0 -80
  79. package/esm/react-query/providersList.d.ts +0 -23
  80. package/esm/react-query/providersList.js +0 -60
@@ -1,38 +0,0 @@
1
- import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
2
- import { OpenRouterCore } from "../core.js";
3
- import { RequestOptions } from "../lib/sdks.js";
4
- import * as models from "../models/index.js";
5
- import * as operations from "../models/operations/index.js";
6
- import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes } from "./_types.js";
7
- export type ModelsListQueryData = models.ModelsListResponse;
8
- /**
9
- * List all models and their properties
10
- */
11
- export declare function useModelsList(request?: operations.GetModelsRequest | undefined, options?: QueryHookOptions<ModelsListQueryData>): UseQueryResult<ModelsListQueryData, Error>;
12
- /**
13
- * List all models and their properties
14
- */
15
- export declare function useModelsListSuspense(request?: operations.GetModelsRequest | undefined, options?: SuspenseQueryHookOptions<ModelsListQueryData>): UseSuspenseQueryResult<ModelsListQueryData, Error>;
16
- export declare function prefetchModelsList(queryClient: QueryClient, client$: OpenRouterCore, request?: operations.GetModelsRequest | undefined): Promise<void>;
17
- export declare function setModelsListData(client: QueryClient, queryKeyBase: [
18
- parameters: {
19
- category?: string | undefined;
20
- supportedParameters?: string | undefined;
21
- }
22
- ], data: ModelsListQueryData): ModelsListQueryData | undefined;
23
- export declare function invalidateModelsList(client: QueryClient, queryKeyBase: TupleToPrefixes<[
24
- parameters: {
25
- category?: string | undefined;
26
- supportedParameters?: string | undefined;
27
- }
28
- ]>, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
29
- export declare function invalidateAllModelsList(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
30
- export declare function buildModelsListQuery(client$: OpenRouterCore, request?: operations.GetModelsRequest | undefined, options?: RequestOptions): {
31
- queryKey: QueryKey;
32
- queryFn: (context: QueryFunctionContext) => Promise<ModelsListQueryData>;
33
- };
34
- export declare function queryKeyModelsList(parameters: {
35
- category?: string | undefined;
36
- supportedParameters?: string | undefined;
37
- }): QueryKey;
38
- //# sourceMappingURL=modelsList.d.ts.map
@@ -1,69 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- import { useQuery, useSuspenseQuery, } from "@tanstack/react-query";
5
- import { modelsList } from "../funcs/modelsList.js";
6
- import { combineSignals } from "../lib/primitives.js";
7
- import { unwrapAsync } from "../types/fp.js";
8
- import { useOpenRouterContext } from "./_context.js";
9
- /**
10
- * List all models and their properties
11
- */
12
- export function useModelsList(request, options) {
13
- const client = useOpenRouterContext();
14
- return useQuery({
15
- ...buildModelsListQuery(client, request, options),
16
- ...options,
17
- });
18
- }
19
- /**
20
- * List all models and their properties
21
- */
22
- export function useModelsListSuspense(request, options) {
23
- const client = useOpenRouterContext();
24
- return useSuspenseQuery({
25
- ...buildModelsListQuery(client, request, options),
26
- ...options,
27
- });
28
- }
29
- export function prefetchModelsList(queryClient, client$, request) {
30
- return queryClient.prefetchQuery({
31
- ...buildModelsListQuery(client$, request),
32
- });
33
- }
34
- export function setModelsListData(client, queryKeyBase, data) {
35
- const key = queryKeyModelsList(...queryKeyBase);
36
- return client.setQueryData(key, data);
37
- }
38
- export function invalidateModelsList(client, queryKeyBase, filters) {
39
- return client.invalidateQueries({
40
- ...filters,
41
- queryKey: ["@openrouter/sdk", "Models", "list", ...queryKeyBase],
42
- });
43
- }
44
- export function invalidateAllModelsList(client, filters) {
45
- return client.invalidateQueries({
46
- ...filters,
47
- queryKey: ["@openrouter/sdk", "Models", "list"],
48
- });
49
- }
50
- export function buildModelsListQuery(client$, request, options) {
51
- return {
52
- queryKey: queryKeyModelsList({
53
- category: request?.category,
54
- supportedParameters: request?.supportedParameters,
55
- }),
56
- queryFn: async function modelsListQueryFn(ctx) {
57
- const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
58
- const mergedOptions = {
59
- ...options,
60
- fetchOptions: { ...options?.fetchOptions, signal: sig },
61
- };
62
- return unwrapAsync(modelsList(client$, request, mergedOptions));
63
- },
64
- };
65
- }
66
- export function queryKeyModelsList(parameters) {
67
- return ["@openrouter/sdk", "Models", "list", parameters];
68
- }
69
- //# sourceMappingURL=modelsList.js.map
@@ -1,24 +0,0 @@
1
- import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
2
- import { OpenRouterCore } from "../core.js";
3
- import { RequestOptions } from "../lib/sdks.js";
4
- import * as models from "../models/index.js";
5
- import * as operations from "../models/operations/index.js";
6
- import { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
7
- export type ModelsListForUserQueryData = models.ModelsListResponse;
8
- /**
9
- * List models filtered by user provider preferences
10
- */
11
- export declare function useModelsListForUser(security: operations.ListModelsUserSecurity, options?: QueryHookOptions<ModelsListForUserQueryData>): UseQueryResult<ModelsListForUserQueryData, Error>;
12
- /**
13
- * List models filtered by user provider preferences
14
- */
15
- export declare function useModelsListForUserSuspense(security: operations.ListModelsUserSecurity, options?: SuspenseQueryHookOptions<ModelsListForUserQueryData>): UseSuspenseQueryResult<ModelsListForUserQueryData, Error>;
16
- export declare function prefetchModelsListForUser(queryClient: QueryClient, client$: OpenRouterCore, security: operations.ListModelsUserSecurity): Promise<void>;
17
- export declare function setModelsListForUserData(client: QueryClient, data: ModelsListForUserQueryData): ModelsListForUserQueryData | undefined;
18
- export declare function invalidateAllModelsListForUser(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
19
- export declare function buildModelsListForUserQuery(client$: OpenRouterCore, security: operations.ListModelsUserSecurity, options?: RequestOptions): {
20
- queryKey: QueryKey;
21
- queryFn: (context: QueryFunctionContext) => Promise<ModelsListForUserQueryData>;
22
- };
23
- export declare function queryKeyModelsListForUser(): QueryKey;
24
- //# sourceMappingURL=modelsListForUser.d.ts.map
@@ -1,60 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- import { useQuery, useSuspenseQuery, } from "@tanstack/react-query";
5
- import { modelsListForUser } from "../funcs/modelsListForUser.js";
6
- import { combineSignals } from "../lib/primitives.js";
7
- import { unwrapAsync } from "../types/fp.js";
8
- import { useOpenRouterContext } from "./_context.js";
9
- /**
10
- * List models filtered by user provider preferences
11
- */
12
- export function useModelsListForUser(security, options) {
13
- const client = useOpenRouterContext();
14
- return useQuery({
15
- ...buildModelsListForUserQuery(client, security, options),
16
- ...options,
17
- });
18
- }
19
- /**
20
- * List models filtered by user provider preferences
21
- */
22
- export function useModelsListForUserSuspense(security, options) {
23
- const client = useOpenRouterContext();
24
- return useSuspenseQuery({
25
- ...buildModelsListForUserQuery(client, security, options),
26
- ...options,
27
- });
28
- }
29
- export function prefetchModelsListForUser(queryClient, client$, security) {
30
- return queryClient.prefetchQuery({
31
- ...buildModelsListForUserQuery(client$, security),
32
- });
33
- }
34
- export function setModelsListForUserData(client, data) {
35
- const key = queryKeyModelsListForUser();
36
- return client.setQueryData(key, data);
37
- }
38
- export function invalidateAllModelsListForUser(client, filters) {
39
- return client.invalidateQueries({
40
- ...filters,
41
- queryKey: ["@openrouter/sdk", "Models", "listForUser"],
42
- });
43
- }
44
- export function buildModelsListForUserQuery(client$, security, options) {
45
- return {
46
- queryKey: queryKeyModelsListForUser(),
47
- queryFn: async function modelsListForUserQueryFn(ctx) {
48
- const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
49
- const mergedOptions = {
50
- ...options,
51
- fetchOptions: { ...options?.fetchOptions, signal: sig },
52
- };
53
- return unwrapAsync(modelsListForUser(client$, security, mergedOptions));
54
- },
55
- };
56
- }
57
- export function queryKeyModelsListForUser() {
58
- return ["@openrouter/sdk", "Models", "listForUser"];
59
- }
60
- //# sourceMappingURL=modelsListForUser.js.map
@@ -1,23 +0,0 @@
1
- import { MutationKey, UseMutationResult } from "@tanstack/react-query";
2
- import { OpenRouterCore } from "../core.js";
3
- import { RequestOptions } from "../lib/sdks.js";
4
- import * as operations from "../models/operations/index.js";
5
- import { MutationHookOptions } from "./_types.js";
6
- export type OAuthCreateAuthCodeMutationVariables = {
7
- request: operations.CreateAuthKeysCodeRequest;
8
- options?: RequestOptions;
9
- };
10
- export type OAuthCreateAuthCodeMutationData = operations.CreateAuthKeysCodeResponse;
11
- /**
12
- * Create authorization code
13
- *
14
- * @remarks
15
- * Create an authorization code for the PKCE flow to generate a user-controlled API key
16
- */
17
- export declare function useOAuthCreateAuthCodeMutation(options?: MutationHookOptions<OAuthCreateAuthCodeMutationData, Error, OAuthCreateAuthCodeMutationVariables>): UseMutationResult<OAuthCreateAuthCodeMutationData, Error, OAuthCreateAuthCodeMutationVariables>;
18
- export declare function mutationKeyOAuthCreateAuthCode(): MutationKey;
19
- export declare function buildOAuthCreateAuthCodeMutation(client$: OpenRouterCore, hookOptions?: RequestOptions): {
20
- mutationKey: MutationKey;
21
- mutationFn: (variables: OAuthCreateAuthCodeMutationVariables) => Promise<OAuthCreateAuthCodeMutationData>;
22
- };
23
- //# sourceMappingURL=oAuthCreateAuthCode.d.ts.map
@@ -1,42 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- import { useMutation, } from "@tanstack/react-query";
5
- import { oAuthCreateAuthCode } from "../funcs/oAuthCreateAuthCode.js";
6
- import { combineSignals } from "../lib/primitives.js";
7
- import { unwrapAsync } from "../types/fp.js";
8
- import { useOpenRouterContext } from "./_context.js";
9
- /**
10
- * Create authorization code
11
- *
12
- * @remarks
13
- * Create an authorization code for the PKCE flow to generate a user-controlled API key
14
- */
15
- export function useOAuthCreateAuthCodeMutation(options) {
16
- const client = useOpenRouterContext();
17
- return useMutation({
18
- ...buildOAuthCreateAuthCodeMutation(client, options),
19
- ...options,
20
- });
21
- }
22
- export function mutationKeyOAuthCreateAuthCode() {
23
- return ["@openrouter/sdk", "OAuth", "createAuthCode"];
24
- }
25
- export function buildOAuthCreateAuthCodeMutation(client$, hookOptions) {
26
- return {
27
- mutationKey: mutationKeyOAuthCreateAuthCode(),
28
- mutationFn: function oAuthCreateAuthCodeMutationFn({ request, options, }) {
29
- const mergedOptions = {
30
- ...hookOptions,
31
- ...options,
32
- fetchOptions: {
33
- ...hookOptions?.fetchOptions,
34
- ...options?.fetchOptions,
35
- signal: combineSignals(hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal),
36
- },
37
- };
38
- return unwrapAsync(oAuthCreateAuthCode(client$, request, mergedOptions));
39
- },
40
- };
41
- }
42
- //# sourceMappingURL=oAuthCreateAuthCode.js.map
@@ -1,23 +0,0 @@
1
- import { MutationKey, UseMutationResult } from "@tanstack/react-query";
2
- import { OpenRouterCore } from "../core.js";
3
- import { RequestOptions } from "../lib/sdks.js";
4
- import * as operations from "../models/operations/index.js";
5
- import { MutationHookOptions } from "./_types.js";
6
- export type OAuthExchangeAuthCodeForAPIKeyMutationVariables = {
7
- request: operations.ExchangeAuthCodeForAPIKeyRequest;
8
- options?: RequestOptions;
9
- };
10
- export type OAuthExchangeAuthCodeForAPIKeyMutationData = operations.ExchangeAuthCodeForAPIKeyResponse;
11
- /**
12
- * Exchange authorization code for API key
13
- *
14
- * @remarks
15
- * Exchange an authorization code from the PKCE flow for a user-controlled API key
16
- */
17
- export declare function useOAuthExchangeAuthCodeForAPIKeyMutation(options?: MutationHookOptions<OAuthExchangeAuthCodeForAPIKeyMutationData, Error, OAuthExchangeAuthCodeForAPIKeyMutationVariables>): UseMutationResult<OAuthExchangeAuthCodeForAPIKeyMutationData, Error, OAuthExchangeAuthCodeForAPIKeyMutationVariables>;
18
- export declare function mutationKeyOAuthExchangeAuthCodeForAPIKey(): MutationKey;
19
- export declare function buildOAuthExchangeAuthCodeForAPIKeyMutation(client$: OpenRouterCore, hookOptions?: RequestOptions): {
20
- mutationKey: MutationKey;
21
- mutationFn: (variables: OAuthExchangeAuthCodeForAPIKeyMutationVariables) => Promise<OAuthExchangeAuthCodeForAPIKeyMutationData>;
22
- };
23
- //# sourceMappingURL=oAuthExchangeAuthCodeForAPIKey.d.ts.map
@@ -1,42 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- import { useMutation, } from "@tanstack/react-query";
5
- import { oAuthExchangeAuthCodeForAPIKey } from "../funcs/oAuthExchangeAuthCodeForAPIKey.js";
6
- import { combineSignals } from "../lib/primitives.js";
7
- import { unwrapAsync } from "../types/fp.js";
8
- import { useOpenRouterContext } from "./_context.js";
9
- /**
10
- * Exchange authorization code for API key
11
- *
12
- * @remarks
13
- * Exchange an authorization code from the PKCE flow for a user-controlled API key
14
- */
15
- export function useOAuthExchangeAuthCodeForAPIKeyMutation(options) {
16
- const client = useOpenRouterContext();
17
- return useMutation({
18
- ...buildOAuthExchangeAuthCodeForAPIKeyMutation(client, options),
19
- ...options,
20
- });
21
- }
22
- export function mutationKeyOAuthExchangeAuthCodeForAPIKey() {
23
- return ["@openrouter/sdk", "OAuth", "exchangeAuthCodeForAPIKey"];
24
- }
25
- export function buildOAuthExchangeAuthCodeForAPIKeyMutation(client$, hookOptions) {
26
- return {
27
- mutationKey: mutationKeyOAuthExchangeAuthCodeForAPIKey(),
28
- mutationFn: function oAuthExchangeAuthCodeForAPIKeyMutationFn({ request, options, }) {
29
- const mergedOptions = {
30
- ...hookOptions,
31
- ...options,
32
- fetchOptions: {
33
- ...hookOptions?.fetchOptions,
34
- ...options?.fetchOptions,
35
- signal: combineSignals(hookOptions?.fetchOptions?.signal, options?.fetchOptions?.signal),
36
- },
37
- };
38
- return unwrapAsync(oAuthExchangeAuthCodeForAPIKey(client$, request, mergedOptions));
39
- },
40
- };
41
- }
42
- //# sourceMappingURL=oAuthExchangeAuthCodeForAPIKey.js.map
@@ -1,38 +0,0 @@
1
- import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
2
- import { OpenRouterCore } from "../core.js";
3
- import { RequestOptions } from "../lib/sdks.js";
4
- import * as operations from "../models/operations/index.js";
5
- import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes } from "./_types.js";
6
- export type ParametersGetParametersQueryData = operations.GetParametersResponse;
7
- /**
8
- * Get a model's supported parameters and data about which are most popular
9
- */
10
- export declare function useParametersGetParameters(security: operations.GetParametersSecurity, request: operations.GetParametersRequest, options?: QueryHookOptions<ParametersGetParametersQueryData>): UseQueryResult<ParametersGetParametersQueryData, Error>;
11
- /**
12
- * Get a model's supported parameters and data about which are most popular
13
- */
14
- export declare function useParametersGetParametersSuspense(security: operations.GetParametersSecurity, request: operations.GetParametersRequest, options?: SuspenseQueryHookOptions<ParametersGetParametersQueryData>): UseSuspenseQueryResult<ParametersGetParametersQueryData, Error>;
15
- export declare function prefetchParametersGetParameters(queryClient: QueryClient, client$: OpenRouterCore, security: operations.GetParametersSecurity, request: operations.GetParametersRequest): Promise<void>;
16
- export declare function setParametersGetParametersData(client: QueryClient, queryKeyBase: [
17
- author: string,
18
- slug: string,
19
- parameters: {
20
- provider?: operations.GetParametersProvider | undefined;
21
- }
22
- ], data: ParametersGetParametersQueryData): ParametersGetParametersQueryData | undefined;
23
- export declare function invalidateParametersGetParameters(client: QueryClient, queryKeyBase: TupleToPrefixes<[
24
- author: string,
25
- slug: string,
26
- parameters: {
27
- provider?: operations.GetParametersProvider | undefined;
28
- }
29
- ]>, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
30
- export declare function invalidateAllParametersGetParameters(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
31
- export declare function buildParametersGetParametersQuery(client$: OpenRouterCore, security: operations.GetParametersSecurity, request: operations.GetParametersRequest, options?: RequestOptions): {
32
- queryKey: QueryKey;
33
- queryFn: (context: QueryFunctionContext) => Promise<ParametersGetParametersQueryData>;
34
- };
35
- export declare function queryKeyParametersGetParameters(author: string, slug: string, parameters: {
36
- provider?: operations.GetParametersProvider | undefined;
37
- }): QueryKey;
38
- //# sourceMappingURL=parametersGetParameters.d.ts.map
@@ -1,80 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- import { useQuery, useSuspenseQuery, } from "@tanstack/react-query";
5
- import { parametersGetParameters } from "../funcs/parametersGetParameters.js";
6
- import { combineSignals } from "../lib/primitives.js";
7
- import { unwrapAsync } from "../types/fp.js";
8
- import { useOpenRouterContext } from "./_context.js";
9
- /**
10
- * Get a model's supported parameters and data about which are most popular
11
- */
12
- export function useParametersGetParameters(security, request, options) {
13
- const client = useOpenRouterContext();
14
- return useQuery({
15
- ...buildParametersGetParametersQuery(client, security, request, options),
16
- ...options,
17
- });
18
- }
19
- /**
20
- * Get a model's supported parameters and data about which are most popular
21
- */
22
- export function useParametersGetParametersSuspense(security, request, options) {
23
- const client = useOpenRouterContext();
24
- return useSuspenseQuery({
25
- ...buildParametersGetParametersQuery(client, security, request, options),
26
- ...options,
27
- });
28
- }
29
- export function prefetchParametersGetParameters(queryClient, client$, security, request) {
30
- return queryClient.prefetchQuery({
31
- ...buildParametersGetParametersQuery(client$, security, request),
32
- });
33
- }
34
- export function setParametersGetParametersData(client, queryKeyBase, data) {
35
- const key = queryKeyParametersGetParameters(...queryKeyBase);
36
- return client.setQueryData(key, data);
37
- }
38
- export function invalidateParametersGetParameters(client, queryKeyBase, filters) {
39
- return client.invalidateQueries({
40
- ...filters,
41
- queryKey: [
42
- "@openrouter/sdk",
43
- "Parameters",
44
- "getParameters",
45
- ...queryKeyBase,
46
- ],
47
- });
48
- }
49
- export function invalidateAllParametersGetParameters(client, filters) {
50
- return client.invalidateQueries({
51
- ...filters,
52
- queryKey: ["@openrouter/sdk", "Parameters", "getParameters"],
53
- });
54
- }
55
- export function buildParametersGetParametersQuery(client$, security, request, options) {
56
- return {
57
- queryKey: queryKeyParametersGetParameters(request.author, request.slug, {
58
- provider: request.provider,
59
- }),
60
- queryFn: async function parametersGetParametersQueryFn(ctx) {
61
- const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
62
- const mergedOptions = {
63
- ...options,
64
- fetchOptions: { ...options?.fetchOptions, signal: sig },
65
- };
66
- return unwrapAsync(parametersGetParameters(client$, security, request, mergedOptions));
67
- },
68
- };
69
- }
70
- export function queryKeyParametersGetParameters(author, slug, parameters) {
71
- return [
72
- "@openrouter/sdk",
73
- "Parameters",
74
- "getParameters",
75
- author,
76
- slug,
77
- parameters,
78
- ];
79
- }
80
- //# sourceMappingURL=parametersGetParameters.js.map
@@ -1,23 +0,0 @@
1
- import { InvalidateQueryFilters, QueryClient, QueryFunctionContext, QueryKey, UseQueryResult, UseSuspenseQueryResult } from "@tanstack/react-query";
2
- import { OpenRouterCore } from "../core.js";
3
- import { RequestOptions } from "../lib/sdks.js";
4
- import * as operations from "../models/operations/index.js";
5
- import { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
6
- export type ProvidersListQueryData = operations.ListProvidersResponse;
7
- /**
8
- * List all providers
9
- */
10
- export declare function useProvidersList(options?: QueryHookOptions<ProvidersListQueryData>): UseQueryResult<ProvidersListQueryData, Error>;
11
- /**
12
- * List all providers
13
- */
14
- export declare function useProvidersListSuspense(options?: SuspenseQueryHookOptions<ProvidersListQueryData>): UseSuspenseQueryResult<ProvidersListQueryData, Error>;
15
- export declare function prefetchProvidersList(queryClient: QueryClient, client$: OpenRouterCore): Promise<void>;
16
- export declare function setProvidersListData(client: QueryClient, data: ProvidersListQueryData): ProvidersListQueryData | undefined;
17
- export declare function invalidateAllProvidersList(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
18
- export declare function buildProvidersListQuery(client$: OpenRouterCore, options?: RequestOptions): {
19
- queryKey: QueryKey;
20
- queryFn: (context: QueryFunctionContext) => Promise<ProvidersListQueryData>;
21
- };
22
- export declare function queryKeyProvidersList(): QueryKey;
23
- //# sourceMappingURL=providersList.d.ts.map
@@ -1,60 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
- import { useQuery, useSuspenseQuery, } from "@tanstack/react-query";
5
- import { providersList } from "../funcs/providersList.js";
6
- import { combineSignals } from "../lib/primitives.js";
7
- import { unwrapAsync } from "../types/fp.js";
8
- import { useOpenRouterContext } from "./_context.js";
9
- /**
10
- * List all providers
11
- */
12
- export function useProvidersList(options) {
13
- const client = useOpenRouterContext();
14
- return useQuery({
15
- ...buildProvidersListQuery(client, options),
16
- ...options,
17
- });
18
- }
19
- /**
20
- * List all providers
21
- */
22
- export function useProvidersListSuspense(options) {
23
- const client = useOpenRouterContext();
24
- return useSuspenseQuery({
25
- ...buildProvidersListQuery(client, options),
26
- ...options,
27
- });
28
- }
29
- export function prefetchProvidersList(queryClient, client$) {
30
- return queryClient.prefetchQuery({
31
- ...buildProvidersListQuery(client$),
32
- });
33
- }
34
- export function setProvidersListData(client, data) {
35
- const key = queryKeyProvidersList();
36
- return client.setQueryData(key, data);
37
- }
38
- export function invalidateAllProvidersList(client, filters) {
39
- return client.invalidateQueries({
40
- ...filters,
41
- queryKey: ["@openrouter/sdk", "Providers", "list"],
42
- });
43
- }
44
- export function buildProvidersListQuery(client$, options) {
45
- return {
46
- queryKey: queryKeyProvidersList(),
47
- queryFn: async function providersListQueryFn(ctx) {
48
- const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
49
- const mergedOptions = {
50
- ...options,
51
- fetchOptions: { ...options?.fetchOptions, signal: sig },
52
- };
53
- return unwrapAsync(providersList(client$, mergedOptions));
54
- },
55
- };
56
- }
57
- export function queryKeyProvidersList() {
58
- return ["@openrouter/sdk", "Providers", "list"];
59
- }
60
- //# sourceMappingURL=providersList.js.map