Skip to content

Enhancement: fetchModelPricing support HTTPS_PROXY #12

Description

@iamwrm

Hi, could you add support for HTTPS_PROXY incase the user is behind cooperate proxy?

Activity

  1. ryoppippi commented on Jun 6, 2025

    @ryoppippi
    Member

    What is it? Could you show us the doc on it?

  2. iamwrm commented on Jun 8, 2025

    @iamwrm
    Author

    Hi, here's a write-up for http proxy and example in python, I'm not familiar with ts/js so I'm not sure what's the equivalence

    HTTP Proxy in Corporate Environments

    What is HTTP Proxy?

    An HTTP proxy sits between clients and servers, forwarding requests/responses. Corporate environments use proxies for:

    • Security: Filter malicious content and unauthorized websites
    • Monitoring: Log network traffic for compliance
    • Access Control: Block specific domains or content
    • Bandwidth: Cache content to reduce external traffic

    Environment Variables

    HTTP_PROXY=http://proxy.company.com:8080
    HTTPS_PROXY=http://proxy.company.com:8080
    NO_PROXY=localhost,127.0.0.1,.company.com

    Python Example

    import requests
    
    # Method 1: Explicit proxy
    proxies = {'http': 'http://proxy.company.com:8080', 'https': 'http://proxy.company.com:8080'}
    response = requests.get('https://httpbin.org/ip', proxies=proxies)
    
    # Method 2: Environment variables (preferred)
    import os
    os.environ['HTTPS_PROXY'] = 'http://proxy.company.com:8080'
    response = requests.get('https://httpbin.org/ip')  # Auto-uses proxy
  3. ryoppippi commented on Jun 8, 2025

    @ryoppippi
    Member

    I think ccusage is only use local file access. why you need proxy?

  4. iamwrm commented on Jun 9, 2025

    @iamwrm
    Author

    Because it needs to fetch model pricing.... Alternatively, we can add support for "local pricing data file". I'm happy to draft a PR if you think it's the right way to do. Thanks!

  5. ryoppippi commented on Jun 9, 2025

    @ryoppippi
    Member

    I think it is a good idea to change the fetch url with env variable or option of command.
    I think either way is fine.
    Please make a PR for one of them!

  6. ryoppippi commented on Jun 16, 2025

    @ryoppippi
    Member

    In case you miss it @iamwrm
    #79 (comment)

  7. iamwrm commented on Jun 17, 2025

    @iamwrm
    Author

    In case you miss it @iamwrm #79 (comment)

    I just tried, the new --offline mode solves my issue. Also closing PR. Thank you!

  8. ryoppippi commented on Jun 17, 2025

    @ryoppippi
    Member

    @iamwrm Again thank you for your contribution!!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions