Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@
weak
[file "src/xAI.Protocol/chat.proto"]
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/chat.proto
sha = 17a2da08cbbf89aa1f33ffe58b687fe0b2d50468
etag = e7da2c915664caf64c0da7d886826de37fcf98753cf613a6ad8aad96f6ddcda5
sha = 2c2df4f5d9429f5f21e58bb9e63285c69bcc144f
etag = 061acaded15e83e3056dfcb1a738cd6aa0cad27f7f6ec38b6bf84e3077d448ac
weak
[file "src/xAI.Protocol/deferred.proto"]
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/deferred.proto
Expand All @@ -172,8 +172,8 @@
weak
[file "src/xAI.Protocol/image.proto"]
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/image.proto
sha = d67bcf3e661aa9641af9750632fa1c38ea974da1
etag = 3ea27e240320c26d14b8c64d00f236c078127ebdb6fa957efc49232dfd75a20c
sha = 2c2df4f5d9429f5f21e58bb9e63285c69bcc144f
etag = 3d66f35d2e1555c6eae2218705b6f8ee5fa6537939b6ae0a18e0a2fd13a81bff
weak
[file "src/xAI.Protocol/models.proto"]
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/models.proto
Expand All @@ -192,13 +192,13 @@
weak
[file "src/xAI.Protocol/usage.proto"]
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/usage.proto
sha = d8def643bea79ad10f5a678d70ae37edca26490f
etag = 74c44beb7bfd2e75ea0524ff9be820cc067e009b071dee59869a16d372280a0a
sha = 2c2df4f5d9429f5f21e58bb9e63285c69bcc144f
etag = 0bf9577be87d3cfc79895971071ef1eaa78645cb784462e7e90bff03440dfff4
weak
[file "src/xAI.Protocol/video.proto"]
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/video.proto
sha = 43a1b6b731943b8f031c2f2d946f7183f0933ffd
etag = 37562e78a6d64800b09c643632a33b6bc902955b491114bd5b6ec957d23d6e64
sha = 723dd2aa22d17be35617463837dc47cda008d90e
etag = 24af69223d5fafc1ae8554f1ee43fdb0ff8c1eeacfa2e8ce9719fd58179d2fb8
weak
[file "src/xAI.Protocol/google/protobuf/timestamp.proto"]
url = https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/timestamp.proto
Expand Down Expand Up @@ -233,6 +233,6 @@
weak
[file "src/xAI.Protocol/files.proto"]
url = https://github.com/xai-org/xai-proto/blob/main/proto/xai/api/v1/files.proto
etag = 4c91f851b288a225acfc1173f2f8853a1b550da1e97d2fdcec99debb5f8fac43
etag = b5e8ed748220b2fa727e8845f09f612cb77813d02c4260b77e6464aa0c98d57f
weak
sha = 0c0f5353aa7ab2a4ffea310f9d9364ed5c424af2
sha = c666ac39e9a8f562e94b2b57872a75bc1438ec2b
1 change: 0 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ Uses your own API Key.
[![DRIVE.NET, Inc.](https://avatars.githubusercontent.com/u/15047123?v=4&s=39 "DRIVE.NET, Inc.")](https://github.com/drivenet)
[![Keith Pickford](https://avatars.githubusercontent.com/u/16598898?u=64416b80caf7092a885f60bb31612270bffc9598&v=4&s=39 "Keith Pickford")](https://github.com/Keflon)
[![Thomas Bolon](https://avatars.githubusercontent.com/u/127185?u=7f50babfc888675e37feb80851a4e9708f573386&v=4&s=39 "Thomas Bolon")](https://github.com/tbolon)
[![Kori Francis](https://avatars.githubusercontent.com/u/67574?u=3991fb983e1c399edf39aebc00a9f9cd425703bd&v=4&s=39 "Kori Francis")](https://github.com/kfrancis)
[![Reuben Swartz](https://avatars.githubusercontent.com/u/724704?u=2076fe336f9f6ad678009f1595cbea434b0c5a41&v=4&s=39 "Reuben Swartz")](https://github.com/rbnswartz)
[![Jacob Foshee](https://avatars.githubusercontent.com/u/480334?v=4&s=39 "Jacob Foshee")](https://github.com/jfoshee)
[![](https://avatars.githubusercontent.com/u/33566379?u=bf62e2b46435a267fa246a64537870fd2449410f&v=4&s=39 "")](https://github.com/Mrxx99)
Expand Down
29 changes: 21 additions & 8 deletions src/xAI.Protocol/chat.proto
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
syntax = "proto3";
option csharp_namespace = "xAI.Protocol";

package xai_api;

import "google/protobuf/timestamp.proto";
import "deferred.proto";
import "documents.proto";
import "image.proto";
import "sample.proto";
import "usage.proto";
import "xai/api/v1/deferred.proto";
import "xai/api/v1/documents.proto";
import "xai/api/v1/image.proto";
import "xai/api/v1/sample.proto";
import "xai/api/v1/usage.proto";

// An API that exposes our language models via a Chat interface.
service Chat {
Expand Down Expand Up @@ -144,7 +143,7 @@ message GetCompletionsRequest {
// new topics.
optional float presence_penalty = 9;

// Constrains effort on reasoning for reasoning models. Default to `EFFORT_MEDIUM`.
// Constrains effort on reasoning for reasoning models. Defaults vary by model (e.g. `grok-4.5` and `grok-4.6` default to `EFFORT_HIGH`).
optional ReasoningEffort reasoning_effort = 19;

// Set the parameters to be used for realtime data. If not set, no realtime data will be acquired by the model.
Expand Down Expand Up @@ -609,6 +608,7 @@ enum ReasoningEffort {
EFFORT_MEDIUM = 2;
EFFORT_HIGH = 3;
EFFORT_NONE = 4;
EFFORT_XHIGH = 5;
}

// Number of agents to use for multi-agent models.
Expand Down Expand Up @@ -672,6 +672,8 @@ message Tool {
MCP mcp = 7;
// Built in attachment search.
AttachmentSearch attachment_search = 8;
// Built in image generation.
ImageGeneration image_generation = 10;
}
}

Expand Down Expand Up @@ -767,6 +769,13 @@ message XSearch {

message CodeExecution {}

message ImageGeneration {
// Which image capabilities to expose to the model. One of "auto" (the default;
// both generation and editing), "generate" (text-to-image only), or
// "edit" (image editing only).
optional string action = 1;
}

message CollectionsSearch {
// The ID(s) of the source collection(s) within which the search should be performed.
// A maximum of 10 collections IDs can be used for search.
Expand Down Expand Up @@ -839,6 +848,10 @@ enum ToolCallType {
// Indicates the tool is a server-side attachment_search tool, and client side won't need to execute.
// Maps to `attachment_search_call` type in OAI Responses API.
TOOL_CALL_TYPE_ATTACHMENT_SEARCH_TOOL = 7;

// Indicates the tool is a server-side image_generation tool, and client side won't need to execute.
// Maps to `image_generation_call` type in OAI Responses API.
TOOL_CALL_TYPE_IMAGE_GENERATION_TOOL = 10;
}

enum ToolCallStatus {
Expand Down Expand Up @@ -1059,7 +1072,7 @@ message RequestSettings {
// The ID of the previous response from the model.
optional string previous_response_id = 3;

// Constrains effort on reasoning for reasoning models. Default to `EFFORT_MEDIUM`.
// Constrains effort on reasoning for reasoning models. Defaults vary by model (e.g. `grok-4.5` and `grok-4.6` default to `EFFORT_HIGH`).
optional ReasoningEffort reasoning_effort = 4;

// A number between 0 and 2 used to control the variance of completions.
Expand Down
103 changes: 102 additions & 1 deletion src/xAI.Protocol/files.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
syntax = "proto3";
option csharp_namespace = "xAI.Protocol";

package xai_api;

Expand Down Expand Up @@ -36,6 +35,45 @@ service Files {
// Stream the file's contents in chunks of up to 5 MB, in order.
// Concatenate `data` from every chunk to reconstruct the file.
rpc RetrieveFileContent(RetrieveFileContentRequest) returns (stream FileContentChunk) {}

// Create a public, unauthenticated URL for a file, accessible without an
// API key. Only images, videos, and PDFs can be made public.
//
// A file can have at most one public URL at a time. Calling this on a
// file that already has a public URL returns the existing URL. To update
// the expiry, call again with a new `expires_after` value.
//
// **Public URL expiry behavior:**
//
// - If `expires_after` is set, the public URL expires that many seconds
// from now, independently of the file's own TTL.
// - If `expires_after` is omitted and the file has a TTL
// (`UploadFileInit.expires_after` was set at upload), the public URL
// automatically inherits the file's expiry — it will expire at the
// same time as the file.
// - If `expires_after` is omitted and the file has no TTL, the public
// URL remains valid indefinitely (until explicitly revoked or the file
// is deleted).
//
// **Automatic revocation:**
//
// A public URL is automatically revoked when the file is deleted (by the
// user or by TTL expiry). Revocation may not take effect immediately, so
// the URL can remain accessible for a short period after the file or the
// public URL expires. Call `RevokePublicUrl` to revoke immediately.
rpc CreatePublicUrl(CreatePublicUrlRequest) returns (CreatePublicUrlResponse) {}

// Revoke the public URL for a file. After revocation the public URL is
// no longer accessible, while the original file remains accessible via
// authenticated endpoints.
//
// Public URLs are also automatically revoked when the file is deleted,
// when the file's TTL elapses, or when the public URL's own expiry
// elapses. Automatic revocation may not take effect immediately; use this
// RPC to revoke a public URL right away.
//
// Returns success if the file has no public URL (nothing to revoke).
rpc RevokePublicUrl(RevokePublicUrlRequest) returns (RevokePublicUrlResponse) {}
}

// First stream message of an `UploadFile` call. Sent exactly once, before
Expand Down Expand Up @@ -84,6 +122,14 @@ message File {
string id = 5;

reserved 6;

// Public URL for the file. Only present when the file has an active
// public URL (created via CreatePublicUrl or storage_options.public_url).
optional string public_url = 7;

// When the public URL expires. Only present when public_url is set
// and has an independent expiry.
optional google.protobuf.Timestamp public_url_expires_at = 8;
}

// Sort direction for list-style RPCs.
Expand Down Expand Up @@ -119,6 +165,16 @@ message ListFilesRequest {

// Sort field. Defaults to `FILES_SORT_BY_CREATED_AT`.
optional FilesSortBy sort_by = 4;

// AIP-160 filter expression to narrow down results.
// Supported fields: file_id, name (or file_name), size_bytes,
// content_type, created_at, expires_at, upload_status, user_defined_id.
// Operators: =, !=, >, >=, <, <=, AND, OR, NOT.
// Examples:
// - 'name:"report"'
// - 'content_type = "application/pdf"'
// - 'size_bytes > 1000000 AND created_at > "2024-01-01T00:00:00Z"'
optional string filter = 5;
}

// Response message for `Files.ListFiles`.
Expand Down Expand Up @@ -179,3 +235,48 @@ message FileContentChunk {
// Up to 5 MB of file bytes. Final/intermediate chunks may be smaller.
bytes data = 1;
}

// Request message for `Files.CreatePublicUrl`.
message CreatePublicUrlRequest {
// The ID of the file to create a public URL for.
string file_id = 1;

// Seconds from now until the public URL expires. Must be between 3600
// (1 hour) and 2592000 (30 days).
//
// If omitted and the file has a TTL, the public URL inherits the file's
// expiry. If omitted and the file has no TTL, the public URL remains
// valid indefinitely until the file is deleted or the URL is explicitly
// revoked via `RevokePublicUrl`.
optional int64 expires_after = 2;
}

// Response message for `Files.CreatePublicUrl`.
message CreatePublicUrlResponse {
// The full public URL that can be shared and accessed without an API key.
string public_url = 1;

// When the public URL expires. Present when the public URL has an expiry,
// either from an explicit `expires_after` in the request or inherited from
// the file's TTL. Absent when the public URL is valid indefinitely.
optional google.protobuf.Timestamp expires_at = 2;
}

// Request message for `Files.RevokePublicUrl`.
message RevokePublicUrlRequest {
// The ID of the file whose public URL should be revoked.
string file_id = 1;
}

// Response message for `Files.RevokePublicUrl`.
message RevokePublicUrlResponse {
// The file ID whose public URL was revoked.
string file_id = 1;

// True if a public URL was actually revoked. False if the file had
// no active public URL (no-op).
bool revoked = 2;

// The full public URL that was revoked. Only present when revoked is true.
optional string public_url = 3;
}
Loading
Loading