Skip to content

Architecture Overview

GodeX is a gateway that translates OpenAI Responses API requests into Chat Completions API calls for any configured upstream provider. Understanding the full request lifecycle is essential for debugging compatibility issues, adding new providers, or extending the bridge. This page traces a single request from the moment the Bun server receives it to the point where the reconstructed response is returned to the caller.

At a Glance

LayerComponentResponsibility
CLIserveBootstraps config, registrar, ApplicationContext, and Bun server
ApplicationApplicationContextHolds config, resolver, registrar, session store, trace recorder
ApplicationApplicationServicesFactory that wires logger, ModelResolver, Registrar, ResponsesBridgeRuntime
ServercreateBuiltinRoutesMaps /health, /v1/models, /v1/responses to handlers
RoutehandleResponsesParses request, creates ResponsesContext, dispatches
ContextResponsesContextPer-request state: resolved model, provider, session, diagnostics
BridgeProviderExchangeBuilds Chat Completion request, calls upstream, records traces
BridgeResponsesBridgeRuntimeSelects sync or stream pipeline
ProviderRegistrarManages ProviderEdge factories and resolved instances
ResolverModelResolverMaps model selectors to (provider, model) pairs

Request Lifecycle

Core Types

Startup Sequence

Request Processing Sequence

Bridge Pipeline Detail

The bridge pipeline inside ProviderExchange follows a fixed sequence. Each step contributes decisions and data that downstream steps consume:

StepFunctionOutput
1planBridgeCompatibilityCompatibility plan with parameter decisions
2planToolsTool declarations, tool_choice, tool decisions
3planOutputContractResponse format plan (native, degraded, or synthetic)
4normalizeCurrentInput + normalizeResponseItemsNormalized ChatCompletionMessageParam[]
5buildChatMessagesMerged assistant messages with tool calls
6applyToolsrequest.tools and request.tool_choice
7applyRequestOptionsstream, temperature, top_p, max_tokens, reasoning

Cross-References

References