For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Copy to LLMGithubGo to App
DocumentationIntegrationsAgent OptimizationSelf-hosting OpikSDK & API referenceOpik University
DocumentationIntegrationsAgent OptimizationSelf-hosting OpikSDK & API referenceOpik University
    • Overview
  • TypeScript
    • Opik TypeScript SDK
  • Python
      • Anthropic
      • Bedrock
      • BytePlus
      • Cohere
      • DeepSeek
      • Fireworks AI
      • Gemini
      • Groq
      • Mistral AI
      • Novita AI
      • Ollama
      • OpenAI
      • Qianfan
      • Predibase
      • Together AI
      • WatsonX
      • xAI Grok
    • Opik Python SDK
    • OpenTelemetry Python SDK
  • Java
    • Spring AI
    • Quarkus LangChain4j
  • .NET
  • Ruby
    • OpenTelemetry Ruby SDK
  • No-Code
    • Cursor
    • Dify
    • Flowise
    • Langflow
    • n8n
    • OpenClaw
    • OpenAI Codex
    • OpenWebUI
    • Prompt Flow
  • Multi-Language
    • OpenTelemetry
LogoLogo
Copy to LLMGithubGo to App
On this page
  • Getting started
  • Tracking BytePlus API calls
  • Advanced Usage
  • Using with @track decorator
  • Troubleshooting
  • Common Issues
  • Getting Help
  • Next Steps
PythonModel Providers

Observability for BytePlus with Opik

Was this page helpful?
Previous

Observability for Cohere with Opik

Next
Built with

BytePlus is ByteDance’s AI-native enterprise platform offering ModelArk, a comprehensive Platform-as-a-Service (PaaS) solution for deploying and utilizing powerful large language models. It provides access to SkyLark models, DeepSeek V3.1, Kimi-K2, and other cutting-edge AI models with enterprise-grade security and scalability.

This guide explains how to integrate Opik with BytePlus using the OpenAI SDK. BytePlus provides OpenAI-compatible API endpoints that allow you to use the standard OpenAI client with BytePlus models.

Getting started

First, ensure you have both opik and openai packages installed:

$pip install opik openai

You’ll also need a BytePlus API key. Find a guide on creating your BytePlus API keys for model services here.

Tracking BytePlus API calls

1from opik.integrations.openai import track_openai
2from openai import OpenAI
3
4# Initialize the OpenAI client with BytePlus base URL
5client = OpenAI(
6 base_url="https://ark.ap-southeast.bytepluses.com/api/v3",
7 api_key="YOUR_BYTEPLUS_API_KEY"
8)
9client = track_openai(client)
10
11response = client.chat.completions.create(
12 model="kimi-k2-250711", # You can use any model available on BytePlus
13 messages=[
14 {"role": "user", "content": "Hello, world!"}
15 ],
16 temperature=0.7,
17 max_tokens=100
18)
19
20print(response.choices[0].message.content)

Advanced Usage

Using with @track decorator

You can combine the tracked client with Opik’s @track decorator for comprehensive tracing:

1from opik import track
2from opik.integrations.openai import track_openai
3from openai import OpenAI
4
5client = OpenAI(
6 base_url="https://ark.ap-southeast.bytepluses.com/api/v3",
7 api_key="YOUR_BYTEPLUS_API_KEY"
8)
9client = track_openai(client)
10
11@track
12def analyze_data_with_ai(query: str):
13 """Analyze data using BytePlus AI models."""
14
15 response = client.chat.completions.create(
16 model="kimi-k2-250711",
17 messages=[
18 {"role": "user", "content": query}
19 ]
20 )
21
22 return response.choices[0].message.content
23
24# Call the tracked function
25result = analyze_data_with_ai("Analyze this business data...")

Troubleshooting

Common Issues

  1. Authentication Errors: Ensure your API key is correct and has the necessary permissions
  2. Model Not Found: Verify the model name is available on BytePlus
  3. Rate Limiting: BytePlus may have rate limits; implement appropriate retry logic
  4. Base URL Issues: Ensure the base URL is correct for your BytePlus deployment

Getting Help

  • Check the BytePlus API documentation for detailed error codes
  • Contact BytePlus support for API-specific problems
  • Check Opik documentation for tracing and evaluation features

Next Steps

Once you have BytePlus integrated with Opik, you can:

  • Evaluate your LLM applications using Opik’s evaluation framework
  • Create datasets to test and improve your models
  • Set up feedback collection to gather human evaluations
  • Monitor performance across different models and configurations

For more information about using Opik with OpenAI-compatible APIs, see the OpenAI integration guide.