{"id":37023404,"url":"https://github.com/sunra-ai/sunra-clients","last_synced_at":"2026-08-27T16:14:30.778Z","repository":{"id":303961091,"uuid":"938479214","full_name":"sunra-ai/sunra-clients","owner":"sunra-ai","description":null,"archived":false,"fork":false,"pushed_at":"2026-08-17T04:47:42.000Z","size":1926,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-08-17T04:48:33.373Z","etag":null,"topics":["ai","image-generation","inference-api","sdk","sunra","video-generation"],"latest_commit_sha":null,"homepage":"https://sunra.ai/r/3z60eldt","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunra-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-25T02:48:40.000Z","updated_at":"2026-08-17T04:47:45.000Z","dependencies_parsed_at":"2025-09-11T05:15:49.854Z","dependency_job_id":"19de23df-1330-4507-baca-190f23715fac","html_url":"https://github.com/sunra-ai/sunra-clients","commit_stats":null,"previous_names":["sunra-ai/sunra-clients"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sunra-ai/sunra-clients","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunra-ai%2Fsunra-clients","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunra-ai%2Fsunra-clients/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunra-ai%2Fsunra-clients/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunra-ai%2Fsunra-clients/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunra-ai","download_url":"https://codeload.github.com/sunra-ai/sunra-clients/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunra-ai%2Fsunra-clients/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36944709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-08-22T15:14:58.755Z","status":"online","status_checked_at":"2026-08-27T02:00:07.166Z","response_time":96,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","image-generation","inference-api","sdk","sunra","video-generation"],"created_at":"2026-01-14T02:48:46.828Z","updated_at":"2026-08-27T16:14:30.773Z","avatar_url":"https://github.com/sunra-ai.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sunra.ai Client Libraries\n\n[English](./README.md) | [简体中文](./README.zh-CN.md)\n\n[![License](https://img.shields.io/github/license/sunra-ai/sunra-clients?style=flat-square)](./LICENSE)\n[![@sunra/client npm package](https://img.shields.io/npm/v/@sunra/client?color=%237527D7\u0026label=JavaScript\u0026style=flat-square)](https://www.npmjs.com/package/@sunra/client)\n[![PyPI - Version](https://img.shields.io/pypi/v/sunra_client)](https://pypi.org/project/sunra_client)\n[![Maven Central Version](https://img.shields.io/maven-central/v/ai.sunra.client/sunra-client)](https://search.maven.org/artifact/ai.sunra.client/sunra-client)\n[![Discord](https://img.shields.io/discord/897qCzvCcU?style=flat-square\u0026logo=discord\u0026label=Discord\u0026color=5865F2)](https://discord.gg/897qCzvCcU)\n\n## About the Project\n\nThis repository contains the official client libraries for [sunra.ai](https://sunra.ai), a platform for deploying and running AI models. The libraries provide robust and user-friendly interfaces for integrating sunra.ai endpoints into your applications across multiple programming languages.\n\n## Available Client Libraries\n\n### 🐍 Python Client\n\n- **Location**: [`clients/python/`](./clients/python/)\n- **Package**: `sunra-client` (PyPI)\n- **Features**: Synchronous and asynchronous support, streaming responses, file uploads\n- **Installation**: `pip install sunra-client`\n\n### 📦 JavaScript/TypeScript Client\n\n- **Location**: [`clients/javascript/`](./clients/javascript/)\n- **Package**: `@sunra/client` (npm)\n- **Features**: Works in Web, Node.js, and React Native environments\n- **Installation**: `npm install @sunra/client`\n\n### ☕ Java Client\n\n- **Location**: [`clients/java/`](./clients/java/)\n- **Package**: `ai.sunra.client:sunra-client` (Maven Central)\n- **Features**: Synchronous, asynchronous, and Kotlin coroutine support\n- **Installation**: `implementation \"ai.sunra.client:sunra-client:0.1.6\"`\n\n## Quick Start\n\nBefore using any client library, you'll need to:\n\n1. Sign up at [sunra.ai](https://sunra.ai)\n2. Get your API key from the [dashboard](https://sunra.ai/dashboard/api-tokens)\n3. Set your API key as an environment variable: `export SUNRA_KEY=your-api-key`\n\n### Python Example\n\n```python\nimport sunra_client\n\n# Simple synchronous call\nresult = sunra_client.subscribe(\n    \"openai/gpt-image-2/text-to-image\",\n    arguments={\"prompt\": \"a cute cat, realistic, orange\", \"quality\": \"high\"}\n)\nprint(result[\"images\"][0][\"url\"])\n\n# Asynchronous call\nasync def main():\n    result = await sunra_client.subscribe_async(\n        \"openai/gpt-image-2/text-to-image\",\n        arguments={\"prompt\": \"a cute cat, realistic, orange\", \"quality\": \"high\"}\n    )\n    print(result[\"images\"][0][\"url\"])\n```\n\n### JavaScript Example\n\n```typescript\nimport { createSunraClient } from \"@sunra/client\";\n\nconst sunra = createSunraClient({\n  credentials: process.env.SUNRA_KEY,\n});\n\nconst result = await sunra.subscribe(\"openai/gpt-image-2/text-to-image\", {\n  input: {\n    prompt: \"a cute cat, realistic, orange\",\n    quality: \"high\",\n  },\n});\nconsole.log(result.images[0].url);\n```\n\n## LLM APIs\n\nSunra's LLM endpoints are compatible with the standard OpenAI and Anthropic API formats. Use the corresponding official SDK with `https://api-llm.sunra.ai/v1` as the base URL; a separate Sunra LLM package is not required.\n\n```javascript\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI({\n  apiKey: process.env.SUNRA_KEY,\n  baseURL: \"https://api-llm.sunra.ai/v1\",\n});\n\nconst completion = await client.chat.completions.create({\n  model: \"google/gemini-2.5-flash\",\n  messages: [{ role: \"user\", content: \"Hello\" }],\n  provider: { only: [\"google-vertexai\"] },\n});\n```\n\nOmit `provider` to use automatic routing. See the [LLM documentation](https://docs.sunra.ai/llm/llm-quickstart) and the runnable Node.js and Python examples in this repository.\n\n### Java Example\n\n```java\nimport ai.sunra.client.*;\n\nvar sunra = SunraClient.withEnvCredentials();\n\nvar result = sunra.subscribe(\n    \"openai/gpt-image-2/text-to-image\",\n    SubscribeOptions.\u003cJsonObject\u003ebuilder()\n        .input(Map.of(\n            \"prompt\", \"a cute cat, realistic, orange\",\n            \"quality\", \"high\"\n        ))\n        .resultType(JsonObject.class)\n        .build()\n);\nSystem.out.println(result.getData());\n```\n\n## Server Proxy\n\nFor client-side applications, we provide a server proxy to securely handle API calls without exposing your credentials. Available for popular frameworks:\n\n- **Location**: [`server-proxy/`](./server-proxy/)\n- **Package**: `@sunra/server-proxy` (npm)\n- **Supports**: Next.js, Express, Hono, Remix, SvelteKit\n\n## MCP Server (Model Context Protocol)\n\nThe MCP server provides a universal interface for AI model tools, enabling seamless integration with modern code assistants and IDEs such as Cursor and Claude Desktop. It acts as a bridge between Sunra.ai and your development environment, exposing Sunra's models and tools via the [Model Context Protocol](https://github.com/modelcontextprotocol).\n\n**Why use the MCP server?**\n\n- Enables code assistants (like Cursor, Claude, etc.) to access Sunra models and tools directly from your editor\n- Supports listing models, fetching schemas, submitting jobs, streaming results, and more\n- Secure: API keys are managed via environment variables or runtime configuration\n- No need to write glue code—just run the server and connect your tool\n\n### Quick Start\n\n#### 1. Install \u0026 Run (no local build needed)\n\n```bash\nnpx @sunra/mcp-server --transport http --port 3925\n```\n\n#### 2. For Cursor IDE\n\n- Add to your `.cursor/mcp.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"sunra-mcp-server\": {\n      \"url\": \"http://localhost:3925/sse\"\n    }\n  }\n}\n```\n\n- Set your API key:\n  ```bash\n  export SUNRA_KEY=\"your-api-key-here\"\n  ```\n- In Cursor, select the `sunra-mcp-server` and use tools like `list-models`, `model-schema`, etc.\n\n#### 3. For Claude Desktop (Anthropic)\n\n- Start the server in stdio mode (default):\n  ```bash\n  npx @sunra/mcp-server\n  ```\n- In Claude Desktop settings, add a new MCP server:\n  - **Type:** Local executable\n  - **Command:** `npx @sunra/mcp-server`\n  - **Environment Variables:**\n    ```\n    SUNRA_KEY=your-api-key-here\n    ```\n- In Claude, select the `sunra-mcp-server` and use the available tools.\n\n#### 4. Advanced Usage \u0026 Documentation\n\n- See [`mcp-server/README.md`](./mcp-server/README.md) for full tool list, development, and troubleshooting.\n\n## Examples\n\nThe repository includes comprehensive examples for different frameworks and use cases:\n\n- **Next.js Apps**: [`examples/demo-nextjs-app-router/`](./examples/demo-nextjs-app-router/) and [`examples/demo-nextjs-page-router/`](./examples/demo-nextjs-page-router/)\n- **Node.js**: [`examples/demo-nodejs/`](./examples/demo-nodejs/)\n- **Express**: [`examples/demo-express-app/`](./examples/demo-express-app/)\n- **Java**: [`examples/demo-java/`](./examples/demo-java/)\n- **Java Async**: [`examples/demo-java-async/`](./examples/demo-java-async/)\n- **Kotlin**: [`examples/demo-kotlin/`](./examples/demo-kotlin/)\n- **Python**: [`examples/demo-python/`](./examples/demo-python/)\n\n## Development\n\nTo set up the development environment:\n\n1. Clone the repository\n2. Install dependencies: `pnpm i -r`\n3. Set up your API key: `export SUNRA_KEY=your-api-key`\n4. Run examples or tests as needed\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n1. Make sure you read our [Code of Conduct](./CODE_OF_CONDUCT.md)\n2. Fork the project and clone your fork\n3. Setup the local environment with `npm install`\n4. Create a feature branch (`git checkout -b feat/add-cool-thing`) or a bugfix branch (`git checkout -b fix/smash-that-bug`)\n5. Commit the changes (`git commit -m 'feat(client): added a cool thing'`) - use [conventional commits](https://conventionalcommits.org)\n6. Push to the branch (`git push --set-upstream origin feat/add-cool-thing`)\n7. Open a Pull Request\n\nCheck the [good first issue queue](https://github.com/sunra-ai/sunra-clients/labels/good+first+issue), your contribution will be welcome!\n\n## License\n\nDistributed under the Apache 2.0 License. See [LICENSE](./LICENSE) for more information.\n\n## Credits\n\nThis project is derived from:\n\n- [fal-ai/fal-js](https://github.com/fal-ai/fal-js)\n- [fal-ai/fal-java](https://github.com/fal-ai/fal-java)\n- [fal-ai/fal](https://github.com/fal-ai/fal/tree/main/projects/fal_client)\n\nand adapted to work with sunra.ai. The original projects are licensed under the MIT/Apache 2.0 License. We extend our gratitude to the original authors for their contributions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunra-ai%2Fsunra-clients","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunra-ai%2Fsunra-clients","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunra-ai%2Fsunra-clients/lists"}