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
Modzy's Javascript SDK simplifies tasks such as querying models, submitting jobs, and returning results. It supports both Node.js and browser JavaScript applications using the output target of your build system to know which code to use.
From the command line in your project directory, run `yarn add @modzy/modzy-sdk` or `npm install @modzy/modzy-sdk`.
14
-
Then import the ModzyClient class into your code:
17
+
# Installation
18
+
19
+
Intall Modzy's JavaScript SDK with NPM
15
20
16
21
```bash
17
-
yarn add @modzy/modzy-sdk
18
-
# or
19
22
npm install @modzy/modzy-sdk
20
23
```
24
+
or YARN
21
25
22
-
```javascript
23
-
import { ModzyClient } from"@modzy/modzy-sdk";
26
+
```bash
27
+
yarn add @modzy/modzy-sdk
24
28
```
25
29
26
-
---
30
+
# Usage/Examples
27
31
28
-
## Initialize
29
-
30
-
To initialize `ModzyClient`, you need an [api key](https://docs.modzy.com/docs/getting-started#key-download-your-api-key). If using an installation of Modzy other than app.modzy.com, you'll also need to provide the url for your instance of Modzy. For debugging purposes, you can also turn on logging.
31
-
32
-
⚠️ _Warning: Keep your API key secret. Do not include it in a git repo or store it on GitHub_
32
+
## Initializing the SDK
33
+
Initialize your client by authenticating with an API key. You can [download an API Key](https://docs.modzy.com/docs/view-and-manage-api-keys#download-team-api-key) from your instance of Modzy.
33
34
34
35
```javascript
35
-
// app.modzy.com
36
-
constmodzyClient=newModzyClient({
37
-
apiKey:"xxxxxxxxxxxxx.xxxxxxxxxxxxx",
38
-
});
36
+
import { ModzyClient } from"@modzy/modzy-sdk";
39
37
40
-
// or for private Modzy instances
41
38
constmodzyClient=newModzyClient({
42
-
apiKey:"xxxxxxxxxxxxx.xxxxxxxxxxxxx",
43
-
url:"https://modzy.yourdomain.com",
39
+
apiKey:"Valid Modzy API Key", //e.g., "JbFkWZMx4Ea3epIrxSgA.a2fR36fZi3sdFPoztAXT"
Convert images and other large inputs to base64 embedded data and submit to a model by providing a model ID, version number, and dictionary with one or more base64 encoded inputs:
Check out our [samples](https://github.com/modzy/sdk-javascript/tree/main/samples) for details on specific use cases.
82
-
Samples are intended to be run using Node.js, but most can also run in the browser. The `react examples` directory contains a couple of react components to show how you can use the browser to send files to, or retrieve files from Modzy. To run the samples using app.modzy.com, make sure to update the line `const API_KEY = process.env.MODZY_API_KEY;` to contain a real api key from your account.
141
+
*[`samples`](https://github.com/modzy/sdk-javascript/tree/main/samples) provides details for specific use cases and are intended to be run using Node.js, but most can also run in the browser
142
+
*[`react examples`](https://github.com/modzy/sdk-javascript/tree/main/samples/react%20examples) contains react components that can be used to the browser to send files to, or retrieve files from Modzy.
143
+
144
+
To run these examples, make sure to update `API_KEY` and `MODZY_URL` to valid values.
83
145
84
-
---
146
+
## Running Tests
85
147
86
-
## Running tests
87
-
88
-
The Jest tests expect that there is a .env file at the root of the repo that contains a
89
-
valid app.modzy.com api key like this:
148
+
The Jest tests expect that there is a .env file at the root of the repo that contains a valid Modzy api key like this:
90
149
91
150
```
92
151
API_KEY=xxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx
93
152
```
94
153
95
-
---
154
+
# Documentation
155
+
156
+
Modzy's SDK is built on top of the [Modzy HTTP/REST API](https://docs.modzy.com/reference/introduction). For a full list of features and supported routes visit [JavaScript SDK on docs.modzy.com](https://docs.modzy.com/docs/javascript)
157
+
158
+
# Support
159
+
160
+
For support, email [email protected] or join our [Slack](https://www.modzy.com/slack).
161
+
162
+
# Contributing
96
163
97
-
## Contributing
164
+
Contributions are always welcome!
98
165
99
-
We are happy to receive contributions from all of our users. Check out our [contributing file](https://github.com/modzy/sdk-javascript/tree/main/contributing.adoc) to learn more.
166
+
See [`contributing.md`](https://github.com/modzy/sdk-javascript/tree/main/contributing.adoc)for ways to get started.
100
167
101
-
---
168
+
Please adhere to this project's `code of conduct`.
102
169
103
-
## Code of conduct
170
+
We are happy to receive contributions from all of our users. Check out our contributing file to learn more.
104
171
105
-
Please see our [code of conduct](https://github.com/modzy/sdk-javascript/tree/main//CODE_OF_CONDUCT.md) for any questions about the kind of community we are trying to build.
0 commit comments