xAI has introduced Public URLs as a new feature within its Files API, enabling users to transform privately stored files into shareable links. These URLs provide unauthenticated access to files hosted on the xAI CDN, according to xAI Docs. This functionality is available for files uploaded through the Files API, which by default reside in private storage and require an API key for retrieval.
Key Points
- Public URLs convert a stored file into a permanent, shareable link on the xAI CDN.
- Accessing a Public URL does not require an API key.
- Creating a Public URL does not alter the underlying private file, and revoking it does not delete the file.
- Users can revoke a Public URL at any time via an API call, immediately invalidating the link.
- Public URLs can be configured with an
expires_aftersetting, allowing automatic revocation after a specified duration (from 1 hour up to 30 days). - For files generated using the Imagine API, a Public URL can be created in the same request through
storage_options.public_url.
Context
According to xAI Docs, files uploaded to the Files API are private by default, necessitating an API key for access. The introduction of Public URLs provides an alternative for sharing content more broadly. For scenarios requiring gated access, xAI recommends keeping files private and serving them through a user's own backend using the authenticated GET /v1/files/{file_id}/content endpoint.
Why It Matters
This feature offers developers greater flexibility in managing and distributing content, balancing security with ease of sharing. It simplifies the process of making files accessible to a wider audience while retaining control over their lifecycle, which can be particularly useful for applications built with models like Grok 4.6 that might generate or utilize various file types.
What To Do
- Review the xAI Docs on Public URLs to understand the implementation details.
- Test the
create_public_urlandrevoke_public_urlAPI calls with your existing files. - Explore setting the
expires_afterparameter for time-limited sharing needs. - If using the Imagine API, investigate integrating
storage_options.public_urlinto your image or video generation requests.
