Skip to content

[Feature] Add relay model diagnostics for connectivity, latency, and identity consistency #2834

Closed

Description

@str0203

Area

Multiple areas

What are you trying to accomplish?

This request is for a safe, unified diagnostic workflow for custom relay providers and the models exposed through them. A relay being reachable does not necessarily mean that a configured model can be called successfully, that the request is routed to the requested model, or that the endpoint supports the model capabilities OpenCodex expects.

The desired outcome is to let users quickly answer: “Can this provider/model be used right now, how fast is it, and is the observed response consistent with my configuration?” This is especially valuable for OpenAI-compatible relays and third-party gateways where model names, routing, fallbacks, and supported features may differ from the upstream service.

A related request is #1765, but this proposal expands the scope from a simple availability check to a provider-focused diagnostic view with latency, response metadata, capability checks, and routing-risk signals.

What prevents this today?

Today users have to select and invoke providers/models one at a time, use ad-hoc curl commands, or inspect raw logs. This makes it difficult to compare custom relays and to distinguish:

  • network/DNS/TLS failures from authentication failures;
  • an unavailable model from rate limiting or quota exhaustion;
  • a slow provider from a slow first token or slow generation;
  • a configured model ID from the model ID actually returned by the endpoint;
  • a genuine capability mismatch from a silent fallback or model substitution.

Provider catalog information alone cannot expose these cases. A manual test prompt can consume credits or accidentally send user content. Users currently lack a consistent, low-risk way to verify custom relay behaviour before relying on it for real work.

What should OpenCodex do?

The diagnostic workflow should be available from the UI, with an optional CLI/JSON interface, and should support testing one model, all models for one provider, or all configured custom providers.

1. Lightweight connectivity check

When possible, provide a check that does not run a real completion. Report endpoint reachability, DNS/TLS/HTTP status, authentication validity, API compatibility, and whether the configured model can be discovered from the provider catalog or endpoint.

2. Controlled minimal request test

When the user explicitly starts an active test, send a fixed, very short, non-private request. Clearly distinguish this from the lightweight check and warn that it may consume quota or incur a small charge. Use bounded concurrency, limited retries, cancellation, and no conversation history, files, secrets, or user prompts. Record connection time, time to first token (TTFT), total response time, HTTP status, and a redacted error category. Preserve the last result and timestamp.

3. Identity, routing, and capability consistency

Use observable evidence to flag discrepancies between configuration and behaviour, including:

  • configured provider/model ID versus the response model field;
  • resolved provider/model route and fallback information;
  • provider metadata and declared capabilities;
  • streaming, tool-calling, vision, reasoning, and context-window behaviour;
  • usage fields, including prompt/completion tokens and cache-read/cache-write tokens when supplied;
  • response metadata across repeated or cross-model checks.

Suggested states: Healthy / Consistent; Reachable but identity unconfirmed; Model ID mismatch; Possible fallback or model substitution; Capability mismatch; Authentication failure; Model unavailable; Rate limited; Quota exhausted; Endpoint incompatible; Timeout.

Without provider-signed attestation, OpenCodex cannot mathematically prove a model’s internal identity. The goal is to identify observable inconsistencies and substitution risks, not to make an absolute “real/fake model” claim.

Suggested UI and CLI

Provide “Test this model”, “Test all models for this provider”, and “Test all custom providers”. Show configured model, status, returned model, connect time, TTFT, total time, and risk/notes. A history view should show last check time and recent latency trends.

For automation, consider:

ocx providers diagnose --provider example-relay --model claude-opus-5
ocx providers diagnose --provider example-relay --all-models
ocx providers diagnose --all --json

JSON output would allow scripts or routing decisions to consume the results.

Example usage or interface

The exact interface is up to the maintainers, but an example workflow could be:

  1. Open Providers and choose a custom relay.
  2. Click “Test all models”.
  3. Run lightweight checks first.
  4. Ask for confirmation before active completion tests because they may consume quota.
  5. Show per-model status, returned model ID, connection latency, TTFT, total latency, token usage, cache fields when available, and a redacted explanation for failures.
  6. Allow rerunning one model and exporting results as JSON.

Example output:

Provider: example-relay
Configured model       Status                    Returned model       Connect   TTFT     Total
claude-opus-5          Possible fallback        claude-sonnet-4      240 ms    820 ms   3.2 s
gpt-5.6-sol            Healthy / Consistent     gpt-5.6-sol          180 ms    410 ms   1.8 s
gemini-2.5-pro         Unavailable              —                    190 ms    —        —

The diagnostic result should never automatically delete, disable, rewrite, or remap a provider/model because of one transient failure. It should report evidence and let the user decide.

Alternatives or workarounds

Current workarounds are manual model calls, curl/Postman requests, provider dashboards, and custom scripts. These can confirm that something responds, but they do not provide a consistent comparison across providers, do not always expose TTFT or returned model metadata, and can accidentally send private content or consume more quota than expected.

A single OpenCodex workflow could reuse the provider catalog, routing resolver, request/usage logging, and capability metadata, giving users one place to understand whether a custom relay is reachable, usable, slow, incompatible, or behaving inconsistently.

Additional context

Related: #1765

Security and privacy expectations:

  • never include API keys, account identifiers, conversation content, files, or raw sensitive headers;
  • redact provider error messages before displaying or persisting them;
  • make active tests manual by default;
  • bound concurrency, retries, request size, and test frequency;
  • clearly label estimates and provider-reported fields;
  • treat missing model identity metadata as “unconfirmed”, not automatically as fraud;
  • support providers that do not expose a model catalog or cache fields.

This could start as a read-only diagnostics panel and grow incrementally: connectivity and latency first, then capability checks and evidence-based routing warnings. It would provide immediate value to custom-relay users without requiring a large all-at-once redesign.

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

  1. added
    providerProvider adapters, OpenAI-compat presets, upstream API quirks
    on Aug 28, 2026
  2. lidge-jun commented on Aug 28, 2026

    @lidge-jun
    Owner

    리뷰 · 우선순위 36 / 80

    설명

    이 이슈는 커스텀 릴레이와 그 아래 모델이 지금 쓸 수 있는지, 얼마나 느린지, 설정한 모델과 실제로 나온 답이 같은지를 한곳에서 보고 싶다는 요청이다. 릴레이가 살아 있어도 모델 호출이 실패할 수 있고, 다른 모델로 바꿔 줄 수도 있고, 도구/비전/추론을 지원하지 않을 수도 있다. 지금은 모델을 하나씩 부르거나 curl을 쓰거나 로그를 본다. 그 과정에서 실제 대화가 나가거나 크레딧이 더 나간다.

    지금 dev HEAD는 1a18aceca 이다. 패키지는 2.35.0 이다. 바로 전 머지 #2832 는 AGENTS.md 문서만 넣었다. 프로바이더 테스트 코드는 그대로다. 그 앞 #2819 는 키로 빈 exec와 끝난 답을 다시 열지 않는 수정이다. 축이 다르다. types.ts/config.ts 스플릿에 밀려 닫을 대상도 아니다. preview 배포와도 상관없다.

    이미 있는 테스트는 프로바이더 한 칸이다. src/server/management/provider-routes.ts 797행 POST /api/providers/test 가 라이브 /models 를 직접 때린다. 주석에도 적혀 있다. 카탈로그 목록에 ID가 있다고 통과시키지 않는다. 정적 카탈로그는 applicable: false / static_catalog 를 준다. 응답은 ok, latencyMs, 모델 개수, 짧은 메시지다. CLI는 src/cli/provider-runtime.ts 의 ocx provider test <name> 이다. GUI는 gui/src/components/provider-workspace/ProviderOverview.tsx 에서 같은 API를 부른다. 모델마다 표가 없고, TTFT도 없고, 돌아온 모델 ID도 비교하지 않는다.

    이 이슈가 제안한 ocx providers diagnose 는 지금 없다. 동사는 단수 ocx provider 다. ocx doctor 는 WSL, 프록시 환경, ChatGPT 도달, 코디네이터 파일 같은 환경 진단이다. 릴레이 모델 표가 아니다. 실제 트래픽 지연은 src/routing/health.ts 가 이미 모아 recentLatencyMs 로 쓴다. 그건 사용자가 누른 검사가 아니라, 이미 지나간 요청의 중간값이다.

    관련 #1765 는 이미 닫혀 있다. 그때 점수는 32/80 이었고, 이유는 대량 ping이 쿼타와 돈을 먹고 GUI 표가 크기 때문이었다. 이 이슈는 그걸 더 조심해서 다시 쓴 것이다. 가벼운 연결 검사와, 사용자가 확인한 뒤에만 하는 짧은 완성 검사를 나눈다. 대화, 파일, 비밀은 보내지 말라고 한다. 한 번 실패했다고 모델을 지우거나 끄지 말라고 한다. 가짜/진짜를 단정하지 말라고도 한다. 그 안전 장치는 맞다. 그래도 한 번에 표, CLI, 상태 열 개, 능력 검사, 히스토리까지 만들면 지금 dev 가 하는 일보다 크다.

    더 큰 구멍이 있다. 완성 검사를 지금 프록시 길로 보내면, 돌아온 response.model 을 그대로 믿으면 안 된다. src/server/responses-model-rewrite.ts 가 그 필드를 요청한 모델 ID로 다시 쓴다. src/server/responses/core.ts 1678행 근처도 같은 계약이다. 클라이언트에 보이는 모델 이름은 원래부터 맞춰 준다. 그래서 프록시 뒤에서 ID를 비교하면 거의 항상 같다고 나온다. 바꿔 치기를 보려면 다시 쓰기 전, 업스트림이 준 값을 따로 읽어야 한다. 그리고 많은 릴레이는 요청한 ID를 그냥 메아리친다. 필드가 같다고 같은 모델은 아니다. 이슈 본문도 증명은 못 한다고 이미 적었다.

    도구, 비전, 추론, 컨텍스트 창 검사는 짧은 ping이 아니다. 어댑터마다 다른 최소 요청이 필요하고, 쿼타를 먹는다. Test all custom providers 는 확인창이 있어도 한 번에 여러 키를 두드린다. 진단 결과가 라우팅이나 카탈로그를 자동으로 바꾸면 안 된다. 본문이 그걸 금지한 것은 잘한 일이다.

    라인 src/server/management/provider-routes.ts 797 - 이미 완성 없는 연결 검사다. /models 를 직접 때리고 카탈로그 존재만 보지 않는다.
    라인 src/cli/provider-runtime.ts 28 - CLI는 ocx provider test 이다. ocx providers diagnose 는 없다.
    라인 gui/src/components/provider-workspace/ProviderOverview.tsx 104 - GUI 테스트도 같은 프로바이더 API다. 모델 표, TTFT, 반환 모델 ID가 없다.
    라인 src/cli/help.ts 45 - ocx doctor 는 환경/네트워크 진단이다. 릴레이 모델 표가 아니다.
    라인 src/server/responses-model-rewrite.ts 7 - 프록시가 response.model 을 요청 ID로 다시 쓴다. 이 길로 비교하면 바꿔 치기를 못 본다.
    라인 src/routing/health.ts 325 - 실제 요청의 지연은 이미 있다. 진단 ping을 이 값에 섞지 마라.
    경로 #1765 - 같은 모델별 ping 요청을 쿼타/GUI 크기 때문에 닫았다. 중복으로 닫지 말고, 그때보다 조심한 RFC로 남겨라.

    메인테이너의 판단이 필요한 지점

    • 이 이슈를 Add per-model availability checks and latency display #1765 후속 RFC로 열어 둘지, 같은 이유로 다시 닫을지.
    • 나중에 손대면 기존 POST /api/providers/test 와 ocx provider test 만 늘릴지, 새 diagnose 동사와 대시보드 표를 만들지.
    • 완성 검사를 넣을 때, 다시 쓰기 전 업스트림 model 필드를 따로 로그할지. 프록시 응답의 model 은 비교 증거가 아니다.
    • 진단 결과를 라우팅 health 나 카탈로그에 넣을지. 넣지 않는 편이 맞다.
    • Test all 을 아예 안 만들지, 한 프로바이더 + 동시성 제한만 허용할지.

    너의 추천
    이슈는 열고, #1765 와 중복으로 닫지 마라. 지금 PR은 받지 마라. 표, 상태 열 개, 능력 검사, 히스토리는 나중에 해도 된다. 나중에 손대면 기존 /api/providers/test 와 ocx provider test --model <id> 에 짧은 완성 검사 하나만 더해라. 기본값은 한 모델, 수동, 확인 후다. 전체 프로바이더 일괄 검사는 만들지 마라. 결과는 보여 주기만 하고 설정/라우팅을 바꾸지 마라. 모델 ID 비교는 다시 쓰기 전 업스트림 값만 써라. types/config 스플릿 때문에 닫지 마라.

    이 댓글은 grok-bot이 작성했습니다

  3. added
    priority: P3Low: new provider/client integration, large or experimental feature (>2000 LOC or >50 files), RFC/ro
    on Sep 24, 2026
  4. lidge-jun commented on Sep 27, 2026

    @lidge-jun
    Owner

    Release train 4 triage (dev 24b2f39b, T4-I-2834): Keeping this open. The provider test route is mainly a connectivity probe and the CLI reports latency; they do not provide the requested per-model timing and consistency evidence. Next: keep a lightweight no-completion check, then offer a separate explicitly user-initiated, bounded fixed-prompt test that warns about quota/cost and reports TTFT, returned model metadata and redacted errors. Compare metadata with configuration; missing identity is unconfirmed, not proof of model identity or substitution.

  5. lidge-jun commented on Oct 17, 2026

    @lidge-jun
    Owner

    Partial delivery landed on dev via #7287 (merge commit 649f36c): an explicit, confirmed single provider/model completion probe (CLI and dashboard) reporting TTFT, latency and upstream-reported model match/mismatch before the proxy rewrites it. Batch probing, capability checks and history remain open here.

  6. lidge-jun commented on Oct 22, 2026

    @lidge-jun
    Owner

    #7287 added an explicit single-model completion test for relay diagnostics. Latency and identity-consistency checks can be proposed as separate, focused issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: P3Low: new provider/client integration, large or experimental feature (>2000 LOC or >50 files), RFC/roproviderProvider adapters, OpenAI-compat presets, upstream API quirks

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions