Feature Request: Allow tiktoken to accept a custom HTTP client
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 19.3k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Summary
I’d like to request a feature that allows passing a custom HTTP client instance to tiktoken, rather than relying on the internal default client.
Motivation
In some environments, it’s necessary to use a custom HTTP client — for example, when the system must connect through a proxy or use a specific SSL certificate for verification. Currently, tiktoken doesn’t expose a way to inject a pre-configured client.
Example use case:
import httpx
custom_client = httpx.Client(verify="/path/to/custom/cert.pem")
tiktoken.encoding_for_model("gpt-4", http_client=custom_client)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating encoding_for_model and the current HTTP client setup, then inspect any tests covering encoding downloads. The work is done when callers can provide a custom client for proxy or certificate configuration while the existing default behavior remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100