-
Notifications
You must be signed in to change notification settings - Fork 2
/
Helicone's Header Cheatsheet
111 lines (82 loc) · 4.87 KB
/
Helicone's Header Cheatsheet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Helicone's Header Cheatsheet
Every header you need to know to access Helicone features.
## Supported Headers
**Helicone-Auth**
*string (HELICONE_API_KEY)*
This is the first header you will use, which authenticates you to send requests to the Helicone API. Here’s the format: "Helicone-Auth": "Bearer <HELICONE_API_KEY>". Remember to replace it with your actual Helicone API key.
**Helicone-Target-URL**
*string (url)*
The URL to proxy the request to when using gateway.helicone.ai. For example, https://api.openai.com/.
**Helicone-OpenAI-Api-Base**
*string (url)*
The URL to proxy the request to when using oai.helicone.ai. For example, https://[YOUR_AZURE_DOMAIN].openai.azure.com.
**Helicone-Request-Id**
*string (uuid)*
The ID of the request, in the format: 123e4567-e89b-12d3-a456-426614174000
Helicone-Model-Override
string (model)
Overrides the model used to calculate costs and mapping. Useful for when the model does not exist in URL, request or response. For example, gpt-4-1106-preview.
Helicone-Prompt-Id
string
Assigning an ID allows Helicone to associate your prompt with future versions of your prompt, and automatically manage versions on your behalf. For example, both prompt_story and this is the first prompt are valid.
Helicone-Property-[Name]
string
Custom Properties allow you to add any additional information to your requests, such as session, conversation, or app IDs. Here are some examples of custom property headers and values: Helicone-Property-Session: 121, Helicone-Property-App: mobile, or Helicone-Property-MyUser: John Doe. There are no restrictions on the value.
Helicone-User-Id
string
Specify the user making the request to track and analyze user metrics, such as the number of requests, costs, and activity associated with that particular user. For example, [email protected] or db513bc9-ff1b-4747-a47b-7750d0c701d3 are both valid.
Helicone-Fallbacks
JSON string dump
Utilize any provider through a single endpoint by setting fallbacks. See how it’s used in Gateway Fallbacks.
Helicone-RateLimit-Policy
string
Set up a rate limit policy. The value should follow the format: [quota];w=[time_window];u=[unit];s=[segment]. For example, 10;w=1000;u=cents;s=user is a policy that allows 10 cents of requests per 1000 seconds per user.
## 3rd Party Integrations
Helicone-Posthog-Key
string
PostHog authentication for Helicone’s PostHog Integration
Helicone-Posthog-Host
string
PostHog host for Helicone’s PostHog Integration
## Feature Flags
Helicone-Omit-Response
boolean
Whether to exclude the response from the request. Set to true or false.
Helicone-Omit-Request
boolean
Whether to exclude the request from the response. Set to true or false.
Helicone-Cache-Enabled
boolean
Whether to cache your responses. Set to true or false. You can customize the behavior of the cache feature by setting additional headers in your request.
Additional headers:
Cache-control: Specify the cache limit as a string in seconds, i.e. max-age=3600 is 1 hour.
Helicone-Cache-Bucket-Max-Size: The size of cache bucket represented as a number.
Helicone-Cache-Seed: Define a separate cache state as a string to generate predictable results, i.e. user-123.
*Note:* Header values have to be strings. For example, "Helicone-Cache-Bucket-Max-Size": "10".
Helicone-Retry-Enabled
boolean
Retry requests to overcome rate limits and overloaded servers. Set to true or false. You can customize the behavior of the retries feature by setting additional headers in your request.
Additional headers:
helicone-retry-num: Number of retries as a number.
helicone-retry-factor: Exponential backoff factor as a number.
helicone-retry-min-timeout: Minimum timeout (in milliseconds) between retries as a number.
helicone-retry-max-timeout: Maximum timeout (in milliseconds) between retries as a number.
*Note:* Header values have to be strings. For example, "helicone-retry-num": "3".
Helicone-Moderations-Enabled
boolean
Activate OpenAI moderation to safeguard your chat completions. Set to true or false.
Helicone-LLM-Security-Enabled
boolean
Secure OpenAI chat completions against prompt injections. Set to true or false.
Helicone-Stream-Force-Format
boolean
Enforce proper stream formatting for libraries that do not inherently support it, such as Ruby. Set to true or false.
## Response Headers
Helicone-Id Indicates the ID of the request. !
Helicone-Cache Indicates whether the response was cached. Returns HIT or MISS.
Helicone-Cache-Bucket-Idx Indicates the cache bucket index used as a number.
Helicone-Fallback-Index Indicates fallback idex used as a number.
Helicone-RateLimit-Limit Indicates the quota for the number of requests allowed in the time window.
Helicone-RateLimit-Remaining Indicates the remaining quota in the current window as a number.
Helicone-RateLimit-Policy Indicates the active rate limit policy.
For most up-to-date list of Helicone headers, please refer to: https://docs.helicone.ai/helicone-headers/header-directory