46 lines
1.9 KiB
Markdown
46 lines
1.9 KiB
Markdown
---
|
|
spec_doc_type: spec
|
|
spec_id: input/openai-compatible-surface
|
|
status: 구현됨
|
|
source_evidence:
|
|
- type: contract
|
|
path: agent-contract/outer/openai-compatible-api.md
|
|
notes: Public compatibility behavior
|
|
- type: contract
|
|
path: agent-contract/outer/anthropic-compatible-api.md
|
|
notes: Anthropic Messages behavior
|
|
- type: code
|
|
path: apps/edge/internal/openai/routes.go
|
|
notes: HTTP routes and authentication
|
|
- type: code
|
|
path: apps/edge/internal/openai/chat_handler.go
|
|
notes: Chat validation, routing, and tools
|
|
- type: code
|
|
path: apps/edge/internal/openai/responses_handler.go
|
|
notes: Responses validation and normalized execution
|
|
- type: test
|
|
path: apps/edge/internal/openai/chat_handler_test.go
|
|
notes: Standard inference and routing regressions
|
|
---
|
|
|
|
# OpenAI-Compatible Input Surface
|
|
|
|
## Current implementation
|
|
|
|
Edge exposes model discovery, Chat Completions, Responses, legacy Completions, Anthropic Messages, and token-counting compatibility routes. Public model ids resolve to provider-pool candidates or direct provider routes.
|
|
|
|
Standard streaming, sampling, reasoning, tool definitions, tool choice, structured output, provider passthrough extensions, authentication, and compatible error envelopes are preserved. Provider-native tool calls remain structured; text fallback occurs only after an explicit native-tool rejection.
|
|
|
|
Caller metadata is a bounded string map. It is never treated as local process control or a filesystem execution context. Correlation values do not resume provider state.
|
|
|
|
## Execution paths
|
|
|
|
- OpenAI-compatible providers use the raw provider tunnel when selected by the pool.
|
|
- Normalized adapters use `RunRequest` and ordered run events.
|
|
- Disconnect and timeout cancellation use the active run id.
|
|
- Usage attribution follows the selected provider or configured model group.
|
|
|
|
## Verification
|
|
|
|
- `go test -count=1 ./apps/edge/internal/openai ./apps/node/internal/adapters/...`
|
|
- `make test-e2e`
|