Skip to content

Fix Together AI 404 errors caused by inconsistent fingerprint generation#96

Merged
OEvortex merged 4 commits intomainfrom
copilot/fix-together-ai-404-error
Nov 21, 2025
Merged

Fix Together AI 404 errors caused by inconsistent fingerprint generation#96
OEvortex merged 4 commits intomainfrom
copilot/fix-together-ai-404-error

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

Together AI requests fail with 404 after 2-3 messages because each fingerprint generation creates a new LitAgent instance with a different random IP pool, triggering anti-bot measures.

Changes

Root cause: Static generate_fingerprint() method instantiates new LitAgent on every call, causing IPs to jump between unrelated pools:

# Before: Each call gets IP from a NEW random pool
@staticmethod
def generate_fingerprint(browser):
    agent = LitAgent()  # Fresh instance = fresh IP pool
    return {"x-forwarded-for": agent.rotate_ip(), ...}

Fix: Instance-based fingerprint generation using shared LitAgent:

# After: IPs rotate within SAME pool throughout session
def __init__(self):
    self._agent = LitAgent()  # Single instance per provider

def _generate_consistent_fingerprint(self, browser):
    return {"x-forwarded-for": self._agent.rotate_ip(), ...}

Modified files

  • Provider/TogetherAI.py: Added _generate_consistent_fingerprint() instance method, updated refresh_identity() to maintain IP header consistency
  • Provider/TTI/together.py: Cache fingerprint per session in build_headers(), added _generate_consistent_fingerprint() to Images class
  • Provider/OPENAI/TogetherAI.py: Replaced static fingerprint call with instance method

All implementations include defensive hasattr() check for random_id method.

Result

IPs now rotate predictably (e.g., 192.168.1.1192.168.1.2192.168.1.3) instead of randomly jumping pools, eliminating 404s while maintaining anti-fingerprinting rotation.

Original prompt

This section details on the original issue you should resolve

<issue_title>Together Ai 404 issue after two or three messages </issue_title>
<issue_description>Hey there!

Hope you're doing great. Thanks for the project.

Quick question, I am trying to use the together ai provider with the lit agent implementation you did. But when making the request after two or three times on the same chat conversation I get '404 error code ' not found'

I have tried many times but the last time I needed to close the tab I was on the chat and then start again and sometimes even after that stop working.

Could you please double check the code and verify is the issue is normal or should i do further implementation.

Thanks.</issue_description>

<agent_instructions>Find and fix this error
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix Together Ai 404 error after multiple messages Fix Together AI 404 errors caused by inconsistent fingerprint generation Nov 21, 2025
Copilot AI requested a review from OEvortex November 21, 2025 08:51
@OEvortex OEvortex marked this pull request as ready for review November 21, 2025 10:35
@OEvortex OEvortex merged commit 2863c27 into main Nov 21, 2025
4 checks passed
@OEvortex OEvortex deleted the copilot/fix-together-ai-404-error branch December 1, 2025 14:56
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.

Together Ai 404 issue after two or three messages

2 participants