quantum-ai-sdk 0.2.0 → 0.2.1

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.
Files changed (49) hide show
  1. package/dist/account.d.ts +22 -0
  2. package/dist/account.js +47 -0
  3. package/dist/agent.d.ts +12 -0
  4. package/dist/agent.js +114 -0
  5. package/dist/audio.d.ts +82 -0
  6. package/dist/audio.js +140 -0
  7. package/dist/auth.d.ts +7 -0
  8. package/dist/auth.js +8 -0
  9. package/dist/batch.d.ts +22 -0
  10. package/dist/batch.js +32 -0
  11. package/dist/chat.d.ts +27 -0
  12. package/dist/chat.js +122 -0
  13. package/dist/client.d.ts +251 -0
  14. package/dist/client.js +479 -0
  15. package/dist/compute.d.ts +37 -0
  16. package/dist/compute.js +56 -0
  17. package/dist/contact.d.ts +12 -0
  18. package/dist/contact.js +26 -0
  19. package/dist/credits.d.ts +27 -0
  20. package/dist/credits.js +40 -0
  21. package/dist/documents.d.ts +17 -0
  22. package/dist/documents.js +42 -0
  23. package/dist/embeddings.d.ts +7 -0
  24. package/dist/embeddings.js +14 -0
  25. package/dist/errors.d.ts +29 -0
  26. package/dist/errors.js +70 -0
  27. package/dist/image.d.ts +12 -0
  28. package/dist/image.js +28 -0
  29. package/dist/index.d.ts +17 -0
  30. package/dist/index.js +33 -0
  31. package/dist/jobs.d.ts +28 -0
  32. package/dist/jobs.js +56 -0
  33. package/dist/keys.d.ts +17 -0
  34. package/dist/keys.js +24 -0
  35. package/dist/models.d.ts +12 -0
  36. package/dist/models.js +16 -0
  37. package/dist/rag.d.ts +22 -0
  38. package/dist/rag.js +44 -0
  39. package/dist/realtime.d.ts +121 -0
  40. package/dist/realtime.js +259 -0
  41. package/dist/session.d.ts +7 -0
  42. package/dist/session.js +17 -0
  43. package/dist/types.d.ts +1008 -0
  44. package/dist/types.js +5 -0
  45. package/dist/video.d.ts +46 -0
  46. package/dist/video.js +74 -0
  47. package/dist/voices.d.ts +27 -0
  48. package/dist/voices.js +55 -0
  49. package/package.json +3 -3
@@ -0,0 +1,251 @@
1
+ import { RealtimeSender, RealtimeReceiver } from "./realtime.js";
2
+ import type { RealtimeConfig, RealtimeSession } from "./realtime.js";
3
+ import type { AccountPricingResponse, AgentEvent, AgentRequest, AlignRequest, AlignResponse, AsyncJobResponse, AuthAppleRequest, AuthResponse, AvatarsResponse, BalanceResponse, BatchJobInfo, BatchJobsResponse, BatchJsonlResponse, BatchSubmitRequest, BatchSubmitResponse, ChatRequest, ChatResponse, ChunkDocumentRequest, ChunkDocumentResponse, ClientOptions, CloneVoiceRequest, CloneVoiceResponse, CreateKeyRequest, CreateKeyResponse, CreditBalanceResponse, CreditPacksResponse, CreditPurchaseRequest, CreditPurchaseResponse, CreditTiersResponse, DeleteResponse, DevProgramApplyRequest, DevProgramApplyResponse, DialogueRequest, DialogueResponse, DigitalTwinRequest, DocumentRequest, DocumentResponse, DubRequest, DubResponse, EmbedRequest, EmbedResponse, HeyGenTemplatesResponse, HeyGenVoicesResponse, ImageEditRequest, ImageEditResponse, ImageRequest, ImageResponse, InstanceResponse, InstancesResponse, IsolateVoiceRequest, IsolateVoiceResponse, JobCreateRequest, JobCreateResponse, JobListResponse, JobStatusResponse, ListKeysResponse, MissionEvent, MissionRequest, ModelInfo, MusicRequest, MusicResponse, PhotoAvatarRequest, PricingInfo, ProcessDocumentRequest, ProcessDocumentResponse, ProvisionRequest, ProvisionResponse, RAGCorpus, RAGSearchRequest, RAGSearchResponse, RemixVoiceRequest, RemixVoiceResponse, ResponseMeta, SessionChatRequest, SessionChatResponse, SoundEffectRequest, SoundEffectResponse, SpeechToSpeechRequest, SpeechToSpeechResponse, SSHKeyRequest, StarfishTTSRequest, StarfishTTSResponse, StatusResponse, STTRequest, STTResponse, StreamEvent, SurrealRAGProvidersResponse, SurrealRAGSearchRequest, SurrealRAGSearchResponse, TemplatesResponse, TTSRequest, TTSResponse, UsageQuery, UsageResponse, UsageSummaryResponse, VideoRequest, VideoResponse, VideoStudioRequest, VideoTranslateRequest, VoiceDesignRequest, VoiceDesignResponse, VoicesResponse } from "./types.js";
4
+ /**
5
+ * QuantumClient is the Quantum AI API client.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const client = new QuantumClient("qai_key_xxx");
10
+ *
11
+ * const resp = await client.chat({
12
+ * model: "claude-sonnet-4-6",
13
+ * messages: [{ role: "user", content: "Hello!" }],
14
+ * });
15
+ * ```
16
+ */
17
+ export declare class QuantumClient {
18
+ private readonly apiKey;
19
+ private readonly baseUrl;
20
+ private readonly _fetch;
21
+ constructor(apiKey: string, options?: ClientOptions);
22
+ /** @internal — used by realtime module to build WebSocket URL. */
23
+ get _baseUrl(): string;
24
+ /** @internal — used by realtime module for auth. */
25
+ get _apiKey(): string;
26
+ /** Send a non-streaming chat request. */
27
+ chat(req: ChatRequest): Promise<ChatResponse>;
28
+ /**
29
+ * Send a streaming chat request. Returns an AsyncIterableIterator of StreamEvents.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * for await (const event of client.chatStream({
34
+ * model: "gpt-5-mini",
35
+ * messages: [{ role: "user", content: "Write a haiku" }],
36
+ * })) {
37
+ * process.stdout.write(event.delta?.text ?? "");
38
+ * }
39
+ * ```
40
+ */
41
+ chatStream(req: ChatRequest, signal?: AbortSignal): AsyncIterableIterator<StreamEvent>;
42
+ /**
43
+ * Send a session-based chat request. The server manages conversation history.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * // Start a new session
48
+ * const resp = await client.chatSession({
49
+ * message: "Hello!",
50
+ * model: "claude-sonnet-4-6",
51
+ * });
52
+ *
53
+ * // Continue the conversation
54
+ * const resp2 = await client.chatSession({
55
+ * session_id: resp.session_id,
56
+ * message: "Tell me more",
57
+ * });
58
+ * ```
59
+ */
60
+ chatSession(req: SessionChatRequest): Promise<SessionChatResponse>;
61
+ /**
62
+ * Run a server-side agent orchestration. Streams SSE events as the
63
+ * conductor delegates work to workers.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * for await (const event of client.agentRun({
68
+ * task: "Research the latest AI papers and summarize them",
69
+ * })) {
70
+ * console.log(event.type, event);
71
+ * }
72
+ * ```
73
+ */
74
+ agentRun(req: AgentRequest, signal?: AbortSignal): AsyncIterableIterator<AgentEvent>;
75
+ /**
76
+ * Run a full mission orchestration. Streams SSE events as the conductor
77
+ * plans, delegates, and workers execute.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * for await (const event of client.missionRun({
82
+ * goal: "Build a REST API server in Go",
83
+ * })) {
84
+ * console.log(event.type, event);
85
+ * }
86
+ * ```
87
+ */
88
+ missionRun(req: MissionRequest, signal?: AbortSignal): AsyncIterableIterator<MissionEvent>;
89
+ /** Generate images from a text prompt. */
90
+ generateImage(req: ImageRequest): Promise<ImageResponse>;
91
+ /** Edit images using an AI model. */
92
+ editImage(req: ImageEditRequest): Promise<ImageEditResponse>;
93
+ /** Generate speech from text. */
94
+ speak(req: TTSRequest): Promise<TTSResponse>;
95
+ /** Convert speech to text. */
96
+ transcribe(req: STTRequest): Promise<STTResponse>;
97
+ /** Generate sound effects from a text prompt (ElevenLabs). */
98
+ soundEffects(req: SoundEffectRequest): Promise<SoundEffectResponse>;
99
+ /** Generate music from a text prompt. */
100
+ generateMusic(req: MusicRequest): Promise<MusicResponse>;
101
+ /** Generate multi-speaker dialogue audio (ElevenLabs). */
102
+ dialogue(req: DialogueRequest): Promise<DialogueResponse>;
103
+ /** Convert speech audio to a different voice (ElevenLabs). */
104
+ speechToSpeech(req: SpeechToSpeechRequest): Promise<SpeechToSpeechResponse>;
105
+ /** Remove background noise and isolate speech (ElevenLabs). */
106
+ isolateVoice(req: IsolateVoiceRequest): Promise<IsolateVoiceResponse>;
107
+ /** Transform a voice by modifying attributes (ElevenLabs). */
108
+ remixVoice(req: RemixVoiceRequest): Promise<RemixVoiceResponse>;
109
+ /** Dub audio/video into a target language (ElevenLabs). */
110
+ dub(req: DubRequest): Promise<DubResponse>;
111
+ /** Get word-level timestamps for audio+text alignment (ElevenLabs). */
112
+ align(req: AlignRequest): Promise<AlignResponse>;
113
+ /** Generate voice previews from a text description (ElevenLabs). */
114
+ voiceDesign(req: VoiceDesignRequest): Promise<VoiceDesignResponse>;
115
+ /** Generate speech using HeyGen's Starfish TTS model. */
116
+ starfishTTS(req: StarfishTTSRequest): Promise<StarfishTTSResponse>;
117
+ /**
118
+ * Generate a video from a text prompt.
119
+ *
120
+ * Video generation is slow (30s-5min). For production use, consider
121
+ * submitting via the Jobs API instead.
122
+ */
123
+ generateVideo(req: VideoRequest): Promise<VideoResponse>;
124
+ /** Create a talking-head video via HeyGen Studio. Returns an async job. */
125
+ videoStudio(req: VideoStudioRequest): Promise<AsyncJobResponse>;
126
+ /** Submit a video translation job via HeyGen. Returns an async job. */
127
+ videoTranslate(req: VideoTranslateRequest): Promise<AsyncJobResponse>;
128
+ /** Create a photo avatar via HeyGen. Returns an async job. */
129
+ videoPhotoAvatar(req: PhotoAvatarRequest): Promise<AsyncJobResponse>;
130
+ /** Create a digital twin via HeyGen. Returns an async job. */
131
+ videoDigitalTwin(req: DigitalTwinRequest): Promise<AsyncJobResponse>;
132
+ /** List available HeyGen avatars. */
133
+ videoAvatars(): Promise<AvatarsResponse>;
134
+ /** List available HeyGen templates. */
135
+ videoTemplates(): Promise<HeyGenTemplatesResponse>;
136
+ /** List available HeyGen voices. */
137
+ videoHeygenVoices(): Promise<HeyGenVoicesResponse>;
138
+ /** Generate text embeddings for the given inputs. */
139
+ embed(req: EmbedRequest): Promise<EmbedResponse>;
140
+ /** Extract text content from a document (PDF, image, etc.). */
141
+ extractDocument(req: DocumentRequest): Promise<DocumentResponse>;
142
+ /** Chunk a document into smaller pieces for embedding or processing. */
143
+ chunkDocument(req: ChunkDocumentRequest): Promise<ChunkDocumentResponse>;
144
+ /** Process a document with extraction + optional instructions. */
145
+ processDocument(req: ProcessDocumentRequest): Promise<ProcessDocumentResponse>;
146
+ /** Search Vertex AI RAG corpora for relevant documentation. */
147
+ ragSearch(req: RAGSearchRequest): Promise<RAGSearchResponse>;
148
+ /** List available Vertex AI RAG corpora. */
149
+ ragCorpora(): Promise<RAGCorpus[]>;
150
+ /** Search provider API documentation via SurrealDB vector search. */
151
+ surrealRagSearch(req: SurrealRAGSearchRequest): Promise<SurrealRAGSearchResponse>;
152
+ /** List available documentation providers in SurrealDB RAG. */
153
+ surrealRagProviders(): Promise<SurrealRAGProvidersResponse>;
154
+ /** List all available models with provider and pricing information. */
155
+ listModels(): Promise<ModelInfo[]>;
156
+ /** Get the complete pricing table for all models. */
157
+ getPricing(): Promise<PricingInfo[]>;
158
+ /** Get the account credit balance. */
159
+ accountBalance(): Promise<BalanceResponse>;
160
+ /** Get paginated usage history. */
161
+ accountUsage(query?: UsageQuery): Promise<UsageResponse>;
162
+ /** Get monthly usage summary. */
163
+ accountUsageSummary(months?: number): Promise<UsageSummaryResponse>;
164
+ /** Get the full pricing table (model ID -> pricing entry map). */
165
+ accountPricing(): Promise<AccountPricingResponse>;
166
+ /** Create an async job. Returns the job ID for polling. */
167
+ createJob(req: JobCreateRequest): Promise<JobCreateResponse>;
168
+ /** Check the status of an async job. */
169
+ getJob(jobId: string): Promise<JobStatusResponse>;
170
+ /**
171
+ * Poll a job until completion or timeout.
172
+ *
173
+ * @param jobId - Job ID to poll.
174
+ * @param intervalMs - Polling interval in milliseconds (default 2000).
175
+ * @param maxAttempts - Maximum poll attempts before timeout (default 150).
176
+ */
177
+ pollJob(jobId: string, intervalMs?: number, maxAttempts?: number): Promise<JobStatusResponse>;
178
+ /** List all jobs for the authenticated user. */
179
+ listJobs(): Promise<JobListResponse>;
180
+ /** Create a scoped API key. */
181
+ createKey(req: CreateKeyRequest): Promise<CreateKeyResponse>;
182
+ /** List all API keys for the authenticated user. */
183
+ listKeys(): Promise<ListKeysResponse>;
184
+ /** Revoke an API key. */
185
+ revokeKey(id: string): Promise<StatusResponse>;
186
+ /** Get available compute templates with pricing. */
187
+ computeTemplates(): Promise<TemplatesResponse>;
188
+ /** Provision a new GPU compute instance. */
189
+ computeProvision(req: ProvisionRequest): Promise<ProvisionResponse>;
190
+ /** List all compute instances for the authenticated user. */
191
+ computeInstances(): Promise<InstancesResponse>;
192
+ /** Get full status of a single compute instance. */
193
+ computeInstance(id: string): Promise<InstanceResponse>;
194
+ /** Tear down a compute instance and finalize billing. */
195
+ computeDelete(id: string): Promise<DeleteResponse>;
196
+ /** Inject an SSH public key into a running instance. */
197
+ computeSSHKey(id: string, req: SSHKeyRequest): Promise<StatusResponse>;
198
+ /** Reset the inactivity timer on a compute instance. */
199
+ computeKeepalive(id: string): Promise<StatusResponse>;
200
+ /** List all available voices (ElevenLabs). */
201
+ listVoices(): Promise<VoicesResponse>;
202
+ /** Create an instant voice clone from audio samples (ElevenLabs). */
203
+ cloneVoice(req: CloneVoiceRequest): Promise<CloneVoiceResponse>;
204
+ /** Delete a cloned voice (ElevenLabs). */
205
+ deleteVoice(id: string): Promise<StatusResponse>;
206
+ /**
207
+ * Open a realtime voice session via WebSocket (proxy path).
208
+ * Returns [sender, receiver] for bidirectional audio communication.
209
+ */
210
+ realtimeConnect(config?: RealtimeConfig): Promise<[RealtimeSender, RealtimeReceiver]>;
211
+ /** Request an ephemeral token for direct xAI voice connection (lower latency). */
212
+ realtimeSession(): Promise<RealtimeSession>;
213
+ /** End a realtime session and finalize billing. */
214
+ realtimeEnd(sessionId: string, durationSeconds: number): Promise<void>;
215
+ /** Refresh an ephemeral token for long sessions (>4 min). */
216
+ realtimeRefresh(sessionId: string): Promise<string>;
217
+ /** Submit a batch of jobs for processing. */
218
+ batchSubmit(req: BatchSubmitRequest): Promise<BatchSubmitResponse>;
219
+ /** Submit a batch of jobs using JSONL format. */
220
+ batchSubmitJsonl(jsonl: string): Promise<BatchJsonlResponse>;
221
+ /** List all batch jobs for the account. */
222
+ batchJobs(): Promise<BatchJobsResponse>;
223
+ /** Get the status and result of a single batch job. */
224
+ batchJob(id: string): Promise<BatchJobInfo>;
225
+ /** List available credit packs (no auth required). */
226
+ creditPacks(): Promise<CreditPacksResponse>;
227
+ /** Purchase a credit pack. Returns a checkout URL for payment. */
228
+ creditPurchase(req: CreditPurchaseRequest): Promise<CreditPurchaseResponse>;
229
+ /** Get the current credit balance. */
230
+ creditBalance(): Promise<CreditBalanceResponse>;
231
+ /** List available credit tiers (no auth required). */
232
+ creditTiers(): Promise<CreditTiersResponse>;
233
+ /** Apply for the developer program. */
234
+ devProgramApply(req: DevProgramApplyRequest): Promise<DevProgramApplyResponse>;
235
+ /** Authenticate with Apple Sign-In. */
236
+ authApple(req: AuthAppleRequest): Promise<AuthResponse>;
237
+ /**
238
+ * Send a JSON request and decode the JSON response.
239
+ * @internal
240
+ */
241
+ _doJSON<T>(method: string, path: string, body: unknown): Promise<{
242
+ data: T;
243
+ meta: ResponseMeta;
244
+ }>;
245
+ /**
246
+ * Send a JSON request expecting an SSE (text/event-stream) response.
247
+ * Returns the raw Response for the caller to read SSE events from.
248
+ * @internal
249
+ */
250
+ _doStreamRaw(path: string, body: unknown, signal?: AbortSignal): Promise<Response>;
251
+ }