From 568b34568513ec211c403b6b6e01b7ef19beb2d0 Mon Sep 17 00:00:00 2001 From: Clement Bouvet Date: Mon, 26 Jan 2026 15:44:39 +0100 Subject: [PATCH 1/3] docs: add tags field documentation Add documentation for the optional tags string array field in completion requests across all SDK docs and the OpenAPI spec. - Add tags property to ChatCompletionRequest in openapi.json - Update InputObject tables in all SDK send/stream docs - Add usage examples for tags in each SDK Co-Authored-By: Claude Opus 4.5 --- api-reference/openapi.json | 7 +++++++ sdk/go/send.mdx | 14 ++++++++++++++ sdk/go/stream.mdx | 1 + sdk/python/send.mdx | 15 +++++++++++++++ sdk/python/stream.mdx | 1 + sdk/rust/send.mdx | 17 +++++++++++++++++ sdk/rust/stream.mdx | 1 + sdk/typescript/send.mdx | 15 +++++++++++++++ sdk/typescript/stream.mdx | 1 + 9 files changed, 72 insertions(+) diff --git a/api-reference/openapi.json b/api-reference/openapi.json index 269d3dd..68ccf29 100644 --- a/api-reference/openapi.json +++ b/api-reference/openapi.json @@ -323,6 +323,13 @@ } ], "description": "Controls which tool is called by the model." + }, + "tags": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional tags to categorize and label the request. Useful for filtering and grouping requests in analytics and logs." } } }, diff --git a/sdk/go/send.mdx b/sdk/go/send.mdx index 279ba2d..b72dd8b 100644 --- a/sdk/go/send.mdx +++ b/sdk/go/send.mdx @@ -42,6 +42,7 @@ When `input` is an `InputObject`, you have full control over the conversation: | `Messages` | `[]Message` | Array of conversation messages | | `Tools` | `[]Tool` | Array of function tools available to the model | | `ToolChoice` | `any` | Controls which tool (if any) the model should call. Can be `string` (`"auto"`, `"none"`) or `map[string]interface{}`. See [Tools documentation](/sdk/go/tools) for details | +| `Tags` | `[]string` | Optional tags to categorize and label the request for analytics and filtering | **Example with InputObject:** @@ -63,6 +64,19 @@ fmt.Println(response.Text()) // "2+2 equals 4." ``` +**Example with Tags:** + +```go +input := edgee.InputObject{ + Messages: []edgee.Message{ + {Role: "user", Content: "Summarize this article"}, + }, + Tags: []string{"summarization", "production", "user-123"}, +} + +response, err := client.Send("gpt-4o", input) +``` + #### Map Input You can also use a `map[string]interface{}` for dynamic input: diff --git a/sdk/go/stream.mdx b/sdk/go/stream.mdx index e2dd564..0bcd0d2 100644 --- a/sdk/go/stream.mdx +++ b/sdk/go/stream.mdx @@ -56,6 +56,7 @@ When `input` is an `InputObject` or `map[string]interface{}`, you have full cont | `Messages` | `[]Message` | Array of conversation messages | | `Tools` | `[]Tool` | Array of function tools available to the model | | `ToolChoice` | `any` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/go/tools) for details | +| `Tags` | `[]string` | Optional tags to categorize and label the request for analytics and filtering | For details about `Message` type, see the [Send Method documentation](/sdk/go/send#message-object). For details about `Tool` and `ToolChoice` types, see the [Tools documentation](/sdk/go/tools). diff --git a/sdk/python/send.mdx b/sdk/python/send.mdx index 8a3a351..d4a199e 100644 --- a/sdk/python/send.mdx +++ b/sdk/python/send.mdx @@ -41,6 +41,7 @@ When `input` is an `InputObject` or dictionary, you have full control over the c | `messages` | `list[dict]` | Array of conversation messages | | `tools` | `list[dict] \| None` | Array of function tools available to the model | | `tool_choice` | `str \| dict \| None` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/python/tools) for details | +| `tags` | `list[str] \| None` | Optional tags to categorize and label the request for analytics and filtering | **Example with Dictionary Input:** @@ -58,6 +59,20 @@ print(response.text) # "2+2 equals 4." ``` +**Example with Tags:** + +```python +response = edgee.send( + model="gpt-4o", + input={ + "messages": [ + {"role": "user", "content": "Summarize this article"} + ], + "tags": ["summarization", "production", "user-123"] + } +) +``` + ### Message Object Each message in the `messages` array has the following structure: diff --git a/sdk/python/stream.mdx b/sdk/python/stream.mdx index 16d1b55..7935ee4 100644 --- a/sdk/python/stream.mdx +++ b/sdk/python/stream.mdx @@ -39,6 +39,7 @@ When `input` is an `InputObject` or dictionary, you have full control over the c | `messages` | `list[dict]` | Array of conversation messages | | `tools` | `list[dict] \| None` | Array of function tools available to the model | | `tool_choice` | `str \| dict \| None` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/python/tools) for details | +| `tags` | `list[str] \| None` | Optional tags to categorize and label the request for analytics and filtering | For details about `Message` type, see the [Send Method documentation](/sdk/python/send#message-object). For details about `Tool` and `ToolChoice` types, see the [Tools documentation](/sdk/python/tools). diff --git a/sdk/rust/send.mdx b/sdk/rust/send.mdx index 92524b2..ccaf33d 100644 --- a/sdk/rust/send.mdx +++ b/sdk/rust/send.mdx @@ -56,6 +56,7 @@ When `input` is an `InputObject`, you have full control over the conversation: | `messages` | `Vec` | Array of conversation messages | | `tools` | `Option>` | Array of function tools available to the model | | `tool_choice` | `Option` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/rust/tools) for details | +| `tags` | `Option>` | Optional tags to categorize and label the request for analytics and filtering | **Example with InputObject:** @@ -71,6 +72,22 @@ println!("{}", response.text().unwrap_or("")); // "2+2 equals 4." ``` +**Example with Tags:** + +```rust +use edgee::{Message, InputObject}; + +let input = InputObject::new(vec![ + Message::user("Summarize this article") +]).with_tags(vec![ + "summarization".to_string(), + "production".to_string(), + "user-123".to_string() +]); + +let response = client.send("gpt-4o", input).await?; +``` + ### Message Object Each message in the `messages` array is created using `Message` constructors: diff --git a/sdk/rust/stream.mdx b/sdk/rust/stream.mdx index df72ebe..e261601 100644 --- a/sdk/rust/stream.mdx +++ b/sdk/rust/stream.mdx @@ -54,6 +54,7 @@ When `input` is a `Vec` or `InputObject`, you have full control over th | `messages` | `Vec` | Array of conversation messages | | `tools` | `Option>` | Array of function tools available to the model | | `tool_choice` | `Option` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/rust/tools) for details | +| `tags` | `Option>` | Optional tags to categorize and label the request for analytics and filtering | For details about `Message` type, see the [Send Method documentation](/sdk/rust/send#message-object). For details about `Tool` and `ToolChoice` types, see the [Tools documentation](/sdk/rust/tools). diff --git a/sdk/typescript/send.mdx b/sdk/typescript/send.mdx index ff8cf61..afc7c3d 100644 --- a/sdk/typescript/send.mdx +++ b/sdk/typescript/send.mdx @@ -44,6 +44,7 @@ When `input` is an `InputObject`, you have full control over the conversation: | `messages` | `Message[]` | Array of conversation messages | | `tools` | `Tool[]` | Array of function tools available to the model | | `tool_choice` | `ToolChoice` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/typescript/tools) for details | +| `tags` | `string[]` | Optional tags to categorize and label the request for analytics and filtering | **Example with InputObject:** @@ -61,6 +62,20 @@ console.log(response.text); // "2+2 equals 4." ``` +**Example with Tags:** + +```typescript +const response = await edgee.send({ + model: 'gpt-4o', + input: { + messages: [ + { role: 'user', content: 'Summarize this article' } + ], + tags: ['summarization', 'production', 'user-123'] + } +}); +``` + ### Message Object Each message in the `messages` array has the following structure: diff --git a/sdk/typescript/stream.mdx b/sdk/typescript/stream.mdx index 93a00d0..f3245bb 100644 --- a/sdk/typescript/stream.mdx +++ b/sdk/typescript/stream.mdx @@ -44,6 +44,7 @@ When `input` is an `InputObject`, you have full control over the conversation: | `messages` | `Message[]` | Array of conversation messages | | `tools` | `Tool[]` | Array of function tools available to the model | | `tool_choice` | `ToolChoice` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/typescript/tools) for details | +| `tags` | `string[]` | Optional tags to categorize and label the request for analytics and filtering | For details about `Message` type, see the [Send Method documentation](/sdk/typescript/send#message-object). For details about `Tool` and `ToolChoice` types, see the [Tools documentation](/sdk/typescript/tools). From d30ee163d8e7e229d3c4ae7539a4df6017ffaca2 Mon Sep 17 00:00:00 2001 From: Clement Bouvet Date: Mon, 26 Jan 2026 15:52:10 +0100 Subject: [PATCH 2/3] add header doc --- api-reference/openapi.json | 2 +- sdk/go/send.mdx | 2 +- sdk/go/stream.mdx | 2 +- sdk/python/send.mdx | 2 +- sdk/python/stream.mdx | 2 +- sdk/rust/send.mdx | 2 +- sdk/rust/stream.mdx | 2 +- sdk/typescript/send.mdx | 2 +- sdk/typescript/stream.mdx | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/api-reference/openapi.json b/api-reference/openapi.json index 68ccf29..8cab3da 100644 --- a/api-reference/openapi.json +++ b/api-reference/openapi.json @@ -329,7 +329,7 @@ "items": { "type": "string" }, - "description": "Optional tags to categorize and label the request. Useful for filtering and grouping requests in analytics and logs." + "description": "Optional tags to categorize and label the request. Useful for filtering and grouping requests in analytics and logs. Can also be sent via the `x-edgee-tags` header as a comma-separated string." } } }, diff --git a/sdk/go/send.mdx b/sdk/go/send.mdx index b72dd8b..ea3198a 100644 --- a/sdk/go/send.mdx +++ b/sdk/go/send.mdx @@ -42,7 +42,7 @@ When `input` is an `InputObject`, you have full control over the conversation: | `Messages` | `[]Message` | Array of conversation messages | | `Tools` | `[]Tool` | Array of function tools available to the model | | `ToolChoice` | `any` | Controls which tool (if any) the model should call. Can be `string` (`"auto"`, `"none"`) or `map[string]interface{}`. See [Tools documentation](/sdk/go/tools) for details | -| `Tags` | `[]string` | Optional tags to categorize and label the request for analytics and filtering | +| `Tags` | `[]string` | Optional tags to categorize and label the request for analytics and filtering. Can also be sent via the `x-edgee-tags` header (comma-separated) | **Example with InputObject:** diff --git a/sdk/go/stream.mdx b/sdk/go/stream.mdx index 0bcd0d2..e6d0690 100644 --- a/sdk/go/stream.mdx +++ b/sdk/go/stream.mdx @@ -56,7 +56,7 @@ When `input` is an `InputObject` or `map[string]interface{}`, you have full cont | `Messages` | `[]Message` | Array of conversation messages | | `Tools` | `[]Tool` | Array of function tools available to the model | | `ToolChoice` | `any` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/go/tools) for details | -| `Tags` | `[]string` | Optional tags to categorize and label the request for analytics and filtering | +| `Tags` | `[]string` | Optional tags to categorize and label the request for analytics and filtering. Can also be sent via the `x-edgee-tags` header (comma-separated) | For details about `Message` type, see the [Send Method documentation](/sdk/go/send#message-object). For details about `Tool` and `ToolChoice` types, see the [Tools documentation](/sdk/go/tools). diff --git a/sdk/python/send.mdx b/sdk/python/send.mdx index d4a199e..20c71cd 100644 --- a/sdk/python/send.mdx +++ b/sdk/python/send.mdx @@ -41,7 +41,7 @@ When `input` is an `InputObject` or dictionary, you have full control over the c | `messages` | `list[dict]` | Array of conversation messages | | `tools` | `list[dict] \| None` | Array of function tools available to the model | | `tool_choice` | `str \| dict \| None` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/python/tools) for details | -| `tags` | `list[str] \| None` | Optional tags to categorize and label the request for analytics and filtering | +| `tags` | `list[str] \| None` | Optional tags to categorize and label the request for analytics and filtering. Can also be sent via the `x-edgee-tags` header (comma-separated) | **Example with Dictionary Input:** diff --git a/sdk/python/stream.mdx b/sdk/python/stream.mdx index 7935ee4..752b2b4 100644 --- a/sdk/python/stream.mdx +++ b/sdk/python/stream.mdx @@ -39,7 +39,7 @@ When `input` is an `InputObject` or dictionary, you have full control over the c | `messages` | `list[dict]` | Array of conversation messages | | `tools` | `list[dict] \| None` | Array of function tools available to the model | | `tool_choice` | `str \| dict \| None` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/python/tools) for details | -| `tags` | `list[str] \| None` | Optional tags to categorize and label the request for analytics and filtering | +| `tags` | `list[str] \| None` | Optional tags to categorize and label the request for analytics and filtering. Can also be sent via the `x-edgee-tags` header (comma-separated) | For details about `Message` type, see the [Send Method documentation](/sdk/python/send#message-object). For details about `Tool` and `ToolChoice` types, see the [Tools documentation](/sdk/python/tools). diff --git a/sdk/rust/send.mdx b/sdk/rust/send.mdx index ccaf33d..703c9e1 100644 --- a/sdk/rust/send.mdx +++ b/sdk/rust/send.mdx @@ -56,7 +56,7 @@ When `input` is an `InputObject`, you have full control over the conversation: | `messages` | `Vec` | Array of conversation messages | | `tools` | `Option>` | Array of function tools available to the model | | `tool_choice` | `Option` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/rust/tools) for details | -| `tags` | `Option>` | Optional tags to categorize and label the request for analytics and filtering | +| `tags` | `Option>` | Optional tags to categorize and label the request for analytics and filtering. Can also be sent via the `x-edgee-tags` header (comma-separated) | **Example with InputObject:** diff --git a/sdk/rust/stream.mdx b/sdk/rust/stream.mdx index e261601..f4a1ba1 100644 --- a/sdk/rust/stream.mdx +++ b/sdk/rust/stream.mdx @@ -54,7 +54,7 @@ When `input` is a `Vec` or `InputObject`, you have full control over th | `messages` | `Vec` | Array of conversation messages | | `tools` | `Option>` | Array of function tools available to the model | | `tool_choice` | `Option` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/rust/tools) for details | -| `tags` | `Option>` | Optional tags to categorize and label the request for analytics and filtering | +| `tags` | `Option>` | Optional tags to categorize and label the request for analytics and filtering. Can also be sent via the `x-edgee-tags` header (comma-separated) | For details about `Message` type, see the [Send Method documentation](/sdk/rust/send#message-object). For details about `Tool` and `ToolChoice` types, see the [Tools documentation](/sdk/rust/tools). diff --git a/sdk/typescript/send.mdx b/sdk/typescript/send.mdx index afc7c3d..f3a04f8 100644 --- a/sdk/typescript/send.mdx +++ b/sdk/typescript/send.mdx @@ -44,7 +44,7 @@ When `input` is an `InputObject`, you have full control over the conversation: | `messages` | `Message[]` | Array of conversation messages | | `tools` | `Tool[]` | Array of function tools available to the model | | `tool_choice` | `ToolChoice` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/typescript/tools) for details | -| `tags` | `string[]` | Optional tags to categorize and label the request for analytics and filtering | +| `tags` | `string[]` | Optional tags to categorize and label the request for analytics and filtering. Can also be sent via the `x-edgee-tags` header (comma-separated) | **Example with InputObject:** diff --git a/sdk/typescript/stream.mdx b/sdk/typescript/stream.mdx index f3245bb..8c925de 100644 --- a/sdk/typescript/stream.mdx +++ b/sdk/typescript/stream.mdx @@ -44,7 +44,7 @@ When `input` is an `InputObject`, you have full control over the conversation: | `messages` | `Message[]` | Array of conversation messages | | `tools` | `Tool[]` | Array of function tools available to the model | | `tool_choice` | `ToolChoice` | Controls which tool (if any) the model should call. See [Tools documentation](/sdk/typescript/tools) for details | -| `tags` | `string[]` | Optional tags to categorize and label the request for analytics and filtering | +| `tags` | `string[]` | Optional tags to categorize and label the request for analytics and filtering. Can also be sent via the `x-edgee-tags` header (comma-separated) | For details about `Message` type, see the [Send Method documentation](/sdk/typescript/send#message-object). For details about `Tool` and `ToolChoice` types, see the [Tools documentation](/sdk/typescript/tools). From 80aa02db068943937e1bbb88f25307be4fea6e63 Mon Sep 17 00:00:00 2001 From: Clement Bouvet Date: Mon, 26 Jan 2026 16:14:10 +0100 Subject: [PATCH 3/3] openai sdk + langchain tags headers --- integrations/langchain.mdx | 25 +++++++++++++++++ sdk/openai/index.mdx | 57 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/integrations/langchain.mdx b/integrations/langchain.mdx index ab5bf94..728edf8 100644 --- a/integrations/langchain.mdx +++ b/integrations/langchain.mdx @@ -156,6 +156,31 @@ for chunk in llm.stream("Tell me a long story"): print(chunk.content, end="", flush=True) ``` +### Tags + +You can add tags to your requests for analytics and filtering using the `default_headers` parameter: + +```python +from langchain_openai import ChatOpenAI +import os + +llm = ChatOpenAI( + base_url="https://api.edgee.ai/v1", + api_key=os.getenv("API_KEY"), + model="mistral-small", + default_headers={ + "x-edgee-tags": "production,user-123,langchain", + }, +) + +# All requests from this client will include these tags +response = llm.invoke("What is LangChain?") +``` + + + Tags are comma-separated strings in the header. They help you categorize and filter requests in Edgee's analytics dashboard. + + ## Authentication Edgee uses standard Bearer token authentication. Set your API key as an environment variable: diff --git a/sdk/openai/index.mdx b/sdk/openai/index.mdx index 0148214..aafb332 100644 --- a/sdk/openai/index.mdx +++ b/sdk/openai/index.mdx @@ -186,6 +186,63 @@ else: +### Tags + +You can add tags to your requests for analytics and filtering using the `x-edgee-tags` header: + + + +```typescript title="TypeScript" +import OpenAI from "openai"; + +const openai = new OpenAI({ + baseURL: "https://api.edgee.ai/v1", + apiKey: process.env.EDGEE_API_KEY, + defaultHeaders: { + "x-edgee-tags": "production,user-123,summarization", + }, +}); + +// All requests will include these tags +const completion = await openai.chat.completions.create({ + model: "gpt-4o", + messages: [ + { role: "user", content: "What is the capital of France?" } + ], +}); +``` + +```python title="Python" +from openai import OpenAI +from os import getenv + +# Tags applied to all requests via default headers +client = OpenAI( + base_url="https://api.edgee.ai/v1", + api_key=getenv("EDGEE_API_KEY"), + default_headers={ + "x-edgee-tags": "production,user-123,summarization", + }, +) + +# Or per-request using extra_headers +completion = client.chat.completions.create( + model="gpt-4o", + messages=[ + {"role": "user", "content": "What is the capital of France?"}, + ], + extra_headers={ + "x-edgee-tags": "one-off-tag,experiment", + }, +) +``` + + + + + Tags are comma-separated strings in the header. They help you categorize and filter requests in Edgee's analytics dashboard. + + ### Streaming Responses Edgee supports streaming responses for real-time token delivery: