@reopt-ai/brandapp-sdk 3.0.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +574 -0
  2. package/LICENSE +21 -0
  3. package/README.md +468 -0
  4. package/dist/ai/index.d.ts +314 -0
  5. package/dist/ai/index.js +7 -0
  6. package/dist/ai-provider/index.d.ts +196 -0
  7. package/dist/ai-provider/index.js +703 -0
  8. package/dist/auth/index.d.ts +76 -0
  9. package/dist/auth/index.js +40 -0
  10. package/dist/better-auth/client.d.ts +29 -0
  11. package/dist/better-auth/client.js +10 -0
  12. package/dist/better-auth/index.d.ts +82 -0
  13. package/dist/better-auth/index.js +145 -0
  14. package/dist/chunk-6FLYVNZI.js +32 -0
  15. package/dist/chunk-6KPKZ7ZB.js +49 -0
  16. package/dist/chunk-DI6QJPTQ.js +449 -0
  17. package/dist/chunk-E457LO5A.js +599 -0
  18. package/dist/chunk-F7BXBTZI.js +54 -0
  19. package/dist/chunk-J5Y2GSJF.js +443 -0
  20. package/dist/chunk-K3YVJE6E.js +96 -0
  21. package/dist/chunk-KU2LN5SE.js +350 -0
  22. package/dist/chunk-L4DHB36G.js +75 -0
  23. package/dist/chunk-PJZB4VP7.js +63 -0
  24. package/dist/chunk-REIKXSMY.js +7 -0
  25. package/dist/chunk-T2WXHAAC.js +54 -0
  26. package/dist/chunk-TUKIYH4Q.js +112 -0
  27. package/dist/chunk-WSEROZVO.js +81 -0
  28. package/dist/chunk-YRGLBM6V.js +157 -0
  29. package/dist/client-BkcO-0C2.d.ts +216 -0
  30. package/dist/client-CN5_tNOC.d.ts +147 -0
  31. package/dist/client-DttyeM_h.d.ts +102 -0
  32. package/dist/cms/index.d.ts +137 -0
  33. package/dist/cms/index.js +101 -0
  34. package/dist/config-CtxyJsDR.d.ts +397 -0
  35. package/dist/dev/index.d.ts +509 -0
  36. package/dist/dev/index.js +3071 -0
  37. package/dist/eav/coerce.d.ts +42 -0
  38. package/dist/eav/coerce.js +65 -0
  39. package/dist/eav/index.d.ts +214 -0
  40. package/dist/eav/index.js +147 -0
  41. package/dist/eav/migrate.d.ts +236 -0
  42. package/dist/eav/migrate.js +219 -0
  43. package/dist/eav/schema.d.ts +260 -0
  44. package/dist/eav/schema.js +656 -0
  45. package/dist/errors-5hd5ZR-M.d.ts +158 -0
  46. package/dist/feedback/index.d.ts +132 -0
  47. package/dist/feedback/index.js +5 -0
  48. package/dist/files/index.d.ts +54 -0
  49. package/dist/files/index.js +31 -0
  50. package/dist/index.d.ts +221 -0
  51. package/dist/index.js +84 -0
  52. package/dist/plans/index.d.ts +140 -0
  53. package/dist/plans/index.js +5 -0
  54. package/dist/push/index.d.ts +79 -0
  55. package/dist/push/index.js +5 -0
  56. package/dist/react/hooks.d.ts +376 -0
  57. package/dist/react/hooks.js +421 -0
  58. package/dist/terms/index.d.ts +79 -0
  59. package/dist/terms/index.js +5 -0
  60. package/dist/testing/index.d.ts +154 -0
  61. package/dist/testing/index.js +81 -0
  62. package/dist/typed-client-BxOVIiMU.d.ts +40 -0
  63. package/dist/types-6E3ZLL9X.d.ts +24 -0
  64. package/dist/types-DskYLVb8.d.ts +104 -0
  65. package/dist/types-ckmDDW3N.d.ts +129 -0
  66. package/dist/webhooks/index.d.ts +140 -0
  67. package/dist/webhooks/index.js +142 -0
  68. package/docs/api-reference.md +557 -0
  69. package/docs/cms.md +318 -0
  70. package/docs/dev-server.md +164 -0
  71. package/docs/environment.md +211 -0
  72. package/docs/errors.md +290 -0
  73. package/docs/files.md +272 -0
  74. package/docs/migration.md +315 -0
  75. package/docs/testing.md +163 -0
  76. package/package.json +173 -0
@@ -0,0 +1,314 @@
1
+ import { q as ReoptSDKConfig } from '../config-CtxyJsDR.js';
2
+
3
+ /** 메시지 역할 */
4
+ type MessageRole = "system" | "user" | "assistant";
5
+ /** 채팅 메시지 */
6
+ type ChatMessage = {
7
+ role: MessageRole;
8
+ content: string;
9
+ };
10
+ /** AI completion 요청 옵션 */
11
+ type CompletionOptions = {
12
+ /** 모델 ID (e.g. "anthropic/claude-haiku-4.5"). 미지정 시 BrandApp 기본 모델. */
13
+ model?: string;
14
+ /** 커스텀 에이전트 ID (e.g. "custom:uuid") */
15
+ agentId?: string;
16
+ /** 메시지 배열 */
17
+ messages: ChatMessage[];
18
+ /** 최대 출력 토큰 (기본 4096) */
19
+ maxTokens?: number;
20
+ /** 생성 온도 (0-2) */
21
+ temperature?: number;
22
+ /** BrandappCustomer ID (사용량 추적용) */
23
+ customerId?: string;
24
+ /** AbortSignal for request cancellation */
25
+ signal?: AbortSignal;
26
+ };
27
+ /**
28
+ * 생성 종료 사유. `unified`는 AI SDK v3 finishReason과 같은 어휘다. 서버가 보고하면
29
+ * 채워지고, 미보고 시 생략된다(소비처는 없으면 정상 종료로 간주).
30
+ */
31
+ type FinishReason = {
32
+ unified: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "other";
33
+ raw?: string;
34
+ };
35
+ /** AI completion 응답 (non-streaming) */
36
+ type CompletionResult = {
37
+ id: string;
38
+ model: string;
39
+ message: {
40
+ role: "assistant";
41
+ content: string;
42
+ };
43
+ usage: {
44
+ promptTokens: number;
45
+ completionTokens: number;
46
+ creditCost: number;
47
+ };
48
+ creditsRemaining: number;
49
+ /** 생성 종료 사유 (서버가 보고 시) */
50
+ finishReason?: FinishReason;
51
+ /**
52
+ * true면 이 호출은 잔액을 초과해 차감됐다(출력은 이미 생성되어 반환되지만 잔액은
53
+ * 0으로 소진). 다음 호출은 사전 크레딧 체크에서 차단된다 — "1회 후 차단" 의도.
54
+ */
55
+ creditLimited?: boolean;
56
+ };
57
+ /** 크레딧 잔액 정보 */
58
+ type CreditInfo = {
59
+ balance: number;
60
+ limit: number;
61
+ percentage: number;
62
+ resetAt: string | null;
63
+ status: "normal" | "warning" | "critical" | "exhausted";
64
+ };
65
+ /**
66
+ * 사용 가능 모델 정보 — `sdk.ai.models()` / `sdk.ai.imageModels()` 응답 항목.
67
+ *
68
+ * 서버 `AvailableModel`(packages/ai)과 구조가 일치한다 — contract type-test가
69
+ * CI에서 동일성을 강제한다. `isDefault`로 "model 미지정 시 쓰이는 기본 모델"을,
70
+ * `modality`로 chat/image 구분을 사전에 알 수 있다.
71
+ */
72
+ type ModelInfo = {
73
+ id: string;
74
+ displayName: string;
75
+ description: string;
76
+ provider: string;
77
+ /** chat | image */
78
+ modality: "chat" | "image";
79
+ tier: string;
80
+ tierLabel: string;
81
+ /** credits per 1K input tokens (image-only 모델은 0) */
82
+ inputRate: number;
83
+ /** credits per 1K output tokens (image-only 모델은 0) */
84
+ outputRate: number;
85
+ /** 이미지 생성당 고정 크레딧 (image 모델 전용) */
86
+ creditsPerImage?: number;
87
+ /** 최대 입력 컨텍스트 토큰 */
88
+ contextWindow?: number;
89
+ /** 최대 출력 토큰 */
90
+ maxOutputTokens?: number;
91
+ /** 이미지/파일 입력(비전) 지원 */
92
+ supportsVision?: boolean;
93
+ /** function/tool calling 지원 (외부 brandapp API에서는 미노출이나 메타로 제공) */
94
+ supportsTools?: boolean;
95
+ /** 이 brandapp의 기본 모델인지 (modality별 기본값과 일치) */
96
+ isDefault: boolean;
97
+ };
98
+ /** 이미지 생성 요청 옵션 */
99
+ type ImageGenerateOptions = {
100
+ /** 이미지 설명 프롬프트 */
101
+ prompt: string;
102
+ /** 네거티브 프롬프트 (생성에서 제외할 요소) */
103
+ negativePrompt?: string;
104
+ /** 스타일 (e.g. "watercolor", "photorealistic") */
105
+ style?: string;
106
+ /** 종횡비 (기본 1:1) */
107
+ aspectRatio?: "1:1" | "16:9" | "9:16" | "4:3" | "3:4";
108
+ /** 이미지 모델 (기본: google/gemini-2.5-flash-image) */
109
+ model?: string;
110
+ /** BrandappCustomer ID (사용량 추적용) */
111
+ customerId?: string;
112
+ };
113
+ /** 이미지 생성 결과 */
114
+ type ImageGenerateResult = {
115
+ /** 파일 ID */
116
+ id: string;
117
+ /** 이미지 URL (Vercel Blob) */
118
+ url: string;
119
+ /** 파일 크기 (bytes) */
120
+ size: number;
121
+ /** MIME 타입 */
122
+ contentType: string;
123
+ /** 사용량 */
124
+ usage: {
125
+ creditCost: number;
126
+ };
127
+ /** 남은 크레딧 */
128
+ creditsRemaining: number;
129
+ /** true면 잔액 초과 차감(이미지는 반환되나 잔액 소진, 다음 호출 차단) */
130
+ creditLimited?: boolean;
131
+ };
132
+ /** SSE 스트림 이벤트 */
133
+ type StreamEvent = {
134
+ event: "text-delta";
135
+ data: string;
136
+ } | {
137
+ event: "done";
138
+ data: StreamDoneData;
139
+ } | {
140
+ event: "error";
141
+ data: {
142
+ code: string;
143
+ message: string;
144
+ };
145
+ };
146
+ /** 스트림 완료 메타데이터 */
147
+ type StreamDoneData = {
148
+ usage: {
149
+ promptTokens: number;
150
+ completionTokens: number;
151
+ creditCost: number;
152
+ };
153
+ creditsRemaining: number;
154
+ /** 생성 종료 사유 (서버가 보고 시) */
155
+ finishReason?: FinishReason;
156
+ };
157
+ /** 커스텀 에이전트 정보 */
158
+ type AgentInfo = {
159
+ id: string;
160
+ name: string;
161
+ description: string;
162
+ defaultModel: string;
163
+ };
164
+
165
+ /**
166
+ * BrandApp AI 클라이언트
167
+ *
168
+ * 기존 BaseHttpClient를 확장하여 AI API를 호출합니다.
169
+ * SSE 스트리밍은 fetch API를 직접 사용합니다.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * const sdk = createReoptSDK({ ... });
174
+ *
175
+ * // Non-streaming
176
+ * const result = await sdk.ai.complete({
177
+ * messages: [{ role: "user", content: "안녕하세요" }],
178
+ * });
179
+ * console.log(result.message.content);
180
+ *
181
+ * // Streaming
182
+ * for await (const chunk of sdk.ai.stream({
183
+ * messages: [{ role: "user", content: "안녕하세요" }],
184
+ * })) {
185
+ * process.stdout.write(chunk);
186
+ * }
187
+ *
188
+ * // Credits
189
+ * const credits = await sdk.ai.credits();
190
+ * console.log(`${credits.balance} / ${credits.limit}`);
191
+ *
192
+ * // Models
193
+ * const models = await sdk.ai.models();
194
+ * ```
195
+ */
196
+
197
+ declare class ReoptAiClient {
198
+ private readonly http;
199
+ /**
200
+ * Idle (inactivity) timeout for streaming, in ms — the maximum gap allowed
201
+ * *between* SSE chunks, not a deadline on the whole generation. A long but
202
+ * healthy generation keeps resetting this; only a genuine stall aborts.
203
+ */
204
+ private readonly streamIdleTimeout;
205
+ constructor(config: ReoptSDKConfig);
206
+ /**
207
+ * AI 텍스트 생성 (non-streaming)
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * const result = await sdk.ai.complete({
212
+ * messages: [{ role: "user", content: "Hello" }],
213
+ * model: "anthropic/claude-haiku-4.5",
214
+ * maxTokens: 1024,
215
+ * });
216
+ * console.log(result.message.content);
217
+ * ```
218
+ */
219
+ complete(options: CompletionOptions): Promise<CompletionResult>;
220
+ /**
221
+ * AI 텍스트 생성 (SSE 스트리밍)
222
+ *
223
+ * async generator로 텍스트 청크를 반환합니다.
224
+ * 사용량 메타데이터가 필요하면 `streamWithMetadata()`를 사용하세요.
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * for await (const chunk of sdk.ai.stream({
229
+ * messages: [{ role: "user", content: "Hello" }],
230
+ * })) {
231
+ * process.stdout.write(chunk);
232
+ * }
233
+ * ```
234
+ */
235
+ stream(options: CompletionOptions): AsyncGenerator<string>;
236
+ /**
237
+ * AI 텍스트 생성 (SSE 스트리밍 + 메타데이터)
238
+ *
239
+ * 텍스트 청크와 함께 최종 사용량/크레딧 메타데이터를 반환합니다.
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * const { textStream, metadata } = sdk.ai.streamWithMetadata({
244
+ * messages: [{ role: "user", content: "Hello" }],
245
+ * });
246
+ *
247
+ * let text = "";
248
+ * for await (const chunk of textStream) {
249
+ * text += chunk;
250
+ * }
251
+ *
252
+ * const meta = await metadata;
253
+ * console.log(`사용 크레딧: ${meta?.usage.creditCost}`);
254
+ * ```
255
+ */
256
+ streamWithMetadata(options: CompletionOptions): {
257
+ textStream: AsyncGenerator<string>;
258
+ metadata: Promise<StreamDoneData | null>;
259
+ };
260
+ /**
261
+ * 이미지 생성
262
+ *
263
+ * BrandApp의 AI 크레딧으로 이미지를 생성합니다.
264
+ * 생성된 이미지는 자동으로 Vercel Blob에 저장되고 URL이 반환됩니다.
265
+ *
266
+ * @example
267
+ * ```ts
268
+ * const image = await sdk.ai.generateImage({
269
+ * prompt: "브랜드 배너 이미지",
270
+ * style: "minimalist",
271
+ * aspectRatio: "16:9",
272
+ * });
273
+ * console.log(image.url); // https://...blob.vercel-storage.com/...
274
+ * console.log(image.size); // 12345 (bytes)
275
+ * ```
276
+ */
277
+ generateImage(options: ImageGenerateOptions): Promise<ImageGenerateResult>;
278
+ /**
279
+ * 크레딧 잔액 조회
280
+ *
281
+ * @example
282
+ * ```ts
283
+ * const credits = await sdk.ai.credits();
284
+ * console.log(`${credits.balance} / ${credits.limit} (${credits.status})`);
285
+ * ```
286
+ */
287
+ credits(): Promise<CreditInfo>;
288
+ /**
289
+ * 사용 가능 모델 목록 조회
290
+ *
291
+ * @example
292
+ * ```ts
293
+ * const models = await sdk.ai.models();
294
+ * models.forEach(m => console.log(`${m.id} (${m.tierLabel})`));
295
+ * ```
296
+ */
297
+ models(): Promise<ModelInfo[]>;
298
+ /**
299
+ * 사용 가능한 커스텀 에이전트 목록 조회
300
+ *
301
+ * @example
302
+ * ```ts
303
+ * const agents = await sdk.ai.agents();
304
+ * for (const agent of agents) {
305
+ * console.log(`${agent.name}: ${agent.description}`);
306
+ * }
307
+ * ```
308
+ */
309
+ agents(): Promise<AgentInfo[]>;
310
+ private fetchSSE;
311
+ }
312
+ declare function createReoptAiClient(config: ReoptSDKConfig): ReoptAiClient;
313
+
314
+ export { type AgentInfo, type ChatMessage, type CompletionOptions, type CompletionResult, type CreditInfo, type FinishReason, type ImageGenerateOptions, type ImageGenerateResult, type MessageRole, type ModelInfo, ReoptAiClient, type StreamDoneData, type StreamEvent, createReoptAiClient };
@@ -0,0 +1,7 @@
1
+ export { ReoptAiClient, createReoptAiClient } from '../chunk-KU2LN5SE.js';
2
+ import '../chunk-L4DHB36G.js';
3
+ import '../chunk-F7BXBTZI.js';
4
+ import '../chunk-DI6QJPTQ.js';
5
+ import '../chunk-J5Y2GSJF.js';
6
+ //# sourceMappingURL=index.js.map
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,196 @@
1
+ import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult, ImageModelV3, ImageModelV3CallOptions, ProviderV3 } from '@ai-sdk/provider';
2
+
3
+ /**
4
+ * BrandApp AI SDK LanguageModelV3 구현
5
+ *
6
+ * Vercel AI SDK의 `generateText()` / `streamText()`와 호환된다. BrandApp AI API를
7
+ * LanguageModelV3로 감싸 BrandApp 크레딧으로 텍스트를 생성한다.
8
+ *
9
+ * **미지원**: tool/function calling, 구조화 출력(`generateObject`/`responseFormat: json`),
10
+ * 비전·파일 입력, `topP`/`topK`/`frequencyPenalty`/`presencePenalty`/`stopSequences`/`seed`.
11
+ * 이들은 `warnings`로 보고되고 해당 부분은 무시된다(`collectWarnings` 참조).
12
+ */
13
+
14
+ type BrandappLanguageModelConfig = {
15
+ /** BrandApp API base URL */
16
+ baseUrl: string;
17
+ /** Basic Auth 헤더 (base64 인코딩된 clientId:clientSecret) */
18
+ authHeader: string;
19
+ /** 요청 타임아웃 (ms) */
20
+ timeout: number;
21
+ /** SDK 버전 문자열 */
22
+ sdkVersion: string;
23
+ /** BrandappCustomer ID (사용량 추적) */
24
+ customerId?: string;
25
+ /** 커스텀 fetch 함수 */
26
+ fetch?: typeof globalThis.fetch;
27
+ };
28
+ /** BrandApp 프로바이더 옵션 (providerOptions.brandapp으로 전달) */
29
+ type BrandappProviderOptions = {
30
+ /** BrandappCustomer ID (사용량 추적) */
31
+ customerId?: string;
32
+ };
33
+ declare class BrandappLanguageModel implements LanguageModelV3 {
34
+ readonly specificationVersion: "v3";
35
+ readonly provider = "brandapp";
36
+ readonly modelId: string;
37
+ readonly supportedUrls: Record<string, RegExp[]>;
38
+ private readonly config;
39
+ /** Call-invariant headers, frozen once per model instead of per request. */
40
+ private readonly baseHeaders;
41
+ constructor(modelId: string, config: BrandappLanguageModelConfig);
42
+ doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
43
+ doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
44
+ private buildRequestBody;
45
+ private collectWarnings;
46
+ private createStreamPartTransform;
47
+ }
48
+
49
+ /**
50
+ * BrandApp AI SDK ImageModelV3 구현
51
+ *
52
+ * Vercel AI SDK의 generateImage()와 호환되는
53
+ * 커스텀 이미지 생성 프로바이더입니다.
54
+ *
55
+ * BrandApp AI API의 /images/generate 엔드포인트를 ImageModelV3 인터페이스로
56
+ * 감싸서 AI SDK 생태계에서 BrandApp 크레딧으로 이미지 생성을 지원합니다.
57
+ */
58
+
59
+ type BrandappImageProviderOptions = {
60
+ /** BrandappCustomer ID (사용량 추적) */
61
+ customerId?: string;
62
+ /** 네거티브 프롬프트 (생성에서 제외할 요소) */
63
+ negativePrompt?: string;
64
+ /** 스타일 (e.g. "watercolor", "photorealistic") */
65
+ style?: string;
66
+ /** 종횡비 — 미지정 시 top-level `aspectRatio`, 그것도 없으면 "1:1" */
67
+ aspectRatio?: string;
68
+ };
69
+ declare class BrandappImageModel implements ImageModelV3 {
70
+ readonly specificationVersion: "v3";
71
+ readonly provider = "brandapp";
72
+ readonly modelId: string;
73
+ readonly maxImagesPerCall = 1;
74
+ private readonly config;
75
+ constructor(modelId: string, config: BrandappLanguageModelConfig);
76
+ doGenerate(options: ImageModelV3CallOptions): Promise<Awaited<ReturnType<ImageModelV3["doGenerate"]>>>;
77
+ private collectWarnings;
78
+ }
79
+
80
+ /**
81
+ * BrandApp AI SDK Provider
82
+ *
83
+ * Vercel AI SDK와 호환되는 커스텀 프로바이더를 생성합니다.
84
+ *
85
+ * **지원**: `generateText()`, `streamText()` (텍스트 생성), `generateImage()`
86
+ * (이미지 생성), `providerMetadata.brandapp`(크레딧/사용량), `providerOptions.brandapp`.
87
+ *
88
+ * **미지원** (호출 시 `warnings`로 알리고 해당 부분은 무시됨): tool/function calling,
89
+ * 구조화 출력(`generateObject`/`responseFormat: json`), 비전·파일 입력, `topP`/`topK`/
90
+ * `frequencyPenalty`/`presencePenalty`/`stopSequences`/`seed`. BrandApp AI API는 멀티
91
+ * 테넌트 안전을 위해 텍스트·이미지 표면만 노출한다. 임베딩/음성/전사 모델은 없다
92
+ * (`NoSuchModelError`).
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * import { createBrandappProvider } from "@reopt-ai/brandapp-sdk/ai-provider";
97
+ * import { generateText, streamText } from "ai";
98
+ *
99
+ * const brandapp = createBrandappProvider({
100
+ * clientId: process.env.BRANDAPP_CLIENT_ID!,
101
+ * clientSecret: process.env.BRANDAPP_CLIENT_SECRET!,
102
+ * brandappId: process.env.BRANDAPP_ID!,
103
+ * });
104
+ *
105
+ * // Non-streaming
106
+ * const { text } = await generateText({
107
+ * model: brandapp("anthropic/claude-haiku-4.5"),
108
+ * prompt: "안녕하세요",
109
+ * });
110
+ *
111
+ * // Streaming
112
+ * const result = streamText({
113
+ * model: brandapp("zai/glm-4.7-flash"),
114
+ * prompt: "Hello, world!",
115
+ * });
116
+ *
117
+ * for await (const chunk of result.textStream) {
118
+ * process.stdout.write(chunk);
119
+ * }
120
+ *
121
+ * // BrandApp 전용 메타데이터 접근
122
+ * const { text, providerMetadata } = await generateText({
123
+ * model: brandapp("anthropic/claude-haiku-4.5"),
124
+ * prompt: "Hello",
125
+ * });
126
+ * console.log(providerMetadata?.brandapp?.creditCost);
127
+ * console.log(providerMetadata?.brandapp?.creditsRemaining);
128
+ *
129
+ * // customerId를 providerOptions로 전달
130
+ * const { text } = await generateText({
131
+ * model: brandapp("anthropic/claude-haiku-4.5"),
132
+ * prompt: "Hello",
133
+ * providerOptions: {
134
+ * brandapp: { customerId: "customer-uuid" },
135
+ * },
136
+ * });
137
+ *
138
+ * // Image generation
139
+ * const { images } = await generateImage({
140
+ * model: brandapp.imageModel("google/gemini-2.5-flash-image"),
141
+ * prompt: "A cat sitting on a windowsill",
142
+ * });
143
+ * ```
144
+ */
145
+
146
+ type BrandappProviderConfig = {
147
+ /** OAuth Client ID. Optional when a short-lived `token` is supplied instead. */
148
+ clientId?: string;
149
+ /**
150
+ * OAuth Client Secret. Long-lived admin credential — never expose to the browser
151
+ * (see {@link assertBrowserSafe}). Optional when a `token` is supplied.
152
+ */
153
+ clientSecret?: string;
154
+ /** BrandApp ID */
155
+ brandappId: string;
156
+ /** Short-lived service token minted by `/token/mint`. */
157
+ token?: string;
158
+ /**
159
+ * 프로덕션 환경 여부.
160
+ * - `true`: https://brandapp.reopt.ai
161
+ * - `false`: https://brand.reopt.de:3443 (dev)
162
+ * - 미지정 (기본): `NODE_ENV === "production"` 자동 감지
163
+ */
164
+ isProduction?: boolean;
165
+ /** 커스텀 base URL */
166
+ baseUrl?: string;
167
+ /** 요청 타임아웃 ms (기본 60000 — AI 응답은 시간이 걸림) */
168
+ timeout?: number;
169
+ /** 기본 customerId (모든 요청에 적용) */
170
+ customerId?: string;
171
+ /** 커스텀 fetch 함수 (테스트, 미들웨어 등) */
172
+ fetch?: typeof globalThis.fetch;
173
+ };
174
+ /**
175
+ * BrandApp AI SDK 프로바이더를 생성합니다.
176
+ *
177
+ * 반환된 함수는 모델 ID를 받아 LanguageModelV3 인스턴스를 반환합니다.
178
+ * AI SDK의 generateText(), streamText() 등에서 model 파라미터로 사용합니다.
179
+ *
180
+ * @example
181
+ * ```ts
182
+ * const brandapp = createBrandappProvider({ clientId, clientSecret, brandappId });
183
+ *
184
+ * // 함수 호출로 모델 인스턴스 생성
185
+ * const model = brandapp("anthropic/claude-haiku-4.5");
186
+ *
187
+ * // AI SDK 함수에 전달
188
+ * const { text } = await generateText({ model, prompt: "Hello" });
189
+ * ```
190
+ */
191
+ declare function createBrandappProvider(config: BrandappProviderConfig): BrandappProvider;
192
+ type BrandappProvider = ProviderV3 & {
193
+ (modelId: string): LanguageModelV3;
194
+ };
195
+
196
+ export { BrandappImageModel, type BrandappImageProviderOptions, BrandappLanguageModel, type BrandappLanguageModelConfig, type BrandappProvider, type BrandappProviderConfig, type BrandappProviderOptions, createBrandappProvider };