@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.
- package/README.md +0 -8
- package/esm/funcs/callModel.d.ts +77 -0
- package/esm/funcs/callModel.js +100 -0
- package/esm/lib/config.d.ts +10 -2
- package/esm/lib/config.js +2 -2
- package/esm/lib/env.d.ts +13 -0
- package/esm/lib/env.js +16 -0
- package/esm/lib/response-wrapper.d.ts +116 -0
- package/esm/lib/response-wrapper.js +459 -0
- package/esm/lib/reusable-stream.d.ts +39 -0
- package/esm/lib/reusable-stream.js +173 -0
- package/esm/lib/sdks.js +2 -2
- package/esm/lib/stream-transformers.d.ts +47 -0
- package/esm/lib/stream-transformers.js +280 -0
- package/esm/lib/tool-executor.d.ts +53 -0
- package/esm/lib/tool-executor.js +181 -0
- package/esm/lib/tool-orchestrator.d.ts +50 -0
- package/esm/lib/tool-orchestrator.js +132 -0
- package/esm/lib/tool-types.d.ts +199 -0
- package/esm/lib/tool-types.js +32 -0
- package/esm/sdk/sdk.d.ts +10 -0
- package/esm/sdk/sdk.js +9 -0
- package/jsr.json +1 -1
- package/package.json +2 -16
- package/vitest.config.ts +4 -0
- package/REACT_QUERY.md +0 -296
- package/esm/react-query/_context.d.ts +0 -8
- package/esm/react-query/_context.js +0 -14
- package/esm/react-query/_types.d.ts +0 -27
- package/esm/react-query/_types.js +0 -5
- package/esm/react-query/analyticsGetUserActivity.d.ts +0 -36
- package/esm/react-query/analyticsGetUserActivity.js +0 -77
- package/esm/react-query/apiKeysCreate.d.ts +0 -20
- package/esm/react-query/apiKeysCreate.js +0 -39
- package/esm/react-query/apiKeysDelete.d.ts +0 -20
- package/esm/react-query/apiKeysDelete.js +0 -39
- package/esm/react-query/apiKeysGet.d.ts +0 -24
- package/esm/react-query/apiKeysGet.js +0 -66
- package/esm/react-query/apiKeysGetCurrentKeyMetadata.d.ts +0 -29
- package/esm/react-query/apiKeysGetCurrentKeyMetadata.js +0 -66
- package/esm/react-query/apiKeysList.d.ts +0 -37
- package/esm/react-query/apiKeysList.js +0 -69
- package/esm/react-query/apiKeysUpdate.d.ts +0 -20
- package/esm/react-query/apiKeysUpdate.js +0 -39
- package/esm/react-query/betaResponsesSend.d.ts +0 -24
- package/esm/react-query/betaResponsesSend.js +0 -42
- package/esm/react-query/chatSend.d.ts +0 -24
- package/esm/react-query/chatSend.js +0 -42
- package/esm/react-query/completionsGenerate.d.ts +0 -23
- package/esm/react-query/completionsGenerate.js +0 -42
- package/esm/react-query/creditsCreateCoinbaseCharge.d.ts +0 -25
- package/esm/react-query/creditsCreateCoinbaseCharge.js +0 -42
- package/esm/react-query/creditsGetCredits.d.ts +0 -29
- package/esm/react-query/creditsGetCredits.js +0 -66
- package/esm/react-query/embeddingsGenerate.d.ts +0 -23
- package/esm/react-query/embeddingsGenerate.js +0 -42
- package/esm/react-query/embeddingsListModels.d.ts +0 -29
- package/esm/react-query/embeddingsListModels.js +0 -66
- package/esm/react-query/endpointsList.d.ts +0 -24
- package/esm/react-query/endpointsList.js +0 -66
- package/esm/react-query/endpointsListZdrEndpoints.d.ts +0 -23
- package/esm/react-query/endpointsListZdrEndpoints.js +0 -60
- package/esm/react-query/generationsGetGeneration.d.ts +0 -30
- package/esm/react-query/generationsGetGeneration.js +0 -71
- package/esm/react-query/index.d.ts +0 -27
- package/esm/react-query/index.js +0 -30
- package/esm/react-query/modelsCount.d.ts +0 -23
- package/esm/react-query/modelsCount.js +0 -60
- package/esm/react-query/modelsList.d.ts +0 -38
- package/esm/react-query/modelsList.js +0 -69
- package/esm/react-query/modelsListForUser.d.ts +0 -24
- package/esm/react-query/modelsListForUser.js +0 -60
- package/esm/react-query/oAuthCreateAuthCode.d.ts +0 -23
- package/esm/react-query/oAuthCreateAuthCode.js +0 -42
- package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.d.ts +0 -23
- package/esm/react-query/oAuthExchangeAuthCodeForAPIKey.js +0 -42
- package/esm/react-query/parametersGetParameters.d.ts +0 -38
- package/esm/react-query/parametersGetParameters.js +0 -80
- package/esm/react-query/providersList.d.ts +0 -23
- package/esm/react-query/providersList.js +0 -60
|
@@ -1,66 +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 { creditsGetCredits } from "../funcs/creditsGetCredits.js";
|
|
6
|
-
import { combineSignals } from "../lib/primitives.js";
|
|
7
|
-
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
-
import { useOpenRouterContext } from "./_context.js";
|
|
9
|
-
/**
|
|
10
|
-
* Get remaining credits
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* Get total credits purchased and used for the authenticated user
|
|
14
|
-
*/
|
|
15
|
-
export function useCreditsGetCredits(options) {
|
|
16
|
-
const client = useOpenRouterContext();
|
|
17
|
-
return useQuery({
|
|
18
|
-
...buildCreditsGetCreditsQuery(client, options),
|
|
19
|
-
...options,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get remaining credits
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* Get total credits purchased and used for the authenticated user
|
|
27
|
-
*/
|
|
28
|
-
export function useCreditsGetCreditsSuspense(options) {
|
|
29
|
-
const client = useOpenRouterContext();
|
|
30
|
-
return useSuspenseQuery({
|
|
31
|
-
...buildCreditsGetCreditsQuery(client, options),
|
|
32
|
-
...options,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export function prefetchCreditsGetCredits(queryClient, client$) {
|
|
36
|
-
return queryClient.prefetchQuery({
|
|
37
|
-
...buildCreditsGetCreditsQuery(client$),
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
export function setCreditsGetCreditsData(client, data) {
|
|
41
|
-
const key = queryKeyCreditsGetCredits();
|
|
42
|
-
return client.setQueryData(key, data);
|
|
43
|
-
}
|
|
44
|
-
export function invalidateAllCreditsGetCredits(client, filters) {
|
|
45
|
-
return client.invalidateQueries({
|
|
46
|
-
...filters,
|
|
47
|
-
queryKey: ["@openrouter/sdk", "Credits", "getCredits"],
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
export function buildCreditsGetCreditsQuery(client$, options) {
|
|
51
|
-
return {
|
|
52
|
-
queryKey: queryKeyCreditsGetCredits(),
|
|
53
|
-
queryFn: async function creditsGetCreditsQueryFn(ctx) {
|
|
54
|
-
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
55
|
-
const mergedOptions = {
|
|
56
|
-
...options,
|
|
57
|
-
fetchOptions: { ...options?.fetchOptions, signal: sig },
|
|
58
|
-
};
|
|
59
|
-
return unwrapAsync(creditsGetCredits(client$, mergedOptions));
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export function queryKeyCreditsGetCredits() {
|
|
64
|
-
return ["@openrouter/sdk", "Credits", "getCredits"];
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=creditsGetCredits.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 EmbeddingsGenerateMutationVariables = {
|
|
7
|
-
request: operations.CreateEmbeddingsRequest;
|
|
8
|
-
options?: RequestOptions;
|
|
9
|
-
};
|
|
10
|
-
export type EmbeddingsGenerateMutationData = operations.CreateEmbeddingsResponse;
|
|
11
|
-
/**
|
|
12
|
-
* Submit an embedding request
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* Submits an embedding request to the embeddings router
|
|
16
|
-
*/
|
|
17
|
-
export declare function useEmbeddingsGenerateMutation(options?: MutationHookOptions<EmbeddingsGenerateMutationData, Error, EmbeddingsGenerateMutationVariables>): UseMutationResult<EmbeddingsGenerateMutationData, Error, EmbeddingsGenerateMutationVariables>;
|
|
18
|
-
export declare function mutationKeyEmbeddingsGenerate(): MutationKey;
|
|
19
|
-
export declare function buildEmbeddingsGenerateMutation(client$: OpenRouterCore, hookOptions?: RequestOptions): {
|
|
20
|
-
mutationKey: MutationKey;
|
|
21
|
-
mutationFn: (variables: EmbeddingsGenerateMutationVariables) => Promise<EmbeddingsGenerateMutationData>;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=embeddingsGenerate.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 { embeddingsGenerate } from "../funcs/embeddingsGenerate.js";
|
|
6
|
-
import { combineSignals } from "../lib/primitives.js";
|
|
7
|
-
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
-
import { useOpenRouterContext } from "./_context.js";
|
|
9
|
-
/**
|
|
10
|
-
* Submit an embedding request
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* Submits an embedding request to the embeddings router
|
|
14
|
-
*/
|
|
15
|
-
export function useEmbeddingsGenerateMutation(options) {
|
|
16
|
-
const client = useOpenRouterContext();
|
|
17
|
-
return useMutation({
|
|
18
|
-
...buildEmbeddingsGenerateMutation(client, options),
|
|
19
|
-
...options,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
export function mutationKeyEmbeddingsGenerate() {
|
|
23
|
-
return ["@openrouter/sdk", "Embeddings", "generate"];
|
|
24
|
-
}
|
|
25
|
-
export function buildEmbeddingsGenerateMutation(client$, hookOptions) {
|
|
26
|
-
return {
|
|
27
|
-
mutationKey: mutationKeyEmbeddingsGenerate(),
|
|
28
|
-
mutationFn: function embeddingsGenerateMutationFn({ 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(embeddingsGenerate(client$, request, mergedOptions));
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=embeddingsGenerate.js.map
|
|
@@ -1,29 +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 { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
|
|
6
|
-
export type EmbeddingsListModelsQueryData = models.ModelsListResponse;
|
|
7
|
-
/**
|
|
8
|
-
* List all embeddings models
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Returns a list of all available embeddings models and their properties
|
|
12
|
-
*/
|
|
13
|
-
export declare function useEmbeddingsListModels(options?: QueryHookOptions<EmbeddingsListModelsQueryData>): UseQueryResult<EmbeddingsListModelsQueryData, Error>;
|
|
14
|
-
/**
|
|
15
|
-
* List all embeddings models
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* Returns a list of all available embeddings models and their properties
|
|
19
|
-
*/
|
|
20
|
-
export declare function useEmbeddingsListModelsSuspense(options?: SuspenseQueryHookOptions<EmbeddingsListModelsQueryData>): UseSuspenseQueryResult<EmbeddingsListModelsQueryData, Error>;
|
|
21
|
-
export declare function prefetchEmbeddingsListModels(queryClient: QueryClient, client$: OpenRouterCore): Promise<void>;
|
|
22
|
-
export declare function setEmbeddingsListModelsData(client: QueryClient, data: EmbeddingsListModelsQueryData): EmbeddingsListModelsQueryData | undefined;
|
|
23
|
-
export declare function invalidateAllEmbeddingsListModels(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
24
|
-
export declare function buildEmbeddingsListModelsQuery(client$: OpenRouterCore, options?: RequestOptions): {
|
|
25
|
-
queryKey: QueryKey;
|
|
26
|
-
queryFn: (context: QueryFunctionContext) => Promise<EmbeddingsListModelsQueryData>;
|
|
27
|
-
};
|
|
28
|
-
export declare function queryKeyEmbeddingsListModels(): QueryKey;
|
|
29
|
-
//# sourceMappingURL=embeddingsListModels.d.ts.map
|
|
@@ -1,66 +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 { embeddingsListModels } from "../funcs/embeddingsListModels.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 embeddings models
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* Returns a list of all available embeddings models and their properties
|
|
14
|
-
*/
|
|
15
|
-
export function useEmbeddingsListModels(options) {
|
|
16
|
-
const client = useOpenRouterContext();
|
|
17
|
-
return useQuery({
|
|
18
|
-
...buildEmbeddingsListModelsQuery(client, options),
|
|
19
|
-
...options,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* List all embeddings models
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* Returns a list of all available embeddings models and their properties
|
|
27
|
-
*/
|
|
28
|
-
export function useEmbeddingsListModelsSuspense(options) {
|
|
29
|
-
const client = useOpenRouterContext();
|
|
30
|
-
return useSuspenseQuery({
|
|
31
|
-
...buildEmbeddingsListModelsQuery(client, options),
|
|
32
|
-
...options,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export function prefetchEmbeddingsListModels(queryClient, client$) {
|
|
36
|
-
return queryClient.prefetchQuery({
|
|
37
|
-
...buildEmbeddingsListModelsQuery(client$),
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
export function setEmbeddingsListModelsData(client, data) {
|
|
41
|
-
const key = queryKeyEmbeddingsListModels();
|
|
42
|
-
return client.setQueryData(key, data);
|
|
43
|
-
}
|
|
44
|
-
export function invalidateAllEmbeddingsListModels(client, filters) {
|
|
45
|
-
return client.invalidateQueries({
|
|
46
|
-
...filters,
|
|
47
|
-
queryKey: ["@openrouter/sdk", "Embeddings", "listModels"],
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
export function buildEmbeddingsListModelsQuery(client$, options) {
|
|
51
|
-
return {
|
|
52
|
-
queryKey: queryKeyEmbeddingsListModels(),
|
|
53
|
-
queryFn: async function embeddingsListModelsQueryFn(ctx) {
|
|
54
|
-
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
55
|
-
const mergedOptions = {
|
|
56
|
-
...options,
|
|
57
|
-
fetchOptions: { ...options?.fetchOptions, signal: sig },
|
|
58
|
-
};
|
|
59
|
-
return unwrapAsync(embeddingsListModels(client$, mergedOptions));
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export function queryKeyEmbeddingsListModels() {
|
|
64
|
-
return ["@openrouter/sdk", "Embeddings", "listModels"];
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=embeddingsListModels.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 operations from "../models/operations/index.js";
|
|
5
|
-
import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes } from "./_types.js";
|
|
6
|
-
export type EndpointsListQueryData = operations.ListEndpointsResponse;
|
|
7
|
-
/**
|
|
8
|
-
* List all endpoints for a model
|
|
9
|
-
*/
|
|
10
|
-
export declare function useEndpointsList(request: operations.ListEndpointsRequest, options?: QueryHookOptions<EndpointsListQueryData>): UseQueryResult<EndpointsListQueryData, Error>;
|
|
11
|
-
/**
|
|
12
|
-
* List all endpoints for a model
|
|
13
|
-
*/
|
|
14
|
-
export declare function useEndpointsListSuspense(request: operations.ListEndpointsRequest, options?: SuspenseQueryHookOptions<EndpointsListQueryData>): UseSuspenseQueryResult<EndpointsListQueryData, Error>;
|
|
15
|
-
export declare function prefetchEndpointsList(queryClient: QueryClient, client$: OpenRouterCore, request: operations.ListEndpointsRequest): Promise<void>;
|
|
16
|
-
export declare function setEndpointsListData(client: QueryClient, queryKeyBase: [author: string, slug: string], data: EndpointsListQueryData): EndpointsListQueryData | undefined;
|
|
17
|
-
export declare function invalidateEndpointsList(client: QueryClient, queryKeyBase: TupleToPrefixes<[author: string, slug: string]>, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
18
|
-
export declare function invalidateAllEndpointsList(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
19
|
-
export declare function buildEndpointsListQuery(client$: OpenRouterCore, request: operations.ListEndpointsRequest, options?: RequestOptions): {
|
|
20
|
-
queryKey: QueryKey;
|
|
21
|
-
queryFn: (context: QueryFunctionContext) => Promise<EndpointsListQueryData>;
|
|
22
|
-
};
|
|
23
|
-
export declare function queryKeyEndpointsList(author: string, slug: string): QueryKey;
|
|
24
|
-
//# sourceMappingURL=endpointsList.d.ts.map
|
|
@@ -1,66 +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 { endpointsList } from "../funcs/endpointsList.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 endpoints for a model
|
|
11
|
-
*/
|
|
12
|
-
export function useEndpointsList(request, options) {
|
|
13
|
-
const client = useOpenRouterContext();
|
|
14
|
-
return useQuery({
|
|
15
|
-
...buildEndpointsListQuery(client, request, options),
|
|
16
|
-
...options,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* List all endpoints for a model
|
|
21
|
-
*/
|
|
22
|
-
export function useEndpointsListSuspense(request, options) {
|
|
23
|
-
const client = useOpenRouterContext();
|
|
24
|
-
return useSuspenseQuery({
|
|
25
|
-
...buildEndpointsListQuery(client, request, options),
|
|
26
|
-
...options,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export function prefetchEndpointsList(queryClient, client$, request) {
|
|
30
|
-
return queryClient.prefetchQuery({
|
|
31
|
-
...buildEndpointsListQuery(client$, request),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
export function setEndpointsListData(client, queryKeyBase, data) {
|
|
35
|
-
const key = queryKeyEndpointsList(...queryKeyBase);
|
|
36
|
-
return client.setQueryData(key, data);
|
|
37
|
-
}
|
|
38
|
-
export function invalidateEndpointsList(client, queryKeyBase, filters) {
|
|
39
|
-
return client.invalidateQueries({
|
|
40
|
-
...filters,
|
|
41
|
-
queryKey: ["@openrouter/sdk", "Endpoints", "list", ...queryKeyBase],
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
export function invalidateAllEndpointsList(client, filters) {
|
|
45
|
-
return client.invalidateQueries({
|
|
46
|
-
...filters,
|
|
47
|
-
queryKey: ["@openrouter/sdk", "Endpoints", "list"],
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
export function buildEndpointsListQuery(client$, request, options) {
|
|
51
|
-
return {
|
|
52
|
-
queryKey: queryKeyEndpointsList(request.author, request.slug),
|
|
53
|
-
queryFn: async function endpointsListQueryFn(ctx) {
|
|
54
|
-
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
55
|
-
const mergedOptions = {
|
|
56
|
-
...options,
|
|
57
|
-
fetchOptions: { ...options?.fetchOptions, signal: sig },
|
|
58
|
-
};
|
|
59
|
-
return unwrapAsync(endpointsList(client$, request, mergedOptions));
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
export function queryKeyEndpointsList(author, slug) {
|
|
64
|
-
return ["@openrouter/sdk", "Endpoints", "list", author, slug];
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=endpointsList.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 EndpointsListZdrEndpointsQueryData = operations.ListEndpointsZdrResponse;
|
|
7
|
-
/**
|
|
8
|
-
* Preview the impact of ZDR on the available endpoints
|
|
9
|
-
*/
|
|
10
|
-
export declare function useEndpointsListZdrEndpoints(options?: QueryHookOptions<EndpointsListZdrEndpointsQueryData>): UseQueryResult<EndpointsListZdrEndpointsQueryData, Error>;
|
|
11
|
-
/**
|
|
12
|
-
* Preview the impact of ZDR on the available endpoints
|
|
13
|
-
*/
|
|
14
|
-
export declare function useEndpointsListZdrEndpointsSuspense(options?: SuspenseQueryHookOptions<EndpointsListZdrEndpointsQueryData>): UseSuspenseQueryResult<EndpointsListZdrEndpointsQueryData, Error>;
|
|
15
|
-
export declare function prefetchEndpointsListZdrEndpoints(queryClient: QueryClient, client$: OpenRouterCore): Promise<void>;
|
|
16
|
-
export declare function setEndpointsListZdrEndpointsData(client: QueryClient, data: EndpointsListZdrEndpointsQueryData): EndpointsListZdrEndpointsQueryData | undefined;
|
|
17
|
-
export declare function invalidateAllEndpointsListZdrEndpoints(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
18
|
-
export declare function buildEndpointsListZdrEndpointsQuery(client$: OpenRouterCore, options?: RequestOptions): {
|
|
19
|
-
queryKey: QueryKey;
|
|
20
|
-
queryFn: (context: QueryFunctionContext) => Promise<EndpointsListZdrEndpointsQueryData>;
|
|
21
|
-
};
|
|
22
|
-
export declare function queryKeyEndpointsListZdrEndpoints(): QueryKey;
|
|
23
|
-
//# sourceMappingURL=endpointsListZdrEndpoints.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 { endpointsListZdrEndpoints } from "../funcs/endpointsListZdrEndpoints.js";
|
|
6
|
-
import { combineSignals } from "../lib/primitives.js";
|
|
7
|
-
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
-
import { useOpenRouterContext } from "./_context.js";
|
|
9
|
-
/**
|
|
10
|
-
* Preview the impact of ZDR on the available endpoints
|
|
11
|
-
*/
|
|
12
|
-
export function useEndpointsListZdrEndpoints(options) {
|
|
13
|
-
const client = useOpenRouterContext();
|
|
14
|
-
return useQuery({
|
|
15
|
-
...buildEndpointsListZdrEndpointsQuery(client, options),
|
|
16
|
-
...options,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Preview the impact of ZDR on the available endpoints
|
|
21
|
-
*/
|
|
22
|
-
export function useEndpointsListZdrEndpointsSuspense(options) {
|
|
23
|
-
const client = useOpenRouterContext();
|
|
24
|
-
return useSuspenseQuery({
|
|
25
|
-
...buildEndpointsListZdrEndpointsQuery(client, options),
|
|
26
|
-
...options,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export function prefetchEndpointsListZdrEndpoints(queryClient, client$) {
|
|
30
|
-
return queryClient.prefetchQuery({
|
|
31
|
-
...buildEndpointsListZdrEndpointsQuery(client$),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
export function setEndpointsListZdrEndpointsData(client, data) {
|
|
35
|
-
const key = queryKeyEndpointsListZdrEndpoints();
|
|
36
|
-
return client.setQueryData(key, data);
|
|
37
|
-
}
|
|
38
|
-
export function invalidateAllEndpointsListZdrEndpoints(client, filters) {
|
|
39
|
-
return client.invalidateQueries({
|
|
40
|
-
...filters,
|
|
41
|
-
queryKey: ["@openrouter/sdk", "Endpoints", "listZdrEndpoints"],
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
export function buildEndpointsListZdrEndpointsQuery(client$, options) {
|
|
45
|
-
return {
|
|
46
|
-
queryKey: queryKeyEndpointsListZdrEndpoints(),
|
|
47
|
-
queryFn: async function endpointsListZdrEndpointsQueryFn(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(endpointsListZdrEndpoints(client$, mergedOptions));
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export function queryKeyEndpointsListZdrEndpoints() {
|
|
58
|
-
return ["@openrouter/sdk", "Endpoints", "listZdrEndpoints"];
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=endpointsListZdrEndpoints.js.map
|
|
@@ -1,30 +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 GenerationsGetGenerationQueryData = operations.GetGenerationResponse;
|
|
7
|
-
/**
|
|
8
|
-
* Get request & usage metadata for a generation
|
|
9
|
-
*/
|
|
10
|
-
export declare function useGenerationsGetGeneration(request: operations.GetGenerationRequest, options?: QueryHookOptions<GenerationsGetGenerationQueryData>): UseQueryResult<GenerationsGetGenerationQueryData, Error>;
|
|
11
|
-
/**
|
|
12
|
-
* Get request & usage metadata for a generation
|
|
13
|
-
*/
|
|
14
|
-
export declare function useGenerationsGetGenerationSuspense(request: operations.GetGenerationRequest, options?: SuspenseQueryHookOptions<GenerationsGetGenerationQueryData>): UseSuspenseQueryResult<GenerationsGetGenerationQueryData, Error>;
|
|
15
|
-
export declare function prefetchGenerationsGetGeneration(queryClient: QueryClient, client$: OpenRouterCore, request: operations.GetGenerationRequest): Promise<void>;
|
|
16
|
-
export declare function setGenerationsGetGenerationData(client: QueryClient, queryKeyBase: [parameters: {
|
|
17
|
-
id: string;
|
|
18
|
-
}], data: GenerationsGetGenerationQueryData): GenerationsGetGenerationQueryData | undefined;
|
|
19
|
-
export declare function invalidateGenerationsGetGeneration(client: QueryClient, queryKeyBase: TupleToPrefixes<[parameters: {
|
|
20
|
-
id: string;
|
|
21
|
-
}]>, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
22
|
-
export declare function invalidateAllGenerationsGetGeneration(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
23
|
-
export declare function buildGenerationsGetGenerationQuery(client$: OpenRouterCore, request: operations.GetGenerationRequest, options?: RequestOptions): {
|
|
24
|
-
queryKey: QueryKey;
|
|
25
|
-
queryFn: (context: QueryFunctionContext) => Promise<GenerationsGetGenerationQueryData>;
|
|
26
|
-
};
|
|
27
|
-
export declare function queryKeyGenerationsGetGeneration(parameters: {
|
|
28
|
-
id: string;
|
|
29
|
-
}): QueryKey;
|
|
30
|
-
//# sourceMappingURL=generationsGetGeneration.d.ts.map
|
|
@@ -1,71 +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 { generationsGetGeneration } from "../funcs/generationsGetGeneration.js";
|
|
6
|
-
import { combineSignals } from "../lib/primitives.js";
|
|
7
|
-
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
-
import { useOpenRouterContext } from "./_context.js";
|
|
9
|
-
/**
|
|
10
|
-
* Get request & usage metadata for a generation
|
|
11
|
-
*/
|
|
12
|
-
export function useGenerationsGetGeneration(request, options) {
|
|
13
|
-
const client = useOpenRouterContext();
|
|
14
|
-
return useQuery({
|
|
15
|
-
...buildGenerationsGetGenerationQuery(client, request, options),
|
|
16
|
-
...options,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Get request & usage metadata for a generation
|
|
21
|
-
*/
|
|
22
|
-
export function useGenerationsGetGenerationSuspense(request, options) {
|
|
23
|
-
const client = useOpenRouterContext();
|
|
24
|
-
return useSuspenseQuery({
|
|
25
|
-
...buildGenerationsGetGenerationQuery(client, request, options),
|
|
26
|
-
...options,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export function prefetchGenerationsGetGeneration(queryClient, client$, request) {
|
|
30
|
-
return queryClient.prefetchQuery({
|
|
31
|
-
...buildGenerationsGetGenerationQuery(client$, request),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
export function setGenerationsGetGenerationData(client, queryKeyBase, data) {
|
|
35
|
-
const key = queryKeyGenerationsGetGeneration(...queryKeyBase);
|
|
36
|
-
return client.setQueryData(key, data);
|
|
37
|
-
}
|
|
38
|
-
export function invalidateGenerationsGetGeneration(client, queryKeyBase, filters) {
|
|
39
|
-
return client.invalidateQueries({
|
|
40
|
-
...filters,
|
|
41
|
-
queryKey: [
|
|
42
|
-
"@openrouter/sdk",
|
|
43
|
-
"Generations",
|
|
44
|
-
"getGeneration",
|
|
45
|
-
...queryKeyBase,
|
|
46
|
-
],
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
export function invalidateAllGenerationsGetGeneration(client, filters) {
|
|
50
|
-
return client.invalidateQueries({
|
|
51
|
-
...filters,
|
|
52
|
-
queryKey: ["@openrouter/sdk", "Generations", "getGeneration"],
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
export function buildGenerationsGetGenerationQuery(client$, request, options) {
|
|
56
|
-
return {
|
|
57
|
-
queryKey: queryKeyGenerationsGetGeneration({ id: request.id }),
|
|
58
|
-
queryFn: async function generationsGetGenerationQueryFn(ctx) {
|
|
59
|
-
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
60
|
-
const mergedOptions = {
|
|
61
|
-
...options,
|
|
62
|
-
fetchOptions: { ...options?.fetchOptions, signal: sig },
|
|
63
|
-
};
|
|
64
|
-
return unwrapAsync(generationsGetGeneration(client$, request, mergedOptions));
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export function queryKeyGenerationsGetGeneration(parameters) {
|
|
69
|
-
return ["@openrouter/sdk", "Generations", "getGeneration", parameters];
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=generationsGetGeneration.js.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export { OpenRouterProvider, useOpenRouterContext } from "./_context.js";
|
|
2
|
-
export * from "./_types.js";
|
|
3
|
-
export * from "./analyticsGetUserActivity.js";
|
|
4
|
-
export * from "./apiKeysCreate.js";
|
|
5
|
-
export * from "./apiKeysDelete.js";
|
|
6
|
-
export * from "./apiKeysGet.js";
|
|
7
|
-
export * from "./apiKeysGetCurrentKeyMetadata.js";
|
|
8
|
-
export * from "./apiKeysList.js";
|
|
9
|
-
export * from "./apiKeysUpdate.js";
|
|
10
|
-
export * from "./betaResponsesSend.js";
|
|
11
|
-
export * from "./chatSend.js";
|
|
12
|
-
export * from "./completionsGenerate.js";
|
|
13
|
-
export * from "./creditsCreateCoinbaseCharge.js";
|
|
14
|
-
export * from "./creditsGetCredits.js";
|
|
15
|
-
export * from "./embeddingsGenerate.js";
|
|
16
|
-
export * from "./embeddingsListModels.js";
|
|
17
|
-
export * from "./endpointsList.js";
|
|
18
|
-
export * from "./endpointsListZdrEndpoints.js";
|
|
19
|
-
export * from "./generationsGetGeneration.js";
|
|
20
|
-
export * from "./modelsCount.js";
|
|
21
|
-
export * from "./modelsList.js";
|
|
22
|
-
export * from "./modelsListForUser.js";
|
|
23
|
-
export * from "./oAuthCreateAuthCode.js";
|
|
24
|
-
export * from "./oAuthExchangeAuthCodeForAPIKey.js";
|
|
25
|
-
export * from "./parametersGetParameters.js";
|
|
26
|
-
export * from "./providersList.js";
|
|
27
|
-
//# sourceMappingURL=index.d.ts.map
|
package/esm/react-query/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
export { OpenRouterProvider, useOpenRouterContext } from "./_context.js";
|
|
5
|
-
export * from "./_types.js";
|
|
6
|
-
export * from "./analyticsGetUserActivity.js";
|
|
7
|
-
export * from "./apiKeysCreate.js";
|
|
8
|
-
export * from "./apiKeysDelete.js";
|
|
9
|
-
export * from "./apiKeysGet.js";
|
|
10
|
-
export * from "./apiKeysGetCurrentKeyMetadata.js";
|
|
11
|
-
export * from "./apiKeysList.js";
|
|
12
|
-
export * from "./apiKeysUpdate.js";
|
|
13
|
-
export * from "./betaResponsesSend.js";
|
|
14
|
-
export * from "./chatSend.js";
|
|
15
|
-
export * from "./completionsGenerate.js";
|
|
16
|
-
export * from "./creditsCreateCoinbaseCharge.js";
|
|
17
|
-
export * from "./creditsGetCredits.js";
|
|
18
|
-
export * from "./embeddingsGenerate.js";
|
|
19
|
-
export * from "./embeddingsListModels.js";
|
|
20
|
-
export * from "./endpointsList.js";
|
|
21
|
-
export * from "./endpointsListZdrEndpoints.js";
|
|
22
|
-
export * from "./generationsGetGeneration.js";
|
|
23
|
-
export * from "./modelsCount.js";
|
|
24
|
-
export * from "./modelsList.js";
|
|
25
|
-
export * from "./modelsListForUser.js";
|
|
26
|
-
export * from "./oAuthCreateAuthCode.js";
|
|
27
|
-
export * from "./oAuthExchangeAuthCodeForAPIKey.js";
|
|
28
|
-
export * from "./parametersGetParameters.js";
|
|
29
|
-
export * from "./providersList.js";
|
|
30
|
-
//# sourceMappingURL=index.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 models from "../models/index.js";
|
|
5
|
-
import { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
|
|
6
|
-
export type ModelsCountQueryData = models.ModelsCountResponse;
|
|
7
|
-
/**
|
|
8
|
-
* Get total count of available models
|
|
9
|
-
*/
|
|
10
|
-
export declare function useModelsCount(options?: QueryHookOptions<ModelsCountQueryData>): UseQueryResult<ModelsCountQueryData, Error>;
|
|
11
|
-
/**
|
|
12
|
-
* Get total count of available models
|
|
13
|
-
*/
|
|
14
|
-
export declare function useModelsCountSuspense(options?: SuspenseQueryHookOptions<ModelsCountQueryData>): UseSuspenseQueryResult<ModelsCountQueryData, Error>;
|
|
15
|
-
export declare function prefetchModelsCount(queryClient: QueryClient, client$: OpenRouterCore): Promise<void>;
|
|
16
|
-
export declare function setModelsCountData(client: QueryClient, data: ModelsCountQueryData): ModelsCountQueryData | undefined;
|
|
17
|
-
export declare function invalidateAllModelsCount(client: QueryClient, filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">): Promise<void>;
|
|
18
|
-
export declare function buildModelsCountQuery(client$: OpenRouterCore, options?: RequestOptions): {
|
|
19
|
-
queryKey: QueryKey;
|
|
20
|
-
queryFn: (context: QueryFunctionContext) => Promise<ModelsCountQueryData>;
|
|
21
|
-
};
|
|
22
|
-
export declare function queryKeyModelsCount(): QueryKey;
|
|
23
|
-
//# sourceMappingURL=modelsCount.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 { modelsCount } from "../funcs/modelsCount.js";
|
|
6
|
-
import { combineSignals } from "../lib/primitives.js";
|
|
7
|
-
import { unwrapAsync } from "../types/fp.js";
|
|
8
|
-
import { useOpenRouterContext } from "./_context.js";
|
|
9
|
-
/**
|
|
10
|
-
* Get total count of available models
|
|
11
|
-
*/
|
|
12
|
-
export function useModelsCount(options) {
|
|
13
|
-
const client = useOpenRouterContext();
|
|
14
|
-
return useQuery({
|
|
15
|
-
...buildModelsCountQuery(client, options),
|
|
16
|
-
...options,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Get total count of available models
|
|
21
|
-
*/
|
|
22
|
-
export function useModelsCountSuspense(options) {
|
|
23
|
-
const client = useOpenRouterContext();
|
|
24
|
-
return useSuspenseQuery({
|
|
25
|
-
...buildModelsCountQuery(client, options),
|
|
26
|
-
...options,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export function prefetchModelsCount(queryClient, client$) {
|
|
30
|
-
return queryClient.prefetchQuery({
|
|
31
|
-
...buildModelsCountQuery(client$),
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
export function setModelsCountData(client, data) {
|
|
35
|
-
const key = queryKeyModelsCount();
|
|
36
|
-
return client.setQueryData(key, data);
|
|
37
|
-
}
|
|
38
|
-
export function invalidateAllModelsCount(client, filters) {
|
|
39
|
-
return client.invalidateQueries({
|
|
40
|
-
...filters,
|
|
41
|
-
queryKey: ["@openrouter/sdk", "Models", "count"],
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
export function buildModelsCountQuery(client$, options) {
|
|
45
|
-
return {
|
|
46
|
-
queryKey: queryKeyModelsCount(),
|
|
47
|
-
queryFn: async function modelsCountQueryFn(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(modelsCount(client$, mergedOptions));
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export function queryKeyModelsCount() {
|
|
58
|
-
return ["@openrouter/sdk", "Models", "count"];
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=modelsCount.js.map
|