You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[`useOAuthExchangeAuthCodeForAPIKeyMutation`](docs/sdks/oauth/README.md#exchangeauthcodeforapikey) - Exchange authorization code for API key
519
-
-[`useParametersGetParameters`](docs/sdks/parameters/README.md#getparameters) - Get a model's supported parameters and data about which are most popular
520
-
-[`useProvidersList`](docs/sdks/providers/README.md#list) - List all providers
501
+
*[`useAnalyticsGetUserActivity`](docs/sdks/analytics/README.md#getuseractivity) - Get user activity grouped by endpoint
502
+
*[`useApiKeysCreateMutation`](docs/sdks/apikeys/README.md#create) - Create a new API key
503
+
*[`useApiKeysDeleteMutation`](docs/sdks/apikeys/README.md#delete) - Delete an API key
504
+
*[`useApiKeysGet`](docs/sdks/apikeys/README.md#get) - Get a single API key
505
+
*[`useApiKeysGetCurrentKeyMetadata`](docs/sdks/apikeys/README.md#getcurrentkeymetadata) - Get current API key
506
+
*[`useApiKeysList`](docs/sdks/apikeys/README.md#list) - List API keys
507
+
*[`useApiKeysUpdateMutation`](docs/sdks/apikeys/README.md#update) - Update an API key
508
+
*[`useBetaResponsesSendMutation`](docs/sdks/responses/README.md#send) - Create a response
509
+
*[`useChatSendMutation`](docs/sdks/chat/README.md#send) - Create a chat completion
510
+
*[`useCompletionsGenerateMutation`](docs/sdks/completions/README.md#generate) - Create a completion
511
+
*[`useCreditsCreateCoinbaseChargeMutation`](docs/sdks/credits/README.md#createcoinbasecharge) - Create a Coinbase charge for crypto payment
512
+
*[`useCreditsGetCredits`](docs/sdks/credits/README.md#getcredits) - Get remaining credits
513
+
*[`useEndpointsList`](docs/sdks/endpoints/README.md#list) - List all endpoints for a model
514
+
*[`useEndpointsListZdrEndpoints`](docs/sdks/endpoints/README.md#listzdrendpoints) - Preview the impact of ZDR on the available endpoints
515
+
*[`useGenerationsGetGeneration`](docs/sdks/generations/README.md#getgeneration) - Get request & usage metadata for a generation
516
+
*[`useModelsCount`](docs/sdks/models/README.md#count) - Get total count of available models
517
+
*[`useModelsList`](docs/sdks/models/README.md#list) - List all models and their properties
518
+
*[`useModelsListForUser`](docs/sdks/models/README.md#listforuser) - List models filtered by user provider preferences
*[`useOAuthExchangeAuthCodeForAPIKeyMutation`](docs/sdks/oauth/README.md#exchangeauthcodeforapikey) - Exchange authorization code for API key
521
+
*[`useParametersGetParameters`](docs/sdks/parameters/README.md#getparameters) - Get a model's supported parameters and data about which are most popular
522
+
*[`useProvidersList`](docs/sdks/providers/README.md#list) - List all providers
521
523
522
524
</details>
523
525
<!-- End React hooks with TanStack Query [react-query] -->
@@ -666,6 +668,7 @@ run();
666
668
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
667
669
668
670
To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
671
+
669
672
```typescript
670
673
import { OpenRouter } from"@openrouter/sdk";
671
674
@@ -803,6 +806,7 @@ run();
803
806
```
804
807
805
808
If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
809
+
806
810
```typescript
807
811
import { OpenRouter } from"@openrouter/sdk";
808
812
@@ -954,6 +958,7 @@ run();
954
958
|`error.data$`|| Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
*[`OpenRouterError`](./src/models/errors/openroutererror.ts): The base class for HTTP error responses.
1102
1109
*[`InternalServerResponseError`](./src/models/errors/internalserverresponseerror.ts): Internal Server Error - Unexpected server error. Status code `500`. *
1103
1110
@@ -1106,14 +1113,15 @@ run();
1106
1113
<br />
1107
1114
1108
1115
**Network errors:**
1116
+
1109
1117
*[`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
1110
1118
*[`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
1111
1119
*[`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
1112
1120
*[`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
1113
1121
*[`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
1114
1122
1115
-
1116
1123
**Inherit from [`OpenRouterError`](./src/models/errors/openroutererror.ts)**:
1124
+
1117
1125
*[`UnauthorizedResponseError`](./src/models/errors/unauthorizedresponseerror.ts): Unauthorized - Authentication required or invalid credentials. Status code `401`. Applicable to 14 of 22 methods.*
1118
1126
*[`BadRequestResponseError`](./src/models/errors/badrequestresponseerror.ts): Bad Request - Invalid request parameters or malformed input. Status code `400`. Applicable to 8 of 22 methods.*
1119
1127
*[`TooManyRequestsResponseError`](./src/models/errors/toomanyrequestsresponseerror.ts): Too Many Requests - Rate limit exceeded. Status code `429`. Applicable to 8 of 22 methods.*
@@ -1162,6 +1170,30 @@ You can also enable a default debug logger by setting an environment variable `O
1162
1170
1163
1171
# Development
1164
1172
1173
+
## Running Tests
1174
+
1175
+
To run the test suite, you'll need to set up your environment with an OpenRouter API key.
1176
+
1177
+
### Local Development
1178
+
1179
+
1. Copy the example environment file:
1180
+
1181
+
```bash
1182
+
cp .env.example .env
1183
+
```
1184
+
1185
+
2. Edit `.env` and add your OpenRouter API key:
1186
+
1187
+
```bash
1188
+
OPENROUTER_API_KEY=your_api_key_here
1189
+
```
1190
+
1191
+
3. Run the tests:
1192
+
1193
+
```bash
1194
+
npx vitest
1195
+
```
1196
+
1165
1197
## Maturity
1166
1198
1167
1199
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
0 commit comments