Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ are rejected client-side (Interfaze does not accept them).
- `temperature` ≤ 1, `max_tokens` ≤ 32000, `top_p` ≤ 1 (values above → 400).
- Both `max_tokens` and `max_completion_tokens` bound output length (`max_tokens` wins if both set).
- `n`, `seed`, `stop`, penalties, `logprobs`, `tool_choice`, `top_k` are ignored by Interfaze.
- Requests default to a 900s timeout (large OCR/document/vision jobs are slow); override with
`new Interfaze({ timeout: ... })` (milliseconds).
- The underlying OpenAI client is available at `interfaze.openai` as an escape hatch.

## License
Expand Down
3 changes: 2 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import OpenAI from "openai";
import type { ClientOptions } from "openai";

import { InterfazeChat } from "./chat.js";
import { HEADERS, INTERFAZE_BASE_URL } from "./constants.js";
import { DEFAULT_TIMEOUT_MS, HEADERS, INTERFAZE_BASE_URL } from "./constants.js";
import { InterfazeError } from "./errors.js";
import { Tasks } from "./tasks.js";

Expand Down Expand Up @@ -54,6 +54,7 @@ export class Interfaze {
apiKey: resolvedKey,
baseURL: baseURL ?? INTERFAZE_BASE_URL,
defaultHeaders: headers,
timeout: rest.timeout ?? DEFAULT_TIMEOUT_MS,
});

this.chat = new InterfazeChat(this.openai);
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const INTERFAZE_BASE_URL = "https://api.interfaze.ai/v1";
export const INTERFAZE_MODEL = "interfaze-beta";
export const DEFAULT_TIMEOUT_MS = 900_000;

/** Task names accepted in a `<task>…</task>` tag. */
export const TASK_NAMES = [
Expand Down
10 changes: 10 additions & 0 deletions test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,14 @@ describe("client construction", () => {
expect(i.openai).toBeDefined();
expect(i.openai.chat.completions).toBeDefined();
});

it("defaults the timeout above the server's 800s cap", () => {
const i = new Interfaze({ apiKey: "sk-test" });
expect((i.openai as unknown as { timeout: number }).timeout).toBe(900_000);
});

it("respects an explicit timeout", () => {
const i = new Interfaze({ apiKey: "sk-test", timeout: 30_000 });
expect((i.openai as unknown as { timeout: number }).timeout).toBe(30_000);
});
});
Loading