corent-sdk 0.1.0 → 0.2.0
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 +18 -1
- package/dist/index.cjs +21 -3
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +21 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,22 @@ console.log(speech.url, speech.costCents);
|
|
|
35
35
|
- **Backoff** — 429/5xx retried with `Retry-After` respected.
|
|
36
36
|
- **Honest receipts** — `width`/`height` are the *measured* pixels of the delivered file; `costCents` is the exact charge.
|
|
37
37
|
|
|
38
|
+
## Pick a model yourself (direct access)
|
|
39
|
+
|
|
40
|
+
Pass `model` instead of `tier` to pin an exact model. It is never substituted:
|
|
41
|
+
if that model can't deliver, the call fails and you are not charged.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
const image = await client.images.generate("a lighthouse at dusk", { model: "flux-schnell" });
|
|
45
|
+
console.log(image.model); // "flux-schnell" — the name you asked for
|
|
46
|
+
|
|
47
|
+
await client.models(); // the menu: every model with its kind, quality and exact price
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Each model has one name. When we can reach it by more than one route, Corent
|
|
51
|
+
serves whichever is cheapest at that moment and charges you that price — you
|
|
52
|
+
never have to shop between near-identical entries.
|
|
53
|
+
|
|
38
54
|
## Fine-grained control
|
|
39
55
|
|
|
40
56
|
```ts
|
|
@@ -42,7 +58,8 @@ const job = await client.images.generate("...", { tier: "max_pro", wait: false }
|
|
|
42
58
|
const done = await client.jobs.wait(job.id); // resume any time
|
|
43
59
|
|
|
44
60
|
await client.tiers(); // live catalog with honest min–max price ranges
|
|
61
|
+
await client.models(); // direct-access menu with per-model prices
|
|
45
62
|
await client.balanceCents(); // prepaid balance
|
|
46
63
|
```
|
|
47
64
|
|
|
48
|
-
Tiers: `air` | `lite` | `premium` | `pro` | `max_pro` — see [corent.tech/pricing](https://corent.tech/pricing). Docs: [corent.tech/docs](https://corent.tech/docs). MCP server for agents: [`corent-mcp`](https://www.npmjs.com/package/corent-mcp).
|
|
65
|
+
Tiers: `air` | `lite` | `premium` | `pro` | `max_pro` — see [corent.tech/pricing](https://corent.tech/pricing). Models: [corent.tech/models](https://corent.tech/models). Docs: [corent.tech/docs](https://corent.tech/docs). MCP server for agents: [`corent-mcp`](https://www.npmjs.com/package/corent-mcp).
|
package/dist/index.cjs
CHANGED
|
@@ -78,6 +78,12 @@ var Corent = class {
|
|
|
78
78
|
const r = await this.request("GET", "/v1/tiers");
|
|
79
79
|
return r.tiers;
|
|
80
80
|
}
|
|
81
|
+
/** The direct-access menu: every model you can pin by name, with its kind,
|
|
82
|
+
* quality score and flat cost-plus price. Public. */
|
|
83
|
+
async models() {
|
|
84
|
+
const r = await this.request("GET", "/v1/models");
|
|
85
|
+
return r.models;
|
|
86
|
+
}
|
|
81
87
|
/** @internal */
|
|
82
88
|
async request(method, path, body, idempotent = false) {
|
|
83
89
|
const headers = {
|
|
@@ -139,7 +145,11 @@ var Images = class {
|
|
|
139
145
|
}
|
|
140
146
|
c;
|
|
141
147
|
/** Render an image. Submits as a background job and polls, so a client
|
|
142
|
-
* timeout can never lose a finished render. Pass wait:false for the Job.
|
|
148
|
+
* timeout can never lose a finished render. Pass wait:false for the Job.
|
|
149
|
+
*
|
|
150
|
+
* `model` pins an exact model from client.models() instead of letting the
|
|
151
|
+
* router choose — direct access: never substituted, flat cost-plus price.
|
|
152
|
+
* Pass tier OR model, not both. */
|
|
143
153
|
async generate(prompt, options = {}) {
|
|
144
154
|
const body = {
|
|
145
155
|
prompt,
|
|
@@ -147,6 +157,7 @@ var Images = class {
|
|
|
147
157
|
async: true
|
|
148
158
|
};
|
|
149
159
|
if (options.tier) body.tier = options.tier;
|
|
160
|
+
if (options.model) body.model = options.model;
|
|
150
161
|
if (options.style) body.style = options.style;
|
|
151
162
|
const submitted = await this.c.request("POST", "/v1/images/generate", body, true);
|
|
152
163
|
if (submitted.status === "completed") return imageFromJob(submitted);
|
|
@@ -163,13 +174,18 @@ var Videos = class {
|
|
|
163
174
|
c;
|
|
164
175
|
/** Render a video (1–5 minutes typical). resolution: 720p | 1080p | 4k —
|
|
165
176
|
* tier-capped, clamped down rather than rejected. imageUrl animates an
|
|
166
|
-
* existing image (image-to-video).
|
|
177
|
+
* existing image (image-to-video).
|
|
178
|
+
*
|
|
179
|
+
* `model` pins an exact model from client.models() — direct access, never
|
|
180
|
+
* substituted, and duration/resolution snap to THAT model's own menu rather
|
|
181
|
+
* than a tier cap. Pass tier OR model, not both. */
|
|
167
182
|
async generate(prompt, options = {}) {
|
|
168
183
|
const body = {
|
|
169
184
|
prompt,
|
|
170
185
|
aspect_ratio: options.aspectRatio ?? "16:9"
|
|
171
186
|
};
|
|
172
187
|
if (options.tier) body.tier = options.tier;
|
|
188
|
+
if (options.model) body.model = options.model;
|
|
173
189
|
if (options.durationS !== void 0) body.duration_s = options.durationS;
|
|
174
190
|
if (options.resolution) body.resolution = options.resolution;
|
|
175
191
|
if (options.imageUrl) body.image_url = options.imageUrl;
|
|
@@ -185,10 +201,12 @@ var Speech = class {
|
|
|
185
201
|
this.c = c;
|
|
186
202
|
}
|
|
187
203
|
c;
|
|
188
|
-
/** Text to speech; synchronous, returns the finished audio and exact charge.
|
|
204
|
+
/** Text to speech; synchronous, returns the finished audio and exact charge.
|
|
205
|
+
* `model` pins an exact speech model from client.models(). */
|
|
189
206
|
async generate(text, options = {}) {
|
|
190
207
|
const body = { text };
|
|
191
208
|
if (options.voiceId) body.voice_id = options.voiceId;
|
|
209
|
+
if (options.model) body.model = options.model;
|
|
192
210
|
const r = await this.c.request("POST", "/v1/audio/speech", body, true);
|
|
193
211
|
const meta = r.meta ?? {};
|
|
194
212
|
return { id: r.id, url: r.audio_url, model: meta.model, costCents: meta.cost_cents };
|
package/dist/index.d.cts
CHANGED
|
@@ -73,6 +73,9 @@ declare class Corent {
|
|
|
73
73
|
balanceCents(): Promise<number>;
|
|
74
74
|
/** The live tier catalog with honest min–max price ranges. Public. */
|
|
75
75
|
tiers(): Promise<Record<string, unknown>[]>;
|
|
76
|
+
/** The direct-access menu: every model you can pin by name, with its kind,
|
|
77
|
+
* quality score and flat cost-plus price. Public. */
|
|
78
|
+
models(): Promise<Record<string, unknown>[]>;
|
|
76
79
|
/** @internal */
|
|
77
80
|
request(method: string, path: string, body?: Record<string, unknown>, idempotent?: boolean): Promise<Record<string, any>>;
|
|
78
81
|
/** @internal */
|
|
@@ -82,9 +85,14 @@ declare class Images {
|
|
|
82
85
|
private c;
|
|
83
86
|
constructor(c: Corent);
|
|
84
87
|
/** Render an image. Submits as a background job and polls, so a client
|
|
85
|
-
* timeout can never lose a finished render. Pass wait:false for the Job.
|
|
88
|
+
* timeout can never lose a finished render. Pass wait:false for the Job.
|
|
89
|
+
*
|
|
90
|
+
* `model` pins an exact model from client.models() instead of letting the
|
|
91
|
+
* router choose — direct access: never substituted, flat cost-plus price.
|
|
92
|
+
* Pass tier OR model, not both. */
|
|
86
93
|
generate(prompt: string, options?: {
|
|
87
94
|
tier?: Tier;
|
|
95
|
+
model?: string;
|
|
88
96
|
style?: string;
|
|
89
97
|
aspectRatio?: string;
|
|
90
98
|
wait?: false | true;
|
|
@@ -96,9 +104,14 @@ declare class Videos {
|
|
|
96
104
|
constructor(c: Corent);
|
|
97
105
|
/** Render a video (1–5 minutes typical). resolution: 720p | 1080p | 4k —
|
|
98
106
|
* tier-capped, clamped down rather than rejected. imageUrl animates an
|
|
99
|
-
* existing image (image-to-video).
|
|
107
|
+
* existing image (image-to-video).
|
|
108
|
+
*
|
|
109
|
+
* `model` pins an exact model from client.models() — direct access, never
|
|
110
|
+
* substituted, and duration/resolution snap to THAT model's own menu rather
|
|
111
|
+
* than a tier cap. Pass tier OR model, not both. */
|
|
100
112
|
generate(prompt: string, options?: {
|
|
101
113
|
tier?: Tier;
|
|
114
|
+
model?: string;
|
|
102
115
|
aspectRatio?: string;
|
|
103
116
|
durationS?: number;
|
|
104
117
|
resolution?: "720p" | "1080p" | "4k";
|
|
@@ -110,9 +123,11 @@ declare class Videos {
|
|
|
110
123
|
declare class Speech {
|
|
111
124
|
private c;
|
|
112
125
|
constructor(c: Corent);
|
|
113
|
-
/** Text to speech; synchronous, returns the finished audio and exact charge.
|
|
126
|
+
/** Text to speech; synchronous, returns the finished audio and exact charge.
|
|
127
|
+
* `model` pins an exact speech model from client.models(). */
|
|
114
128
|
generate(text: string, options?: {
|
|
115
129
|
voiceId?: string;
|
|
130
|
+
model?: string;
|
|
116
131
|
}): Promise<GeneratedSpeech>;
|
|
117
132
|
}
|
|
118
133
|
declare class Jobs {
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,9 @@ declare class Corent {
|
|
|
73
73
|
balanceCents(): Promise<number>;
|
|
74
74
|
/** The live tier catalog with honest min–max price ranges. Public. */
|
|
75
75
|
tiers(): Promise<Record<string, unknown>[]>;
|
|
76
|
+
/** The direct-access menu: every model you can pin by name, with its kind,
|
|
77
|
+
* quality score and flat cost-plus price. Public. */
|
|
78
|
+
models(): Promise<Record<string, unknown>[]>;
|
|
76
79
|
/** @internal */
|
|
77
80
|
request(method: string, path: string, body?: Record<string, unknown>, idempotent?: boolean): Promise<Record<string, any>>;
|
|
78
81
|
/** @internal */
|
|
@@ -82,9 +85,14 @@ declare class Images {
|
|
|
82
85
|
private c;
|
|
83
86
|
constructor(c: Corent);
|
|
84
87
|
/** Render an image. Submits as a background job and polls, so a client
|
|
85
|
-
* timeout can never lose a finished render. Pass wait:false for the Job.
|
|
88
|
+
* timeout can never lose a finished render. Pass wait:false for the Job.
|
|
89
|
+
*
|
|
90
|
+
* `model` pins an exact model from client.models() instead of letting the
|
|
91
|
+
* router choose — direct access: never substituted, flat cost-plus price.
|
|
92
|
+
* Pass tier OR model, not both. */
|
|
86
93
|
generate(prompt: string, options?: {
|
|
87
94
|
tier?: Tier;
|
|
95
|
+
model?: string;
|
|
88
96
|
style?: string;
|
|
89
97
|
aspectRatio?: string;
|
|
90
98
|
wait?: false | true;
|
|
@@ -96,9 +104,14 @@ declare class Videos {
|
|
|
96
104
|
constructor(c: Corent);
|
|
97
105
|
/** Render a video (1–5 minutes typical). resolution: 720p | 1080p | 4k —
|
|
98
106
|
* tier-capped, clamped down rather than rejected. imageUrl animates an
|
|
99
|
-
* existing image (image-to-video).
|
|
107
|
+
* existing image (image-to-video).
|
|
108
|
+
*
|
|
109
|
+
* `model` pins an exact model from client.models() — direct access, never
|
|
110
|
+
* substituted, and duration/resolution snap to THAT model's own menu rather
|
|
111
|
+
* than a tier cap. Pass tier OR model, not both. */
|
|
100
112
|
generate(prompt: string, options?: {
|
|
101
113
|
tier?: Tier;
|
|
114
|
+
model?: string;
|
|
102
115
|
aspectRatio?: string;
|
|
103
116
|
durationS?: number;
|
|
104
117
|
resolution?: "720p" | "1080p" | "4k";
|
|
@@ -110,9 +123,11 @@ declare class Videos {
|
|
|
110
123
|
declare class Speech {
|
|
111
124
|
private c;
|
|
112
125
|
constructor(c: Corent);
|
|
113
|
-
/** Text to speech; synchronous, returns the finished audio and exact charge.
|
|
126
|
+
/** Text to speech; synchronous, returns the finished audio and exact charge.
|
|
127
|
+
* `model` pins an exact speech model from client.models(). */
|
|
114
128
|
generate(text: string, options?: {
|
|
115
129
|
voiceId?: string;
|
|
130
|
+
model?: string;
|
|
116
131
|
}): Promise<GeneratedSpeech>;
|
|
117
132
|
}
|
|
118
133
|
declare class Jobs {
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,12 @@ var Corent = class {
|
|
|
50
50
|
const r = await this.request("GET", "/v1/tiers");
|
|
51
51
|
return r.tiers;
|
|
52
52
|
}
|
|
53
|
+
/** The direct-access menu: every model you can pin by name, with its kind,
|
|
54
|
+
* quality score and flat cost-plus price. Public. */
|
|
55
|
+
async models() {
|
|
56
|
+
const r = await this.request("GET", "/v1/models");
|
|
57
|
+
return r.models;
|
|
58
|
+
}
|
|
53
59
|
/** @internal */
|
|
54
60
|
async request(method, path, body, idempotent = false) {
|
|
55
61
|
const headers = {
|
|
@@ -111,7 +117,11 @@ var Images = class {
|
|
|
111
117
|
}
|
|
112
118
|
c;
|
|
113
119
|
/** Render an image. Submits as a background job and polls, so a client
|
|
114
|
-
* timeout can never lose a finished render. Pass wait:false for the Job.
|
|
120
|
+
* timeout can never lose a finished render. Pass wait:false for the Job.
|
|
121
|
+
*
|
|
122
|
+
* `model` pins an exact model from client.models() instead of letting the
|
|
123
|
+
* router choose — direct access: never substituted, flat cost-plus price.
|
|
124
|
+
* Pass tier OR model, not both. */
|
|
115
125
|
async generate(prompt, options = {}) {
|
|
116
126
|
const body = {
|
|
117
127
|
prompt,
|
|
@@ -119,6 +129,7 @@ var Images = class {
|
|
|
119
129
|
async: true
|
|
120
130
|
};
|
|
121
131
|
if (options.tier) body.tier = options.tier;
|
|
132
|
+
if (options.model) body.model = options.model;
|
|
122
133
|
if (options.style) body.style = options.style;
|
|
123
134
|
const submitted = await this.c.request("POST", "/v1/images/generate", body, true);
|
|
124
135
|
if (submitted.status === "completed") return imageFromJob(submitted);
|
|
@@ -135,13 +146,18 @@ var Videos = class {
|
|
|
135
146
|
c;
|
|
136
147
|
/** Render a video (1–5 minutes typical). resolution: 720p | 1080p | 4k —
|
|
137
148
|
* tier-capped, clamped down rather than rejected. imageUrl animates an
|
|
138
|
-
* existing image (image-to-video).
|
|
149
|
+
* existing image (image-to-video).
|
|
150
|
+
*
|
|
151
|
+
* `model` pins an exact model from client.models() — direct access, never
|
|
152
|
+
* substituted, and duration/resolution snap to THAT model's own menu rather
|
|
153
|
+
* than a tier cap. Pass tier OR model, not both. */
|
|
139
154
|
async generate(prompt, options = {}) {
|
|
140
155
|
const body = {
|
|
141
156
|
prompt,
|
|
142
157
|
aspect_ratio: options.aspectRatio ?? "16:9"
|
|
143
158
|
};
|
|
144
159
|
if (options.tier) body.tier = options.tier;
|
|
160
|
+
if (options.model) body.model = options.model;
|
|
145
161
|
if (options.durationS !== void 0) body.duration_s = options.durationS;
|
|
146
162
|
if (options.resolution) body.resolution = options.resolution;
|
|
147
163
|
if (options.imageUrl) body.image_url = options.imageUrl;
|
|
@@ -157,10 +173,12 @@ var Speech = class {
|
|
|
157
173
|
this.c = c;
|
|
158
174
|
}
|
|
159
175
|
c;
|
|
160
|
-
/** Text to speech; synchronous, returns the finished audio and exact charge.
|
|
176
|
+
/** Text to speech; synchronous, returns the finished audio and exact charge.
|
|
177
|
+
* `model` pins an exact speech model from client.models(). */
|
|
161
178
|
async generate(text, options = {}) {
|
|
162
179
|
const body = { text };
|
|
163
180
|
if (options.voiceId) body.voice_id = options.voiceId;
|
|
181
|
+
if (options.model) body.model = options.model;
|
|
164
182
|
const r = await this.c.request("POST", "/v1/audio/speech", body, true);
|
|
165
183
|
const meta = r.meta ?? {};
|
|
166
184
|
return { id: r.id, url: r.audio_url, model: meta.model, costCents: meta.cost_cents };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "corent-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Official TypeScript/JavaScript SDK for Corent — one API for AI image, video, and voice generation with built-in routing, failover, and exact receipts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|