ParametersT - TypeScript SDK

ParametersT method reference

The TypeScript SDK and docs are currently in beta. Report issues on GitHub.

(parameters)

Overview

Parameters endpoints

Available Operations

  • getParameters - Get a model’s supported parameters and data about which are most popular

getParameters

Get a model’s supported parameters and data about which are most popular

Example Usage

1import { OpenRouter } from "@openrouter/sdk";
2
3const openRouter = new OpenRouter();
4
5async function run() {
6 const result = await openRouter.parameters.getParameters({
7 bearer: process.env["OPENROUTER_BEARER"] ?? "",
8 }, {
9 author: "<value>",
10 slug: "<value>",
11 provider: "Google AI Studio",
12 });
13
14 console.log(result);
15}
16
17run();

Standalone function

The standalone function version of this method:

1import { OpenRouterCore } from "@openrouter/sdk/core.js";
2import { parametersGetParameters } from "@openrouter/sdk/funcs/parametersGetParameters.js";
3
4// Use `OpenRouterCore` for best tree-shaking performance.
5// You can create one instance of it to use across an application.
6const openRouter = new OpenRouterCore();
7
8async function run() {
9 const res = await parametersGetParameters(openRouter, {
10 bearer: process.env["OPENROUTER_BEARER"] ?? "",
11 }, {
12 author: "<value>",
13 slug: "<value>",
14 provider: "Google AI Studio",
15 });
16 if (res.ok) {
17 const { value: result } = res;
18 console.log(result);
19 } else {
20 console.log("parametersGetParameters failed:", res.error);
21 }
22}
23
24run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

1import {
2 // Query hooks for fetching data.
3 useParametersGetParameters,
4 useParametersGetParametersSuspense,
5
6 // Utility for prefetching data during server-side rendering and in React
7 // Server Components that will be immediately available to client components
8 // using the hooks.
9 prefetchParametersGetParameters,
10
11 // Utilities to invalidate the query cache for this query in response to
12 // mutations and other user actions.
13 invalidateParametersGetParameters,
14 invalidateAllParametersGetParameters,
15} from "@openrouter/sdk/react-query/parametersGetParameters.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.GetParametersRequest✔️The request object to use for the request.
securityoperations.GetParametersSecurity✔️The security requirements to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.GetParametersResponse>

Errors

Error TypeStatus CodeContent Type
errors.UnauthorizedResponseError401application/json
errors.NotFoundResponseError404application/json
errors.InternalServerResponseError500application/json
errors.OpenRouterDefaultError4XX, 5XX*/*