eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
25 lines (24 loc) • 1.15 kB
TypeScript
import { type CodexAuthCredentials, type CodexChatGptCredentials, type CodexRefreshedTokens } from "./auth.js";
type Fetch = typeof globalThis.fetch;
type CodexCredentialsWriter = (input: {
readonly credentials: CodexChatGptCredentials;
readonly tokens: CodexRefreshedTokens;
}) => Promise<CodexChatGptCredentials>;
export interface CodexTransportOptions {
readonly clientId?: string;
readonly codexApiEndpoint?: string;
readonly fetch?: Fetch;
readonly issuer?: string;
readonly now?: () => number;
readonly readCredentials?: () => Promise<CodexAuthCredentials>;
readonly writeCredentials?: CodexCredentialsWriter;
}
/**
* AI SDK's OpenAI client gives eve one per-request hook: `fetch`. Codex needs
* that hook to choose credentials and endpoint per login mode, not just to swap
* the base URL. API-key logins stay on OpenAI's Responses endpoint; ChatGPT
* logins use the Codex backend with a refreshed bearer token.
*/
export declare function createCodexFetch(options?: CodexTransportOptions): Fetch;
export declare function rewriteCodexEndpoint(input: string, codexApiEndpoint?: string): string;
export {};