Skip to content

Conversation

@nikochiko
Copy link
Member

Q/A checklist

  • I have tested my UI changes on mobile and they look acceptable
  • I have tested changes to the workflows in both the API and the UI
  • I have done a code review of my changes and looked at each line of the diff + the references of each function I have changed
  • My changes have not increased the import time of the server
How to check import time?

time python -c 'import server'

You can visualize this using tuna:

python3 -X importtime -c 'import server' 2> out.log && tuna out.log

To measure import time for a specific library:

$ time python -c 'import pandas'

________________________________________________________
Executed in    1.15 secs    fish           external
   usr time    2.22 secs   86.00 micros    2.22 secs
   sys time    0.72 secs  613.00 micros    0.72 secs

To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:

def my_function():
    import pandas as pd
    ...

Legal Boilerplate

Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.

@coderabbitai
Copy link

coderabbitai bot commented Oct 7, 2025

📝 Walkthrough

Walkthrough

  • Adds LargeLanguageModels.claude_4_5_sonnet with model_id "claude-sonnet-4-5" and attributes: label, llm_api=LLMApis.openai, context_window=1_000_000, max_output_tokens=64_000, is_vision_model=True, supports_json=True, is_thinking_model=True.
  • Marks several existing Claude entries as deprecated and updates their redirect_to to point to claude_4_5_sonnet.
  • Updates scripts/init_llm_pricing.py to create pricing for "claude-sonnet-4-5" with specified unit costs, unit quantity, provider "anthropic", and pricing URL.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • devxpy

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title “feat: add claude 4.5 sonnet” directly and succinctly conveys the primary change of introducing the Claude 4.5 Sonnet model, follows conventional commit styling, and avoids extraneous details or generic phrasing.
Description Check ✅ Passed The author’s description fully matches the repository’s template by including the complete Q/A checklist, the import-time measurement instructions in a collapsible section, and the required legal boilerplate, ensuring all structural and content requirements are met.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude-45

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c73cc37 and 36b50ed.

📒 Files selected for processing (2)
  • daras_ai_v2/language_model.py (8 hunks)
  • scripts/init_llm_pricing.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
scripts/init_llm_pricing.py (1)
usage_costs/models.py (1)
  • ModelProvider (54-69)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test (3.10.12, 1.8.3)

Comment on lines +780 to +789
claude_4_5_sonnet = LLMSpec(
label="Claude 4.5 Sonnet • Anthropic",
model_id="claude-sonnet-4-5",
llm_api=LLMApis.openai,
context_window=1_000_000,
max_output_tokens=64_000,
is_vision_model=True,
supports_json=True,
is_thinking_model=True,
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify model specifications and capabilities.

The new Claude 4.5 Sonnet model definition includes impressive specifications:

  • 1M context window
  • 64K max output tokens
  • Vision, JSON, and thinking capabilities
  • Uses LLMApis.openai (OpenAI-compatible API)

Since this is beyond my knowledge cutoff, please verify:

  1. Model ID "claude-sonnet-4-5" is correct
  2. Context window is actually 1,000,000 tokens
  3. Max output tokens is actually 64,000 tokens
  4. The model supports vision, JSON mode, and extended thinking
  5. Anthropic provides an OpenAI-compatible API endpoint for Claude models (hence LLMApis.openai)

🌐 Web query:

What are the specifications for Claude 4.5 Sonnet including context window, max output tokens, and supported features (vision, JSON, thinking)? Does Anthropic offer an OpenAI-compatible API?

💡 Result:

Short answer:

  • Context window: 200,000 tokens (general availability); 1,000,000-token beta available for eligible orgs (use beta header). [1][2][3]
  • Max output tokens: 64,000 (standard GA). (Longer-output options exist as beta/extra headers for some Sonnet releases; check your account/headers). [3][4]
  • Supported features: vision (image + PDF URL support / vision capabilities), structured/JSON outputs, and extended "thinking" (step‑by‑step / extended reasoning) supported via the Messages API (native) and partially via the OpenAI‑compatibility endpoint (thinking is available but full step‑by‑step thoughts are only returned on the native Anthropic API). [1][2][5]
  • OpenAI‑compatible API: Yes — Anthropic provides an OpenAI‑SDK compatibility endpoint so you can use many OpenAI SDK fields (model, max_tokens, function calling, etc.) by changing base URL/key/model name. It has documented limitations and is intended primarily for testing/comparison rather than providing the full native feature set. [1][5]

Sources:

  1. Anthropic / API release notes and docs (OpenAI compatibility, Messages API features).
  2. Anthropic context‑windows doc (200K GA, 1M beta; context‑awareness details).
  3. Google Cloud Vertex AI model card for Claude Sonnet 4.5 (64K output; context length / beta 1M).
  4. Anthropic models overview / docs referencing long‑output headers and token limits.
  5. Anthropic OpenAI SDK compatibility documentation (details on "thinking" support and limitations).

If you want, I can paste the exact doc links or show the exact headers/parameters to use in requests.


Refine Claude 4.5 Sonnet configuration

  • context_window should be 200_000 tokens for GA (1 M is beta – requires special header)
  • max_output_tokens 64 000 is correct
  • supports_json and is_vision_model are valid
  • full step-by-step “thinking” is only available via native Anthropic API (use LLMApis.anthropic); OpenAI-compat endpoint offers partial support
  • model_id “claude-sonnet-4-5” is correct
🤖 Prompt for AI Agents
In daras_ai_v2/language_model.py around lines 780 to 789, update the Claude 4.5
Sonnet LLMSpec: set context_window to 200_000 (GA limit) instead of 1_000_000,
keep max_output_tokens at 64_000 and retain supports_json and is_vision_model,
and change llm_api from LLMApis.openai to LLMApis.anthropic so full step‑by‑step
“thinking” uses the native Anthropic API (leave model_id and is_thinking_model
as-is).

Comment on lines 847 to +848
is_deprecated=True,
redirect_to="claude_3_7_sonnet",
redirect_to="claude_4_5_sonnet",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Consider the impact of cross-tier redirects.

Several deprecated models redirect to claude_4_5_sonnet across different capability/pricing tiers:

  • claude_3_5_sonnetclaude_4_5_sonnet ✓ (same tier)
  • claude_3_opusclaude_4_5_sonnet (Opus → Sonnet)
  • claude_3_sonnetclaude_4_5_sonnet ✓ (same tier)
  • claude_3_haikuclaude_4_5_sonnet (Haiku → Sonnet)

Potential concerns:

  1. Cost impact: Users who selected claude_3_haiku for its lower cost will be redirected to a more expensive Sonnet model. The pricing difference:

    • Haiku: $0.25 input / $1.25 output per 1M tokens
    • Sonnet 4.5: $3 input / $15 output per 1M tokens (12x more expensive!)
  2. Use case mismatch: Haiku users may have chosen it for speed/throughput in high-volume scenarios where Sonnet's capabilities aren't needed.

Recommendation: Consider redirecting claude_3_haiku to a newer Haiku model (if one exists) or document this cost increase prominently.

Also applies to: 859-860, 871-872, 883-884

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.

2 participants