thaipass 0.0.0 → 0.1.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 CHANGED
@@ -1,35 +1,27 @@
1
1
  # thaipass
2
2
 
3
- **AI SDK provider for AI Pass, using your own session cookie.**
4
-
5
- > Placeholder release. The provider is not implemented yet — the name is
6
- > reserved and nothing is stable until `0.1.0`.
7
-
8
- ## Install
3
+ AI SDK provider for [AI Pass](https://de.aipass.net). `streamText` and `generateText` run against the models your account already sees in the web UI, with your own session cookie and no server in between.
9
4
 
10
5
  ```bash
11
6
  bun add thaipass
12
7
  ```
13
8
 
14
- ## Usage
15
-
16
- Not available yet. The published `0.0.0` only exports package metadata:
17
-
18
9
  ```ts
19
- import { description, name } from 'thaipass'
10
+ import { streamText } from "ai";
11
+ import { createAipass } from "thaipass";
20
12
 
21
- console.log(name, description)
13
+ const aipass = createAipass({ cookie: process.env.AIPASS_COOKIE ?? "" });
14
+
15
+ const result = streamText({
16
+ model: aipass("claude-sonnet-5@default"),
17
+ prompt: "hi",
18
+ });
22
19
  ```
23
20
 
24
- ## Development
21
+ The cookie is the full `Cookie` header of a browser signed in to AI Pass. It must contain `__Secure-ai_passport_auth.session_token`.
25
22
 
26
- ```bash
27
- bun install
28
- bun test
29
- bun run typecheck
30
- bun run build
31
- ```
23
+ The provider implements `LanguageModelV2` for `ai` v5. File parts upload as attachments, and a generated file comes back as the SDK's own file part. `providerOptions.aipass.thinkingLevel` picks a reasoning level, and sampling settings come back as `unsupported-setting` warnings. `usage` holds token estimates, and `providerMetadata.aipass.credits` holds the credit balance.
32
24
 
33
- ## License
25
+ `createAipass` also takes `origin` for a different AI Pass host and `logger` for the warnings the provider has no reply to attach to. Both apply to the whole process.
34
26
 
35
- [MIT](./LICENSE)
27
+ This is a reverse-engineered adapter over an undocumented private API. Keep it to a single account you own. The code is MIT, and the rest of the story, from attachments to the edge's refusals, is in the [thaipass README](https://github.com/PunGrumpy/thaipass#readme).
package/dist/index.d.ts CHANGED
@@ -1,15 +1,39 @@
1
+ import { LanguageModelV2 } from "@ai-sdk/provider";
2
+ import { z } from "zod";
3
+ //#region ../core/src/aipass/models.d.ts
1
4
  /**
2
- * thaipass AI SDK provider for AI Pass, using your own session cookie.
3
- *
4
- * Placeholder release. The provider is not implemented yet; nothing exported
5
- * here is stable, and everything may change before 0.1.0.
5
+ * The chat ids the proxy knew when it was built. The account's catalog on
6
+ * `/loaders/list-models` decides what a chat request may name. This list
7
+ * stands in when the catalog cannot be read, seeds the docs, and feeds the
8
+ * drift warning. A media id needs per-model knowledge the catalog does not
9
+ * carry, so the media lists below stay the gate for their routes.
6
10
  */
7
- /** Package name, as published on npm. */
8
- export declare const name = "thaipass";
9
- /** Human-readable one-liner describing the package. */
10
- export declare const description = "AI SDK provider for AI Pass, using your own session cookie.";
11
- declare const _default: {
12
- name: string;
13
- description: string;
14
- };
15
- export default _default;
11
+ declare const CHAT_MODELS: readonly ["gpt-5.6-terra", "gpt-5.6-sol", "claude-opus-5@azure", "claude-sonnet-5@default", "gemini-3.1-pro-preview", "gemini-3.7-flash", "gemini-3.1-flash-lite", "glm-5.2", "grok-4.3", "DeepSeek-V3.2", "minimax-m2-maas", "qwen3-next-80b-a3b-instruct-maas", "Kimi-K2.7-Code", "Mistral-Large-3", "Mistral-Medium-3", "Llama-4-Scout-17B-16E-Instruct-1", "Llama-4-Maverick-17B-128E-Instruct-FP8-1", "pathumma-thaillm-8b", "openai-deep-research", "openthai2.0-legal@jts", "sonar", "sonar-reasoning-pro", "sonar-deep-research"];
12
+ type KnownChatModel = (typeof CHAT_MODELS)[number];
13
+ //#endregion
14
+ //#region ../core/src/lib/config.d.ts
15
+ interface WarningFields {
16
+ readonly msg: string;
17
+ readonly [detail: string]: string | number;
18
+ }
19
+ interface UpstreamLogger {
20
+ readonly warn: (fields: WarningFields) => void;
21
+ }
22
+ //#endregion
23
+ //#region src/index.d.ts
24
+ /** The known ids complete in an editor; any other string is left to the catalog. */
25
+ export type AipassModelId = KnownChatModel | (string & Record<never, never>);
26
+ export interface AipassProviderSettings {
27
+ /** The Cookie header of a browser signed in to AI Pass. */
28
+ readonly cookie: string;
29
+ /** Process-wide; defaults to https://de.aipass.net. */
30
+ readonly origin?: string;
31
+ /** Process-wide; silent by default. */
32
+ readonly logger?: UpstreamLogger;
33
+ }
34
+ export interface AipassProvider {
35
+ (modelId?: AipassModelId): LanguageModelV2;
36
+ readonly languageModel: (modelId?: string) => LanguageModelV2;
37
+ }
38
+ export declare const createAipass: (settings: AipassProviderSettings) => AipassProvider;
39
+ //#endregion