Skip to content

feat(agent): route visualization through OpenRouter's Jev for shared server keys - #151

Open
tbrandenburg wants to merge 1 commit into
CopilotKit:mainfrom
tbrandenburg:feat/147-jev-openrouter-agent
Open

tbrandenburg wants to merge 1 commit into
CopilotKit:mainfrom
tbrandenburg:feat/147-jev-openrouter-agent

Conversation

@tbrandenburg

Copy link
Copy Markdown

Summary

Adds an explicit JEV_PROVIDER setting so shared-server visualization routing can use OpenRouter's Jev instead of a separate TypeSafe account. TypeSafe stays the default; nothing changes unless JEV_PROVIDER=openrouter is set.

Closes #147

Changes

  • visualization_router.py: a small JEV_PROVIDERS table (key variable, endpoint, default model) and jev_provider() / jev_url(); request_options, route and aroute read from it.
    • openrouter: OPENROUTER_API_KEY, https://openrouter.ai/api/alpha/decisions, typesafe/jev-1.14. JEV_MODEL still overrides.
  • credentials.py: server_credentials_available() checks the key for the selected provider.
  • main.py: validates JEV_PROVIDER at startup, like an unsupported LLM_MODEL. No fallback between providers.
  • Visitor (BYOK) keys are unchanged: they always use TypeSafe.
  • .env.example, docs/visualization-routing.md, docs/deployment.md document the setting.

Testing

  • New apps/agent/tests/test_jev_provider.py (6 tests): default unchanged, OpenRouter endpoint/key/model and JEV_MODEL override, missing-key error names the right variable, unknown provider rejected, BYOK stays on TypeSafe, server_credentials_available follows the provider.
  • uv run --directory apps/agent pytest: 117 passed.
  • Live, unmocked: with JEV_PROVIDER=openrouter, route(...) returned {'visualization': 'bar_chart', 'renderer': 'open_generative_ui', ...} from the real OpenRouter API. JEV_PROVIDER=bogus makes import main fail with JEV_PROVIDER must be typesafe or openrouter.
  • Full browser run through the web chat with OpenRouter Jev is covered in the follow-up PR for feat(app): choose OpenRouter or TypeSafe for Jev in the API keys dialog #148, since the web UI currently only accepts TypeSafe keys.

Notes for reviewers

…server keys

JEV_PROVIDER=openrouter selects OpenRouter's Decisions API with OPENROUTER_API_KEY and typesafe/jev-1.14 by default. TypeSafe remains the default; visitor keys always use TypeSafe; an unsupported value fails at startup with no fallback.

Closes CopilotKit#147

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(agent): route visualization through OpenRouter's Jev for shared server keys

1 participant