odysseus-dev/odysseus · error · HTTPException

No session, api_key, or configured endpoints. Pass api_key +

Error message

No session, api_key, or configured endpoints. Pass api_key + model, or configure an endpoint in Admin.

What it means

HTTP 400 from POST /v1/chat Case 3: the caller supplied neither a session, nor an api_key, and _select_api_chat_fallback_endpoint(db, token_owner) found no configured ModelEndpoint usable by this token owner. The endpoint has nothing to send the message to.

Source

Thrown at routes/webhook/webhook_routes.py:323

            sid = str(uuid.uuid4())
            sess = session_manager.create_session(
                session_id=sid, name="API Chat", endpoint_url=endpoint_url,
                model=model, owner=token_owner,
            )
            sess.headers = build_headers(api_key, base_url)
            session_manager.save_sessions()
            session_id = sid

        # --- Case 3: Fall back to first configured ModelEndpoint ---
        if not sess:
            db = SessionLocal()
            try:
                ep = _select_api_chat_fallback_endpoint(db, token_owner)
            finally:
                db.close()

            if not ep:
                raise HTTPException(400,
                    "No session, api_key, or configured endpoints. "
                    "Pass api_key + model, or configure an endpoint in Admin.")

            base_url = normalize_base(ep.base_url)
            endpoint_url = build_chat_url(base_url)
            model = body.model or "auto"
            api_key = ep.api_key
            if getattr(ep, "provider_auth_id", None):
                try:
                    from src.endpoint_resolver import resolve_endpoint_runtime
                    base_url, api_key = resolve_endpoint_runtime(ep, owner=token_owner)
                    endpoint_url = build_chat_url(base_url)
                except Exception:
                    raise HTTPException(500, "Could not resolve endpoint credentials")

            if model == "auto":
                try:
                    async with httpx.AsyncClient(timeout=5) as client:

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Configure a ModelEndpoint in Admin (base_url + api_key) and retry
  2. Or pass api_key (+ model/provider or base_url) directly in the request body
  3. If endpoints exist, verify they are active and assigned/visible to the token's user
Defensive patterns

Strategy: validation

Validate before calling

# preflight before first chat call
has_key = bool(body_api_key)
has_endpoints = any_active_endpoints_for(token_owner)  # admin/API check
if not has_key and not has_endpoints:
    guide_user_to_configure_endpoint()

Try / catch

if resp.status_code == 400 and 'No session, api_key, or configured endpoints' in detail:
    open_admin_setup()  # create ModelEndpoint or instruct user to pass api_key

Prevention

When it happens

Trigger: Fresh install with no ModelEndpoints configured; endpoints exist but none owned/visible to this token's user (owner-filtered selection); all endpoints disabled.

Common situations: Trying the API before finishing Admin onboarding; multi-user deployment where the admin's endpoints are not shared with the token's owner.

Related errors


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/2d0f9b52a6dc1238. Report an issue: GitHub.