Attempt at converting to Openrouter#7
Conversation
gojun077
left a comment
There was a problem hiding this comment.
Hi, Conor - in your proposed changes, you are changing the default model and the default API;
I haven't used openrouter before, but I think it uses the OpenAI chat completions API format; isn't this different from the API format used by api.anthropic.com?
Also, to use openrouter.ai you must have an openrouter.ai account; I don't think it's a fair assumption that ALL users of efrit across the Internets will have openrouter.ai accounts.
Just my 2 cents as a drive-by reviewer of a drive-by PR
|
Hey @gojun077 thanks for reaching out. I am definitely changing the default model here - it's totally contrary to what current users of efrit would expect! I didn't expect anyone to comment on the very first commit which, by my own admission, doesn't work at all. I was hoping the 'draft' tag on this would have indicated that it was not ready for prime time 😄
Yes, Openrouter is compatible with the OpenAI API format. Additionally, it is compatible with the endpoints that OpenAI uses, so in that way at least it is more compatible than Anthropic (which uses I am still experimenting with what I would like this PR to be. However, I would politely recommend you to take a look at OpenRouter. It allows you to use all Anthropic models (which efrit currently uses) and over 100 other models too. |
|
Ok, all tests are passing and I'm able to get it working with Openrouter Line 34 in 6d129cc I've reached the goal of bootstrapping it to work on itself, which feels pretty good for today. Happy to see if anyone else can use it and add functionality/refactor it. |
|
FYI the tests didn't cover agent workflows, so that is not working right now. |
Two bugs fixed in dogfood run #7: 1. ef-i9h: efrit-do--extract-fields created alists with string keys, but tool functions used alist-get with symbol keys. Fixed by converting string keys to symbols using intern. 2. ef-yj0: efrit-do used one-shot execution (single API call) instead of proper agentic loop. Fixed by making efrit-do call efrit-execute from efrit-executor.el, which has the proper while loop that continues until stop_reason is "end_turn". Before: efrit-do would call todo_write once and return immediately After: efrit-do properly continues the conversation, executing multiple tool calls until Claude completes the task 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
No description provided.