@cartanova/qgrid-ai-sdk 2.9.1 → 2.9.2
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.ko.md +5 -2
- package/README.md +5 -2
- package/dist/index.d.ts +58 -27
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -204,7 +204,8 @@ const { text } = await generateText({
|
|
|
204
204
|
| `tokenName` | provider prefix를 포함한 토큰 이름 | 공통 | `anthropic/yds`처럼 활성 토큰 하나를 엄격히 지정. prefix는 model provider와 같아야 하며 빈 값·누락·inactive·quota 초과 시 다른 토큰으로 fallback하지 않음 |
|
|
205
205
|
| `logger` | `boolean` | 공통 | qgrid request log 저장 여부. 기본값은 `true`. `false`로 설정해도 client tool 실행과 multi-step 연결은 계속 동작 |
|
|
206
206
|
| `sessionKey` | `string` | OpenAI 전용 | 전체 history 재전송 시 불투명 prompt-cache affinity를 파생하는 멀티턴 대화 식별자 ([아래](#멀티턴-prompt-cache-sessionkey) 참조) |
|
|
207
|
-
| `effort` | `"
|
|
207
|
+
| `effort` | OpenAI: `"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"` \| `"ultra"` | OpenAI 전용 (`QgridOpenAIProviderOptions`) | ChatGPT 구독 Codex 경로의 reasoning 깊이. `"max"`/`"ultra"`는 GPT-5.6 계열만 지원하며, 모델이 지원하지 않는 값은 서버가 조용히 무시하고 백엔드 기본값을 적용. 공개 OpenAI API의 `"none"`/`"minimal"`은 이 경로에 없음 |
|
|
208
|
+
| `effort` | Anthropic: `"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"` | Anthropic 전용 (`QgridAnthropicProviderOptions`) | Claude Code `--effort` 허용값. 집합 밖의 값은 서버가 조용히 무시하고 qgrid 기본(`"low"`)을 적용. 모델별 상한(예: Sonnet 4.6은 `"xhigh"` 없음)은 Claude Code가 처리 |
|
|
208
209
|
| `verbosity` | `"low"` \| `"medium"` \| `"high"` | OpenAI 전용 | 응답 텍스트의 상세도 |
|
|
209
210
|
| `reasoningSummary` | `"auto"` \| `"concise"` \| `"detailed"` \| `"none"` | OpenAI 전용 | 추론 요약 출력 방식 |
|
|
210
211
|
| `serviceTier` | `string` | OpenAI 전용 | OpenAI/codex service tier |
|
|
@@ -414,11 +415,13 @@ Claude Code는 Fable의 safety refusal을 다른 Opus 모델로 자동 재시도
|
|
|
414
415
|
```typescript
|
|
415
416
|
qgrid(modelId, {
|
|
416
417
|
serverUrl?: string; // qgrid 서버 주소 (기본: QGRID_URL 환경변수 또는 http://localhost:44900)
|
|
417
|
-
defaultEffort?:
|
|
418
|
+
defaultEffort?: ...; // effort 기본값 (기본: "low"). 모델 ID prefix에 따라 provider 어휘로 타입 검사
|
|
418
419
|
projectName?: string; // request_logs.project_name (기본: QGRID_PROJECT_NAME 환경변수)
|
|
419
420
|
});
|
|
420
421
|
```
|
|
421
422
|
|
|
423
|
+
`qgrid()`는 모델 ID prefix로 오버로드되어 `openai/*`에는 `QgridOpenAIEffort`, `anthropic/*`에는 `QgridAnthropicEffort`가 `defaultEffort` 타입으로 적용됩니다. `providerOptions.qgrid`는 AI SDK 타입이 모델과 연결해 주지 않으므로 `QgridProviderOptions`는 `QgridOpenAIProviderOptions | QgridAnthropicProviderOptions`의 union이며, provider를 아는 호출자는 provider별 타입에 `satisfies`를 쓰는 편이 정확합니다.
|
|
424
|
+
|
|
422
425
|
여러 프로젝트/워크플로우가 한 qgrid 서버를 공유한다면 `QGRID_PROJECT_NAME`을 설정하세요. 대시보드에서 request log를 프로젝트별로 필터링하고 토큰/비용/캐시 지표를 워크로드별로 비교할 수 있습니다. config `projectName`은 특정 호출자만 다른 이름을 써야 할 때의 override 용도입니다.
|
|
423
426
|
|
|
424
427
|
## 환경변수
|
package/README.md
CHANGED
|
@@ -213,7 +213,8 @@ const { text } = await generateText({
|
|
|
213
213
|
| `tokenName` | provider-prefixed token name | both providers | Strictly targets one active token, such as `anthropic/yds`. The prefix must match the model provider; empty, missing, inactive, or over-threshold targets fail without fallback |
|
|
214
214
|
| `logger` | `boolean` | both providers | qgrid request logging. Defaults to `true`; `false` disables request-log persistence for this generation without disabling client tools or multi-step continuation |
|
|
215
215
|
| `sessionKey` | `string` | OpenAI only | Multi-turn conversation identifier used to derive opaque prompt-cache affinity while replaying full history (see [below](#multi-turn-prompt-cache-sessionkey)) |
|
|
216
|
-
| `effort` | `"
|
|
216
|
+
| `effort` | OpenAI: `"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"` \| `"ultra"` | OpenAI only (`QgridOpenAIProviderOptions`) | Reasoning depth on the ChatGPT-subscription Codex route. `"max"`/`"ultra"` exist on GPT-5.6 models only; a value the model does not support is silently ignored by the server and the backend default applies. The public OpenAI API's `"none"`/`"minimal"` do not exist on this route |
|
|
217
|
+
| `effort` | Anthropic: `"low"` \| `"medium"` \| `"high"` \| `"xhigh"` \| `"max"` | Anthropic only (`QgridAnthropicProviderOptions`) | Claude Code `--effort` levels. Values outside this set are silently ignored and qgrid's default (`"low"`) applies; per-model limits (for example no `"xhigh"` on Sonnet 4.6) are handled by Claude Code |
|
|
217
218
|
| `verbosity` | `"low"` \| `"medium"` \| `"high"` | OpenAI only | Response text verbosity |
|
|
218
219
|
| `reasoningSummary` | `"auto"` \| `"concise"` \| `"detailed"` \| `"none"` | OpenAI only | Reasoning summary output mode |
|
|
219
220
|
| `serviceTier` | `string` | OpenAI only | OpenAI/codex service tier |
|
|
@@ -424,11 +425,13 @@ Claude Code may automatically retry a Fable safety refusal on another Opus model
|
|
|
424
425
|
```typescript
|
|
425
426
|
qgrid(modelId, {
|
|
426
427
|
serverUrl?: string; // qgrid server address (default: QGRID_URL env var, then http://localhost:44900)
|
|
427
|
-
defaultEffort?:
|
|
428
|
+
defaultEffort?: ...; // default effort (default: "low"); typed per provider from the model id prefix
|
|
428
429
|
projectName?: string; // request_logs.project_name (default: QGRID_PROJECT_NAME env var)
|
|
429
430
|
});
|
|
430
431
|
```
|
|
431
432
|
|
|
433
|
+
`qgrid()` is overloaded on the model id prefix, so `defaultEffort` accepts `QgridOpenAIEffort` for `openai/*` models and `QgridAnthropicEffort` for `anthropic/*` models. `providerOptions.qgrid` cannot be linked to the model by the AI SDK types, so `QgridProviderOptions` is the union of `QgridOpenAIProviderOptions` and `QgridAnthropicProviderOptions`; use the provider-specific type with `satisfies` when you know the provider.
|
|
434
|
+
|
|
432
435
|
If multiple projects/workflows share one qgrid server, set `QGRID_PROJECT_NAME`. It lets you filter request logs by project in the dashboard and compare token/cost/cache metrics per workload. The config-level `projectName` is an override for callers that need a different label.
|
|
433
436
|
|
|
434
437
|
## Environment variables
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
import { LanguageModelV3 } from "@ai-sdk/provider";
|
|
2
2
|
import { TelemetrySettings } from "ai";
|
|
3
3
|
//#region src/index.types.d.ts
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* OpenAI 경로(ChatGPT 구독 Codex 백엔드)의 reasoning effort. 백엔드 모델 카탈로그의
|
|
6
|
+
* supported_reasoning_levels 합집합이며, 공개 OpenAI API 의 `none`/`minimal` 은 이 경로에 없다.
|
|
7
|
+
* `max`/`ultra` 는 GPT-5.6 계열만 받고, 모델이 지원하지 않는 값은 서버가 조용히 무시한다.
|
|
8
|
+
*/
|
|
9
|
+
type QgridOpenAIEffort = "low" | "medium" | "high" | "xhigh" | "max" | "ultra";
|
|
10
|
+
/**
|
|
11
|
+
* Anthropic 경로(Claude Code `--effort`)의 reasoning effort. 모델별 상한(예: Sonnet 4.6 은 `xhigh`
|
|
12
|
+
* 없음)은 Claude Code 가 처리하고, 이 집합 밖의 값은 서버가 조용히 무시한다.
|
|
13
|
+
*/
|
|
14
|
+
type QgridAnthropicEffort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
15
|
+
type QgridOpenAIModel = Extract<QgridSupportedModel, `openai/${string}`>;
|
|
16
|
+
type QgridAnthropicModel = Extract<QgridSupportedModel, `anthropic/${string}`>;
|
|
17
|
+
type QgridCommonProviderConfig = {
|
|
5
18
|
serverUrl?: string;
|
|
6
|
-
defaultEffort?: string;
|
|
7
19
|
/** request_logs.project_name. default: process.env.QGRID_PROJECT_NAME */
|
|
8
20
|
projectName?: string;
|
|
9
21
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
type QgridOpenAIProviderConfig = QgridCommonProviderConfig & {
|
|
23
|
+
defaultEffort?: QgridOpenAIEffort;
|
|
24
|
+
};
|
|
25
|
+
type QgridAnthropicProviderConfig = QgridCommonProviderConfig & {
|
|
26
|
+
defaultEffort?: QgridAnthropicEffort;
|
|
27
|
+
};
|
|
28
|
+
/** `qgrid()` 는 모델 ID prefix 로 오버로드되므로 보통 provider 별 타입이 추론된다. */
|
|
29
|
+
type QgridProviderConfig = QgridOpenAIProviderConfig | QgridAnthropicProviderConfig;
|
|
30
|
+
type QgridCommonProviderOptions = {
|
|
15
31
|
/**
|
|
16
32
|
* 이 요청을 처리할 활성 qgrid 토큰 이름. provider prefix를 포함해야 하며 다른 토큰으로 fallback하지 않는다.
|
|
17
33
|
*/
|
|
@@ -21,34 +37,30 @@ type QgridProviderOptions = {
|
|
|
21
37
|
* false여도 client tool 실행과 multi-step 연결은 계속 동작한다.
|
|
22
38
|
*/
|
|
23
39
|
logger?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* @todo 향후 qgrid 서버 fallback routing에 사용할 후보 모델 목록.
|
|
42
|
+
* Claude Code가 처리하는 Fable safety-refusal fallback과는 무관하다.
|
|
43
|
+
*/
|
|
44
|
+
fallbackModels?: string[];
|
|
45
|
+
};
|
|
46
|
+
/** `providerOptions.qgrid` — OpenAI(Codex) 모델용. */
|
|
47
|
+
type QgridOpenAIProviderOptions = QgridCommonProviderOptions & {
|
|
24
48
|
/**
|
|
25
49
|
* 멀티턴 프롬프트 캐시 어피니티용 대화 식별자, 호출자가 자기 도메인 ID(예: 게임 세션 ID) 하나만 넘기면
|
|
26
50
|
* provider가 model+sessionKey에서 opaque cache affinity를 결정적으로 파생해 회송한다.
|
|
27
51
|
* 원문 sessionKey는 서버에 전송하지 않으며 좌표는 model+sessionKey 별로 격리된다.
|
|
28
52
|
*/
|
|
29
53
|
sessionKey?: string;
|
|
30
|
-
/** reasoning
|
|
31
|
-
effort?:
|
|
32
|
-
/** 응답 텍스트의 상세도.
|
|
54
|
+
/** reasoning 깊이. 기본값은 qgrid config의 defaultEffort. 모델이 지원하지 않는 값은 서버가 무시한다. */
|
|
55
|
+
effort?: QgridOpenAIEffort;
|
|
56
|
+
/** 응답 텍스트의 상세도. */
|
|
33
57
|
verbosity?: "low" | "medium" | "high";
|
|
34
|
-
/** reasoning
|
|
58
|
+
/** reasoning 요약 출력 방식. */
|
|
35
59
|
reasoningSummary?: "auto" | "concise" | "detailed" | "none";
|
|
36
|
-
/**
|
|
60
|
+
/** Codex service tier. */
|
|
37
61
|
serviceTier?: string;
|
|
38
62
|
/**
|
|
39
|
-
*
|
|
40
|
-
* 사용되며, SDK의 non-stream 요청별 HTTP headers/body timeout은 이 값보다 60초 길게 설정된다.
|
|
41
|
-
* AI SDK 표준 timeout은 provider에 숫자를 전달하지 않고 abortSignal로 변환되므로, 서버 측
|
|
42
|
-
* 제한을 바꾸려면 이 옵션을 사용한다. 양의 정수만 허용하며 최대 30분, 기본 240초다.
|
|
43
|
-
*/
|
|
44
|
-
timeoutMs?: number;
|
|
45
|
-
/**
|
|
46
|
-
* @todo 향후 qgrid 서버 fallback routing에 사용할 후보 모델 목록.
|
|
47
|
-
* Claude Code가 처리하는 Fable 5 safety-refusal fallback과는 무관하다.
|
|
48
|
-
*/
|
|
49
|
-
fallbackModels?: string[];
|
|
50
|
-
/**
|
|
51
|
-
* OpenAI Responses image_generation tool 을 켠다. OpenAI route + non-stream 전용.
|
|
63
|
+
* OpenAI Responses image_generation tool 을 켠다. non-stream 전용.
|
|
52
64
|
* generateText 결과의 files 로 이미지를 받는다. streaming(streamText)에서는 거부된다.
|
|
53
65
|
*/
|
|
54
66
|
imageGeneration?: boolean;
|
|
@@ -62,6 +74,24 @@ type QgridProviderOptions = {
|
|
|
62
74
|
size?: "1024x1024" | "1024x1536" | "1536x1024";
|
|
63
75
|
};
|
|
64
76
|
};
|
|
77
|
+
/** `providerOptions.qgrid` — Anthropic(Claude Code) 모델용. */
|
|
78
|
+
type QgridAnthropicProviderOptions = QgridCommonProviderOptions & {
|
|
79
|
+
/** reasoning 깊이. 기본값은 qgrid config의 defaultEffort. 집합 밖의 값은 서버가 무시한다. */
|
|
80
|
+
effort?: QgridAnthropicEffort;
|
|
81
|
+
/**
|
|
82
|
+
* qgrid 서버의 provider 실행 제한(ms). Claude Code 프로세스 타이머로 사용되며, SDK의 non-stream
|
|
83
|
+
* 요청별 HTTP headers/body timeout은 이 값보다 60초 길게 설정된다. AI SDK 표준 timeout은
|
|
84
|
+
* provider에 숫자를 전달하지 않고 abortSignal로 변환되므로, 서버 측 제한을 바꾸려면 이 옵션을
|
|
85
|
+
* 사용한다. 양의 정수만 허용하며 최대 30분, 기본 240초다.
|
|
86
|
+
*/
|
|
87
|
+
timeoutMs?: number;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* `providerOptions.qgrid` 의 공용 타입. AI SDK 의 providerOptions 는 모델과 연결되지 않은 JSON
|
|
91
|
+
* 레코드라 여기서는 두 provider 타입의 union 이다. provider 를 아는 호출자는
|
|
92
|
+
* `QgridOpenAIProviderOptions` / `QgridAnthropicProviderOptions` 를 직접 쓰는 편이 정확하다.
|
|
93
|
+
*/
|
|
94
|
+
type QgridProviderOptions = QgridOpenAIProviderOptions | QgridAnthropicProviderOptions;
|
|
65
95
|
type QgridSupportedModel = "openai/gpt-5.6-sol" | "openai/gpt-5.6-terra" | "openai/gpt-5.6-luna" | "openai/gpt-5.5" | "openai/gpt-5.4" | "openai/gpt-5.2" | "openai/gpt-5.4-mini" | "openai/gpt-5.3-codex" | "openai/gpt-5.3-codex-spark" | "anthropic/claude-fable-5-1" | "anthropic/claude-fable-5" | "anthropic/claude-haiku-4-5" | "anthropic/claude-sonnet-4" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-sonnet-4-7" | "anthropic/claude-sonnet-5" | "anthropic/claude-opus-4" | "anthropic/claude-opus-4-1" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "anthropic/claude-opus-4-7" | "anthropic/claude-opus-4-8" | "anthropic/claude-opus-5";
|
|
66
96
|
type QgridLoggerConfig = {
|
|
67
97
|
/** qgrid 서버 주소. default: process.env.QGRID_URL, 없으면 기본값은 "http://localhost:44900" */
|
|
@@ -95,6 +125,7 @@ type QgridLoggerConfig = {
|
|
|
95
125
|
declare function createQgridLogger(config?: QgridLoggerConfig): TelemetrySettings;
|
|
96
126
|
//#endregion
|
|
97
127
|
//#region src/index.d.ts
|
|
98
|
-
declare function qgrid(modelId:
|
|
128
|
+
declare function qgrid(modelId: QgridOpenAIModel, config?: QgridOpenAIProviderConfig): LanguageModelV3;
|
|
129
|
+
declare function qgrid(modelId: QgridAnthropicModel, config?: QgridAnthropicProviderConfig): LanguageModelV3;
|
|
99
130
|
//#endregion
|
|
100
|
-
export { type QgridLoggerConfig, type QgridProviderOptions, type QgridSupportedModel, createQgridLogger, qgrid as default, qgrid };
|
|
131
|
+
export { type QgridAnthropicEffort, type QgridAnthropicModel, type QgridAnthropicProviderConfig, type QgridAnthropicProviderOptions, type QgridLoggerConfig, type QgridOpenAIEffort, type QgridOpenAIModel, type QgridOpenAIProviderConfig, type QgridOpenAIProviderOptions, type QgridProviderConfig, type QgridProviderOptions, type QgridSupportedModel, createQgridLogger, qgrid as default, qgrid };
|