{"record":{"id":"2d0f9b52a6dc1238","repo":"odysseus-dev/odysseus","slug":"no-session-api-key-or-configured-endpoints-pass","errorCode":null,"errorMessage":"No session, api_key, or configured endpoints. Pass api_key + model, or configure an endpoint in Admin.","messagePattern":"No session, api_key, or configured endpoints\\. Pass api_key \\+ model, or configure an endpoint in Admin\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"routes/webhook/webhook_routes.py","lineNumber":323,"sourceCode":"            sid = str(uuid.uuid4())\n            sess = session_manager.create_session(\n                session_id=sid, name=\"API Chat\", endpoint_url=endpoint_url,\n                model=model, owner=token_owner,\n            )\n            sess.headers = build_headers(api_key, base_url)\n            session_manager.save_sessions()\n            session_id = sid\n\n        # --- Case 3: Fall back to first configured ModelEndpoint ---\n        if not sess:\n            db = SessionLocal()\n            try:\n                ep = _select_api_chat_fallback_endpoint(db, token_owner)\n            finally:\n                db.close()\n\n            if not ep:\n                raise HTTPException(400,\n                    \"No session, api_key, or configured endpoints. \"\n                    \"Pass api_key + model, or configure an endpoint in Admin.\")\n\n            base_url = normalize_base(ep.base_url)\n            endpoint_url = build_chat_url(base_url)\n            model = body.model or \"auto\"\n            api_key = ep.api_key\n            if getattr(ep, \"provider_auth_id\", None):\n                try:\n                    from src.endpoint_resolver import resolve_endpoint_runtime\n                    base_url, api_key = resolve_endpoint_runtime(ep, owner=token_owner)\n                    endpoint_url = build_chat_url(base_url)\n                except Exception:\n                    raise HTTPException(500, \"Could not resolve endpoint credentials\")\n\n            if model == \"auto\":\n                try:\n                    async with httpx.AsyncClient(timeout=5) as client:","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/webhook/webhook_routes.py#L305-L341","documentation":"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.","triggerScenarios":"Fresh install with no ModelEndpoints configured; endpoints exist but none owned/visible to this token's user (owner-filtered selection); all endpoints disabled.","commonSituations":"Trying the API before finishing Admin onboarding; multi-user deployment where the admin's endpoints are not shared with the token's owner.","solutions":["Configure a ModelEndpoint in Admin (base_url + api_key) and retry","Or pass api_key (+ model/provider or base_url) directly in the request body","If endpoints exist, verify they are active and assigned/visible to the token's user"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# preflight before first chat call\nhas_key = bool(body_api_key)\nhas_endpoints = any_active_endpoints_for(token_owner)  # admin/API check\nif not has_key and not has_endpoints:\n    guide_user_to_configure_endpoint()","typeGuard":null,"tryCatchPattern":"if resp.status_code == 400 and 'No session, api_key, or configured endpoints' in detail:\n    open_admin_setup()  # create ModelEndpoint or instruct user to pass api_key","preventionTips":["Complete Admin endpoint configuration before distributing API tokens","Onboarding checklists should include one working ModelEndpoint or documented api_key usage"],"tags":["config","chat","endpoint","http-400"],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}