openai / openai/tiktoken

Feature Request: Allow tiktoken to accept a custom HTTP client

Open
#462 0 comments 5 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.